一、介紹
InitializingBean是Spring框架提供的一個接口,用于在Bean初始化完成后
執行特定的初始化邏輯。
二、使用
1、使用方法
1.1、實現InitializingBean接口
可以讓Bean實現該接口,并重寫其afterPropertiesSet()方法
1.2、注冊
也即讓bean初始化。方法有:
(1)@Component 及其拓展注解如@Controller、@Service、@Repository、@Configuration;
(2)@Bean注解