1、類中某方法加注解@PostConstruct
2、實現InitializingBean接口,實現afterPropertiesSet方法
3、xml方式,bean標簽里配置init-mothod屬性,指向類中的方法。


他們的執行順序是
1-@PostConstruct
2-實現InitializingBean中的afterPropertiesSet
3-xml方式




他們的執行順序是
1-@PostConstruct
2-實現InitializingBean中的afterPropertiesSet
3-xml方式


本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。