SpringBoot ApplicationRunner/CommandLineRunner

CommandLineRunner、ApplicationRunner 接口是在容器启动成功后的最后一步回调(相似开机自动启动)。java

CommandLineRunner、ApplicationRunner 用法和做用都差很少,惟一不一样的是在接收的参数形式上不一致。app

 

以启动Jar包为例

  CommandLineRunner: java -jar commandLineRunner.jar 0.0.0.0,80接口

  ApplicationRunner: java -jar applicationRunner.jar --host=0.0.0.0 --port=80get

 

参考文章:https://www.jianshu.com/p/5d4ffe267596io

相关文章
相关标签/搜索