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