读书人

spring初始化数据库、对象的模式

发布时间: 2012-09-07 10:38:15 作者: rapoo

spring初始化数据库、对象的方式
1.实现SmartLifecycle接口

@Lazy(false)@Repositorypublic class InitRedisCache implements ApplicationListener{@Autowired@Qualifier("dictionaryService")private DictionaryService dictionaryService;@Autowired@Qualifier("redisService")private RedisService redisService;@Overridepublic void onApplicationEvent(ApplicationEvent event) {if(event instanceof InitEvent){initDictionaryData();}}public  void initDictionaryData(){}}

读书人网 >其他数据库

热点推荐