@PostConstruct
public void init(){
Map<String, Object> beans = applicationContext.getBeansWithAnnotation(StrategyMode.class);
if(!CollectionUtils.isEmpty(beans)){
for(Map.Entry<String, Object> entry : beans.entrySet()){
Object bean = entry.getValue();
StrategyMode mode = bean.getClass().getAnnotation(StrategyMode.class);
strategyMap.putIfAbsent(mode.value(), (Clazz) bean);
}
}
}
PostConstruct&StrategyMode&Annotation
最新推荐文章于 2024-11-03 11:01:20 发布