SpringBoot支持bootstrap.yml/bootstrap.properties配置文件,需要导入spring-cloud-starter-bootstrap依赖

说明:

在SpringBoot 2.4.x版本之后,对于bootstrap.properties/bootstrap.yaml配置文件的支持,需要导入如下依赖:

    
    
        org.springframework.cloud
        spring-cloud-starter-bootstrap
        3.1.3
    

注意:

1、导入依赖后,还需要开启 spring.cloud.bootstrap.enabled=true

2、spring cloud starter alibaba nacos config,引用这个配置中心的依赖后,需要使用bootstrap.yml或bootstrap.properties 作为中转配置文件

3、不同类型配置文件读取优先级:bootstrap.yml/bootstrap.properties > application.yml/application.properties

你可能感兴趣的:(SpringBoot,spring,boot)