首页 > 其他分享 >使用@PostConstruct 注解解决@Autowire注入对象为空

使用@PostConstruct 注解解决@Autowire注入对象为空

时间:2023-02-17 16:44:49浏览次数:36  
标签:Autowire Autowired 对象 PostConstruct 为空 注解

在spring中,对象声明周期为构造器->@Autowired->@PostConstruct
有初始化用到@Autowired对象的需求,可以在初始化方法加上@PostConstruct注解

 

 

 

 

标签:Autowire,Autowired,对象,PostConstruct,为空,注解
From: https://www.cnblogs.com/zhangliwei/p/17130701.html

相关文章