1

I have a microservice that runs using the liberty server. I have set of configuration properties that are not being used directly using @Value or @ConfigurationProperties or @Configuration.

Properties Structure:

I have application.yml as

DBUserName: ${username}
DBPassword: ${password}

and bootstrap.properties as

username: XXXX
password: XXXX

now I have implemented a config server and it is reading property file from the git repo. Config file structure:

appname-dev.yml

Username: abcd
password: abcd

In the client, I have configured bootstrap.yml as

spring:
  profiles:
    active: dev
  application:
    name: appname
  cloud:
    bootstrap:
      enabled: true
    config:
      uri: http://localhost:8888

Whenever I update the properties in the git repo, the config server gets the updated properties but client-side those properties are not getting updated after hitting actuator/refresh endpoint.

When I hit actuator/env at the client-side, it displays the updated properties from the config server but bootstrap.properties will have the same old properties which application uses.

So, what am I missing here? will the config server not work for this scenario?

1 Answers1

0

I do not think this will work. The word application has to be first then the profile. So application-bootstrap.yml, if that is the name you really want. Dont forget to set the profile bootstrap.

Mike3355
  • 11,305
  • 24
  • 96
  • 184
  • application.yml properties are getting replaced by bootstrap.properties file when application gets loaded the first time. I am using the IBM liberty server here. Now at run time, I want to update username and password values which I have kept in the git repo. Git repo file name is appname-dev.yml where dev is the profile name and the appname is the application name. – Reetesh Kumar May 24 '20 at 11:52
  • @reeteshkumar are you sure. Double check by adding a string to `bootstrap.properties` and log the log.info(testString); in the application with @Value("${testString}). If it doesn't work try renaming to what I suggested. – Mike3355 May 24 '20 at 11:58
  • I am not using these properties directly with @Value. That is why I have mentioned this in the question. So these are custom properties not directly being used in service, controller, or configuration class. My explanation seems confusing but this the use case. – Reetesh Kumar May 24 '20 at 12:11