Bean都初始化完成后,实现ApplicationListener<ContextRefreshedEvent>接口
2017-12-14 16:20
399 查看
web服务启动spring 后自启动实现方法:
1) 写一个类继承spring的ApplicationListener监听,并监控ContextRefreshedEvent事件(容易初始化完成事件)
2) 在applicationContext.xml文件中配置相应的bean实现自动装载
定义简单的bean:<bean id="beanDefineConfigue" class="com.creatar.portal.webservice.BeanDefineConfigue"></bean>
或者
2)在applicationContext.xml中注册完成后,保持@Service注解
1) 写一个类继承spring的ApplicationListener监听,并监控ContextRefreshedEvent事件(容易初始化完成事件)
2) 在applicationContext.xml文件中配置相应的bean实现自动装载
定义简单的bean:<bean id="beanDefineConfigue" class="com.creatar.portal.webservice.BeanDefineConfigue"></bean>
或者
2)在applicationContext.xml中注册完成后,保持@Service注解
相关文章推荐
- Spring InitializingBean和ApplicationListener<ContextRefreshedEvent>
- ApplicationListener<ContextRefreshedEvent>
- Spring 的 ApplicationEvent and ApplicationListener 、spring框架加载完成后执行上下文刷新事件(ContextRefreshedEvent)
- Android实战简易教程<五十四>(通过实现OnScrollListener接口实现下拉刷新功能)
- Spring IOC/BeanFactory/ApplicationContext的工作流程/实现原理/初始化/依赖注入源码详解
- Android实战简易教程<五十三>(通过实现OnScrollListener接口实现上拉加载更多功能)
- applicationContext.xml文件中<bean>标签中property属性用法说明
- applicationcontext.xml里面导入别的xml的方法<import resource="/bean.xml"/>(一)
- Spring之Bean实现了ApplicationContextAware等aware接口,对于setApplicationContext方法执行时间点的说明
- Spring中ApplicationContextAware接口用法-->解决AppicationContext.getBean('xxxx')时初始化多次数据库连接池问题
- 关于在myeclipse中用jsp访问实体bean的一个问题的解决(Exception sending context initialized event to listener instance of class)
- 【spring】源码分析 <一> 从ContextLoaderListener开始·
- spring:<context:property-placeholder location="classpath:application.properties" />
- 实现这两个接口ModelDriven<T>,Preparable有什么用?
- springmvc在业务控制方法中收集List<JavaBean>参数,实现批量处理
- spring 初始化时注入bean实现listener的方法
- <Android>关于 Android 中的OnScrollListener监听接口
- applicationContext.xml中<context:annotation-config> 和 <context:component-scan>的区别
- Spring 通过ApplicationListener&ApplicationEvent实现事件监听
- Spring bean通过实现InitializingBean ,DisposableBean接口实现初始化方法和销毁前操作