Sping Boot Annotation Development Record Xiaobai Notes

1 DependsOn injection depends on the completion of another instance initialization;

@DependsOn(value = {"B","C"})
private Server A;
但是B,C中不能注入A;如果有需要加上@Lazy 延迟加载,使用时再注入

2 @PostConstruct

Executed when the project starts; the injection order Constructor >> @Autowired >> @PostConstruct>afterPropertiesSet If there are dependencies, use DependsOn

 

 

Guess you like

Origin blog.csdn.net/h4241778/article/details/108834087