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, @maven.token@ 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,默认需要使用 @****@
如果不引入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} -> @key@
2:覆盖springboot的默认规则
3:测试了再自己的pom中不增加resource配置,只是增加
作者:0爱上1 链接:https://www.jianshu.com/p/929b9aa70dc8 来源:简书 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。