Spring-boot初使用(三)

ApplicationRunner 和CommandLineRunner ApplicationRunner 和CommandLineRunner 都是在SpringApplication.run() 完成之前调用。 使用场景:可以用作初始化内存数据,以及执前的检查和其他操作。 这个和监听器是不一样的。 只要继承两个中的一个,并且使用@Component注册,就可以在启动之前做一些操作 需要实现O
相关文章
相关标签/搜索