spring启动时自动加载

@Configuration
@ComponentScan(value="")
public class IDGenConfig {
@Bean(initMethod = "init")
public BeanWayService useBeanWayService(){
return new BeanWayService();
}
}

public class BeanWayService {
public void init(){

}
}

实现ApplicationListener<ApplicationReadyEvent> 重写 onApplicationEvent方法
posted @ 2021-01-25 15:59  daping  阅读(154)  评论(0编辑  收藏  举报