欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

改变springboot属性文件分隔符

程序员文章站 2022-06-01 14:01:40
...

If you inherit from the spring-boot-starter-parent POM, the default filter token of the maven-resources-plugins has been changed from ${*} to @ (that is, @aaa@qq.com instead of ${maven.token}) to prevent conflicts with Spring-style placeholders. If you have enabled Maven filtering for the application.properties directly, you may want to also change the default filter token to use other delimiters.

如果引入spring-boot-starter-parent,默认需要使用  @****@

改变springboot属性文件分隔符

改变springboot属性文件分隔符

如果不引入spring-boot-starter-parent,You also need to include the following element inside <plugins/>:

<plugin>     
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-resources-plugin</artifactId>
    <version>2.7</version>     
    <configuration>         
     <delimiters>             
       <delimiter>@</delimiter>
     </delimiters>         
     <useDefaultDelimiters>false</useDefaultDelimiters>
    </configuration>
 </plugin>

The useDefaultDelimiters property is important if you use standard Spring placeholders (such as ${placeholder}) in your configuration. If that property is not set to false, these may be expanded by the build

server.port=${port:8080}

解决方案:

    1:将application.properties中的占位符由${key} -> @aaa@qq.com 

    2:覆盖springboot的默认规则

改变springboot属性文件分隔符

    

    3:测试了再自己的pom中不增加resource配置,只是增加

改变springboot属性文件分隔符


作者:0爱上1
链接:https://www.jianshu.com/p/929b9aa70dc8
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

 

相关标签: SpringBoot