解决方法是:
在pom.xml的plugings内添加
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<delimiters>@</delimiters>
<useDefaultDelimiters>false</useDefaultDelimiters>
</configuration>
</plugin>
然后在pom.xml的build内添加
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
这样就可以在springboot的yml配置文件里引用maven暴露出去的数值了
.yml文件:
info.groupId: @[email protected] info.artifactId: @[email protected] info.version: @[email protected]