springboot yml配置文件使用@project.xxxx@启动报错Do not use @ for indentation问题
作者:jyyy1990
这篇文章主要介绍了springboot yml配置文件使用@project.xxxx@启动报错Do not use @ for indentation问题,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教
yml配置文件使用@project.xxxx@启动报错Do not use @ for indentation

解决方法
在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: @project.groupId@ info.artifactId: @project.artifactId@ info.version: @project.version@
总结
以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。
