2

Spring cloud vault picks up the latest secret value during application start. If the secret is updated when the application is already up and running, then it is not picked up.

I understand this is a Spring config limitation and there is a workaround with the @RefreshScope annotation and explicitly invoking the /actuator/refresh API.

Is there any other mechanism where the application can listen to secret update notifications and automate the refresh?

From the debug logs, I see that the spring cloud vault returns an updated secret with the GET call based on "min-renewal" time.

Saikat
  • 14,222
  • 20
  • 104
  • 125
Tilak
  • 323
  • 1
  • 5
  • 18

1 Answers1

1

Got 'refresh' working with:

@Autowired
ContextRefresher contextRefresher;
public void refreshContext() {
    contextRefresher.refresh();
}

I am still trying to understand why spring cloud vault invokes vault login and Get API every 10 seconds if the refresh is not automated.

Saikat
  • 14,222
  • 20
  • 104
  • 125
Tilak
  • 323
  • 1
  • 5
  • 18