Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'webname' in value "${w

报错信息:Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'webname' in value "${webname}"

正常的配置,使用config client去访问server,启动client的时候,却出现无法解析变量。

springboot启动的时候,会去application.yml文件

网上看了很多解决方法都不行。比如

Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'webname' in value "${w

这个是在启动的时候,重新对PropertySourcesPlaceholderConfiturer进行注入,设置忽略无法解析文件位置。 

又找到一个解决方法,试了下,把application.yml重命名为bootstrap.yml就可以了。

springboot启动的时候才从配置文件中读取配置属性,配置文件在远程配置中心的话,注册中心的信息需要放在bootstrap.properties才能启动优先读取,放在application.properties会报错

Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'webname' in value "${w