Spring实现数据库的初始化
来源:互联网 发布:led编辑软件下载 编辑:程序博客网 时间:2024/05/19 14:15
本来转载于http://kingliu.iteye.com/blog/992325
1.实现SmartLifecycle接口
public class InitRedisCache implements SmartLifecycle{ @Override public void start() { // TODO Auto-generated method stub } @Override public void stop() { // TODO Auto-generated method stub } @Override public boolean isRunning() { // TODO Auto-generated method stub return false; } @Override public int getPhase() { // TODO Auto-generated method stub return 0; } @Override public boolean isAutoStartup() { // TODO Auto-generated method stub return true; } @Override public void stop(Runnable callback) { // TODO Auto-generated method stub }}
2.实现ApplicationListener接口,定义个event,判断event是否相等。
@Lazy(false) @Repository public class InitRedisCache implements ApplicationListener{ @Autowired @Qualifier("dictionaryService") private DictionaryService dictionaryService; @Autowired @Qualifier("redisService") private RedisService redisService; @Override public void onApplicationEvent(ApplicationEvent event) { if(event instanceof InitEvent){ initDictionaryData(); } } public void initDictionaryData(){ } }
- Spring实现数据库的初始化
- Spring初始化数据库
- Java代码实现Spring bean的初始化
- spring初始化Bean的方法---实现 InitializingBean接口
- Spring的初始化
- Spring的初始化
- Spring初始化的整个过程
- 关于spring 的初始化
- spring容器的初始化
- Spring的初始化
- Jetspeed2 将文件数据初始化到数据库的实现方法
- T-SQL语句实现数据库的创建于初始化
- openLDAP的数据库初始化
- Spring 实现对数据库的读写分离
- 1.Spring实现数据库的读写分离
- 基于Spring的实现数据库读写分离
- Spring实现数据库的读写分离
- spring jdbctemplate 实现数据库的查询操作
- Google会成为苹果的下一个目标吗?
- Oracle表与索引的分析及索引重建
- iphone UIKit类得中文讲解2
- 如何在WPF中调用C#控件库(HexEdit)
- 变更归档路径遇到的ORA-32017and ORA-16179
- Spring实现数据库的初始化
- spinlock,mutex,semaphore,critical section的作用与区别
- Linux下的IO端口和IO内存
- ASP.Net MVC3 使用Unity实现依赖注入介绍
- 冒泡排序
- 学习总结(2012-8-27)
- Android平台通过ActivityGroup实现类似IOS的UINavigationController
- iphone UIKit类得中文讲解3
- Windows管道系统 - 命名管道