@ConfigurationProperties 注解 获取yml配置项 放入Map
时间:2021-05-12 20:12:15
收藏:0
阅读:249
yml文件配置:
weixin:
platformkey:
shanxi: s6bba6sdfggre54b87de3b8sdfa5beca
hunan: 1sdfggr44wweffds87de3b81a3a5beca
class代码不能通过@Value注解获取,需要使用 @ConfigurationProperties注解获取:
@Component
@Data
@EqualsAndHashCode(callSuper = false)
@ConfigurationProperties(prefix = "weixin")
public class WXConfig implements {
private Map<String, String> platformkey;
}
原文:https://www.cnblogs.com/donghuimao/p/14761284.html
评论(0)