解决maven工程中使用spring-boot后导致的profile多环境配置失效的问题

spring-boot引用方式官方推荐是使用:

<parent>
        <groupId>org.springframework.bootgroupId>
        <artifactId>spring-boot-starter-parentartifactId>
        <version>1.3.6.RELEASEversion>
    parent>

然后去看了一下对应的pom.xml文件,发现spring-boot为了保护application.yml和application.properties,修改了默认的占位符${...}为@...@,然后发现resources插件有一个配置项:

<useDefaultDelimiters>trueuseDefaultDelimiters>

会使用默认的占位符,增加此配置项后就没问题了。

resource插件完整的配置(Build->plugins下):

<plugin>
                    <artifactId>maven-resources-pluginartifactId>
                    <configuration>
                        <encoding>utf-8encoding>
                        <useDefaultDelimiters>trueuseDefaultDelimiters>
                    configuration>
                plugin>

 

你可能感兴趣的:(java)