数据添加异步解析刷新大数据量redis (——)(二) SpringBoot之CommandLineRunner接口和ApplicationRunner接口

在spring boot应用中,咱们能够在程序启动以前执行任何任务。为了达到这个目的,咱们须要使用CommandLineRunner或ApplicationRunner接口建立bean,spring boot会自动监测到它们。这两个接口都有一个run()方法,在实现接口时须要覆盖该方法,并使用@Component注解使其成为bean。CommandLineRunner和ApplicationRun
相关文章
相关标签/搜索