1, 版本
springboot 2.7.18
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.18</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
2,问题
Could not resolve placeholder ‘name’ in value “${name}”
3,解决方法
原因
SpringCloud 2.4版本之后不再优先读取bootstrap文件,导致bootstrap不起作用
如果需要bootstrap配置,在 SpringBoot 版本大于 2.4.0 版本,添加以下依赖
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bootstrap</artifactId>
<version>3.1.1</version>
</dependency>