spring cloud 配置中心native配置

1、pom文件添加依赖

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-config-server</artifactId>
</dependency>

2、配置文件application.properties中配置本地路径

#tomcat端口号
server.port=8001
#配置文件在本地
spring.profiles.active=native
#配置文件的目录
spring.cloud.config.server.native.search-locations=D:/workspace/GitHub/spring-config/config-file

3、主程序开启@EnableConfigServer注解

@EnableConfigServer
@SpringBootApplication
public class ConfigApplication {

public static void main(String[] args) {
    SpringApplication.run(ConfigApplication.class, args);
    }
}


猜你喜欢

转载自blog.csdn.net/zhang_zining/article/details/79081302
今日推荐