Spring boot 全局配置 properties或者yml文件报错

主要问题是没有扫描到配置文件

在pom文件里面<build>    </build>中加上以下代码就可以保证能扫描到了

  <resources>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.yml</include>
                    <include>**/*.properties</include>
                    <include>**/*.xml</include>
                </includes>
                <filtering>false</filtering>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/*.yml</include>
                    <include>**/*.properties</include>
                    <include>**/*.xml</include>
                </includes>
                <filtering>false</filtering>
            </resource>
        </resources>

  

posted @ 2019-03-12 13:26  Howardwang  阅读(273)  评论(0编辑  收藏  举报