美文网首页
ApplicationRunner CommandLineRun

ApplicationRunner CommandLineRun

作者: 风雨楼兰 | 来源:发表于2018-10-20 15:46 被阅读0次

当需要在Spring Boot启动后搞点事情的时候,实现ApplicationRunner 或CommandLineRunner

@Component
public class MyBean implements CommandLineRunner {
public void run(String... args) {
// Do something...
}
}

ApplicationRunner提供ApplicationArguments作为参数,CommandLineRunner提供String[]

相关文章

网友评论

      本文标题:ApplicationRunner CommandLineRun

      本文链接:https://www.haomeiwen.com/subject/sormzftx.html