web服務啟動spring自動執行ApplicationListener 的用法


web服務啟動spring 后自啟動實現方法:

1> 寫一個類繼承spring的ApplicationListener監聽,並監控ContextRefreshedEvent事件(容易初始化完成事件)

2> 在applicationContext.xml文件中配置相應的bean實現自動裝載

     定義簡單的bean:<bean id="beanDefineConfigue" class="com.creatar.portal.webservice.BeanDefineConfigue"></bean> 

  在applicationContext.xml中注冊完成后,保持@Service注解

 


免責聲明!

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



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM