如何进行Spring Cloud Config的本地配置文件管理?

2026-05-16 03:520阅读0评论SEO教程
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计1742个文字,预计阅读时间需要7分钟。

如何进行Spring Cloud Config的本地配置文件管理?

很多项目不在Spring Cloud环境下使用,但需要使用分布式配置中心来管理一些外部或项目的配置。此时,我们可以使用Spring Cloud Config的本地配置。配置配置服务器端。

一般很多项目不是在springcloud的环境中使用的,但是需要用到分布式配置中心来管理一些外部或者项目的配置,这个时候我们可以使用springcloud-config的本地配置。

配置config-server服务端

使用start.spring.io创建一个springcloud工程,pom中引入:

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

启动类加上@EnableConfigServer注解:

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

在resources文件夹下创建properties文件夹,在properties文件夹下创建config-dev.properties文件存放配置信息。

阅读全文

本文共计1742个文字,预计阅读时间需要7分钟。

如何进行Spring Cloud Config的本地配置文件管理?

很多项目不在Spring Cloud环境下使用,但需要使用分布式配置中心来管理一些外部或项目的配置。此时,我们可以使用Spring Cloud Config的本地配置。配置配置服务器端。

一般很多项目不是在springcloud的环境中使用的,但是需要用到分布式配置中心来管理一些外部或者项目的配置,这个时候我们可以使用springcloud-config的本地配置。

配置config-server服务端

使用start.spring.io创建一个springcloud工程,pom中引入:

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

启动类加上@EnableConfigServer注解:

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

在resources文件夹下创建properties文件夹,在properties文件夹下创建config-dev.properties文件存放配置信息。

阅读全文