Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

797
Vistas
microservice doesn't fetch properties from spring-cloud-config-server microservice

I want to build a simple microservices app with spring cloud config server. I am using Github repository to store my configuration files. Currently, I have two very simple microservices. One of them is a cloud-config-server which retrieve properties from the remote repo on Github. In the main class of this microservice, I added @EnableConfigServer annotation and I provided a couple of properties in the application.properties file:

spring.application.name=cloud-config-server
server.port=8888

spring.cloud.config.server.git.uri=*Remote repo URI*
spring.cloud.config.server.git.username=*Username*
spring.cloud.config.server.git.password=*Password*
spring.cloud.config.server.git.clone-on-start=true

If I go to http://localhost:8888/cloud-config-server/default everything works well, my spring cloud config server retrieves properties successfully.

In my second microservice, I added bootstrap.properties with 2 properties to connect to the cloud-config-server:

spring.cloud.config.uri=http://localhost:8888
spring.cloud.config.name=cloud-config-server

And I also added this dependency

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

Unfortunately, my microservice doesn't retrieve properties from cloud-config-server. When I try to use property via @Value annotation I get an error:

Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'test.text' in value "${test.text}

I am sure, I didn't make a typo in my property name "test.text".

over 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

I've already solved my problem. Bootstrap.properties file is no longer enabled by default. You can enable it by adding new dependency:

       <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-bootstrap</artifactId>
        </dependency>

or alternatively, you can remove bootstrap.properties file and provide these properties in your application.properties file

spring.config.import=configserver:*URI to your cloud config server*
spring.cloud.config.name=*Your cloud config server name*
over 4 years ago · Santiago Trujillo Denunciar

0

In Client application.properties you must use not the server name, but client application name

spring.cloud.config.uri=http://localhost:8888
spring.cloud.config.name=applicationname
over 4 years ago · Santiago Trujillo Denunciar

0

<spring-cloud.version>2020.0.3-SNAPSHOT</spring-cloud.version>

for spring cloud and

<version>2.5.0-SNAPSHOT</version> 

for spring boot.

Also in application.properties file :

spring.config.cloud.uri=htp://localhost:8888
spring.config.import=optional:configserver:htp://localhost:8888

These should solve your problem as it did to mine.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda