首页 文章

spring cloud config client在属性文件中设置配置URL

提问于
浏览
0

我有一个 Spring 天 Cloud 项目 . 有配置服务器(config-srv),eureka服务器(eureka-srv)和其他一些带有业务逻辑的服务,我们称之为主服务(main-srv) .

我把它们装在 jar 里,一个接一个地运行 . 我的应用程序通过jars在同一目录中的文件中获取其属性 .

所以,我通过“application-native.properties”将属性设置为config-srv .

但是,如果我想更改config-srv url(例如,我想要http://localhost:9999),我怎么能在所有微服务启动之前共享此URL?我试图在"application-default.properties"分享这个网址,但它没有任何效果 .

1 回答

  • 1

    您可以将Spring Cloud Config服务器详细信息放在每个微服务的bootstrap.properties文件中 .

    spring.application.name=microserviceName
    spring.profiles.active=dev
    spring.cloud.config.uri=http://localhost:9999
    spring.cloud.config.username=your_username
    spring.cloud.config.password=your_password
    

    浏览链接以获取有关spring cloud config的更多详细信息https://howtodoinjava.com/spring-cloud/spring-cloud-config-server-git/

相关问题