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(){}}