网站介绍:文章浏览阅读1k次。在Springboot中注入静态变量@Componentclass MyComp{ @Autowire MyObject mo;}//√@Componentclass MyComp{ @Autowire static MyObject mo;}//× mo为null解决方法:@PostConstruct@Componentclass MyComp{ @Autowired MyObject t_mo; static MyObject mo; @PostConstr_springboot component 注入statics变量
- 链接地址:https://blog.csdn.net/qq_34025034/article/details/108113745
- 链接标题:Springboot静态变量注入_springboot component 注入statics变量-CSDN博客
- 所属网站:blog.csdn.net
- 被收藏次数:1451
- 网站标签:springboot component 注入statics变量