SpringBoot bootstrap 配置文件没有生效

今天单独使用SpringBoot,发现其中的bootstrap.properties文件无法生效,改成yaml格式也无济于事。

 

最后调查发现原来是因为SpringBoot本身并不支持,需要和Spring Cloud 的组件结合——只有加上Spring Cloud Context依赖才能生效。

 

即在pom中引入:

        <!--需要引入该jar才能使bootstrap配置文件生效-->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-context</artifactId>
        </dependency>

 

问题解决。

posted @ 2018-03-15 09:04  剑握在手  阅读(13544)  评论(0编辑  收藏  举报
返回顶部↑