配置文件中配置集合类(Map、list)@Value注入map、List
spel表达式就是spring表达式。
在java代码中,还有这种写法:
@Value("#{'${auth.filter.exclude-urls}'.split(',')}")
private List<String> authFilterExcludeUrls;
//==================
@Value("#{'${list}'.split(',')}") private List<String> list; @Value("#{${maps}}") private Map<String,String> maps; @Value("#{${redirectUrl}}") private Map<String,String> redirectUrl;
配置文件
list: topic1,topic2,topic3 maps: "{key1: 'value1', key2: 'value2'}" redirectUrl: "{sso_client_id: '${id}',sso_client_secret: '${secret}',redirect_url: '${client.main.url.default}'}"