摘要:        
有时候在代码中,不希望使用自动注入,而是手动获取Spring容器以及Spring容器中的某个对象 1、首先写一个class实现ApplicationContextAware import org.springframework.beans.BeansException; import org.spr    阅读全文
posted @ 2020-11-19 14:00
青岑
阅读(888)
评论(0)
推荐(0)
        
            
        
        
摘要:        
ApplicationRunner接口 在项目中,可能会遇到这样一个问题:在项目启动完成之后,紧接着执行一段代码。 在SpringBoot中,提供了一个接口:ApplicationRunner。该接口中,只有一个run方法,他执行的时机是:spring容器启动完成之后,就会紧接着执行这个接口实现类的    阅读全文
posted @ 2020-11-19 12:43
青岑
阅读(555)
评论(0)
推荐(0)
        

 浙公网安备 33010602011771号
浙公网安备 33010602011771号