1、采用springcloud 获取github上config配置文件属性需要注意的问题;
2、此时github下面的配置文件,命名要特别注意,否则会获取不到配置里面的属性而报错,报错是因为配置文件命名不正确导致的。
报错如下:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘scopedTarget.configClientApplication‘: Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder ‘nn‘ in value "${nn}" Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder ‘nn‘ in value "${nn}"
3、正确的命名如下:
4、客户端访问的工程名称为config-client,那么github上对应的配置文件名称应该为config-client-dev.properties,映射规则为
http请求地址和资源文件映射如下:
/{application}/{profile}[/{label}]
/{application}-{profile}.yml
/{label}/{application}-{profile}.yml
/{application}-{profile}.properties
/{label}/{application}-{profile}.properties
原文地址:https://www.cnblogs.com/Andrew520/p/10398567.html
时间: 2024-10-29 15:26:30