@PostConstruct | List,Map,Set
@PostConstruct
1.Java自己的注解
2.修饰非静态的void方法
@PostConstruct
public void init() { }
3.@Constructor(构造方法)->@Autowired(依赖注入)->@PostConstruct(注解的方法) -> init -> service
4.ApplicationRunner 会在 @postConstruct 之后启动。
5.使用场景:
spring项目启动后要立即进行一些资源的初始化。
Lis
原创
2021-01-20 14:30:20 ·
167 阅读 ·
1 评论