@ConfigurationProperties 注解 获取yml配置项 放入Map


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;
}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM