优先级:Constructor(构造器) > @PostConstruct > InitializingBean > init-method
通常,@PostConstruct和@PreDestroy注解被认为是在Spring应用程序中接收生命周期回调的最佳实践,这是java的注解。
使用这些注解意味着您的bean没有耦合到特定于Spring的接口。
优先级:Constructor(构造器) > @PostConstruct > InitializingBean > init-method
通常,@PostConstruct和@PreDestroy注解被认为是在Spring应用程序中接收生命周期回调的最佳实践,这是java的注解。
使用这些注解意味着您的bean没有耦合到特定于Spring的接口。