1.配置文件样例:
abc.xxx.kk=zzz,yyyy
abc.zzz.aa=rrr
abc.zzz.bb=rrr
abc.zzz.cc=rrr
abc.yyy.aa=rr
abc.yyy.bb=rr
abc.yyy.cc=rr
2.java 代码:
@Configuration
public xxconfig{
@value("#{'${abc.xxx.kk}'.split(',').}")
public List<String> list;
@Bean
public Map<String,model> xxxdefMap(){
Map<String,Model> map=new ArrayList<>();
list.parallelStream().forEatch(){ xxx->(
Model model = new Model();
model.set(xxx);
map.put(model);
)
};
return map;
}
}
3.调用
@Autiwon
private Map<String,Model> xxxdefMap;