spring - spring@autowired,@PostContruct …执行顺序
执行顺序:Constructor >> @Autowired >> @PostConstruct
with different initialization methods, are called as follows
-
Methods annotated with @PostConstruct
-
afterPropertiesSet() as defined by the InitializingBean callback interface
-
A custom configured init() method
Destroy methods are called in the same order:
-
Methods annotated with @PreDestroy
-
destroy() as defined by the DisposableBean callback interface
-
A custom configured destroy() method