actuator/refresh path not updating @value variables when use spring cloud vault

Viewed 248

When I update a property in the vault and call actuator / refresh, it still shows an older value.

I use spring boot and spring cloud.

<spring-cloud-dependencies.version>2020.0.3</spring-cloud-dependencies.version> <spring-boot-dependencies.version>2.5.3</spring-boot-dependencies.version>

@SpringBootApplication
@EnableEurekaClient
@VaultPropertySource(value = "secret/services/${spring.application.name}/config", propertyNamePrefix = "", renewal = VaultPropertySource.Renewal.RENEW)
public class GatewayApplication {
    public static void main(String[] args) {
        SpringApplication.run(GatewayApplication.class, args);
    }
}
@RestController
public class ErrorControllerImpl implements ErrorController {

    @Value("${gateway.prefix}")
    private String prefixPath;

    @Override
    public Mono<String> errorPost(String serviceName) {
        return errorResponse(serviceName);
    }

    @Override
    public Mono<String> errorGet(String serviceName) {
        System.out.println(prefixPath);
        return errorResponse(serviceName);
    }

Yml

spring:
  application:
    name: ${APP_NAME}
  profiles:
    active: ${PROFILE:dev}
  cloud:
    config:
      enabled: ${CONFIG_SERVER_ENABLED:false}
    vault:
      uri: https://localhost:8200
      authentication: APPROLE
      app-role:
        role-id: ${VAULT_SERVICE_ROLE_ID}
        secret-id: ${VAULT_SERVICE_SECRET_ID}
      scheme: http
      fail-fast: true
      kv:
        enabled: false

Vault Image

The prefixPath in the controller does not change after refresh.

What would be the reason ?

Thanks for your help.

0 Answers
Related