@Test public void scheduledVaultTokenRefresh() { this.configClientProperties.setUri(new String[] { "https: given(rest.postForObject(anyString(), any(HttpEntity.class), any())).willReturn("foo"); ReflectionTestUtils.setField(config, "rest", this.rest); await().atMost(Duration.FIVE_SECONDS).untilAsserted(() -> { verify(config, atLeast(4)).refreshVaultToken(); verify(rest, atLeast(4)).postForObject(anyString(), any(HttpEntity.class), any()); }); }
@Scheduled(fixedRateString="${vault.token.renew.rate:60000}") public void refreshVaultToken() { try { logger.info("Renewing Vault token " + obscuredToken + " for " + renewTTL + " milliseconds."); rest.postForObject(refreshUri, request, String.class); } catch (Exception e) { logger.error("Unable to renew Vault token " + obscuredToken + ". Is the token invalid or expired?"); } }
VaultTokenRenewalAutoConfiguration { @Scheduled(fixedRateString="${vault.token.renew.rate:60000}") public void refreshVaultToken() { try { logger.info("Renewing Vault token " + obscuredToken + " for " + renewTTL + " milliseconds."); rest.postForObject(refreshUri, request, String.class); } catch (Exception e) { logger.error("Unable to renew Vault token " + obscuredToken + ". Is the token invalid or expired?"); } } }
VaultTokenRenewalAutoConfiguration { @Scheduled(fixedRateString="${vault.token.renew.rate:60000}") public void refreshVaultToken() { try { logger.info("Renewing Vault token " + obscuredToken + " for " + renewTTL + " milliseconds."); rest.postForObject(refreshUri, request, String.class); } catch (Exception e) { logger.error("Unable to renew Vault token " + obscuredToken + ". Is the token invalid or expired?"); } } @Autowired  VaultTokenRenewalAutoConfiguration(
			ConfigClientOAuth2ResourceDetails configClientOAuth2ResourceDetails,
			ConfigClientProperties configClientProps,
			@Value("${spring.cloud.config.token}") String vaultToken,
			@Value("${vault.token.ttl:300000}") long renewTTL); }
VaultTokenRenewalAutoConfiguration { @Scheduled(fixedRateString="${vault.token.renew.rate:60000}") public void refreshVaultToken() { try { logger.info("Renewing Vault token " + obscuredToken + " for " + renewTTL + " milliseconds."); rest.postForObject(refreshUri, request, String.class); } catch (Exception e) { logger.error("Unable to renew Vault token " + obscuredToken + ". Is the token invalid or expired?"); } } @Autowired  VaultTokenRenewalAutoConfiguration(
			ConfigClientOAuth2ResourceDetails configClientOAuth2ResourceDetails,
			ConfigClientProperties configClientProps,
			@Value("${spring.cloud.config.token}") String vaultToken,
			@Value("${vault.token.ttl:300000}") long renewTTL); @Scheduled(fixedRateString="${vault.token.renew.rate:60000}") // <-- Default to renew token every 60 seconds void refreshVaultToken(); }
VaultTokenRenewalAutoConfiguration { @Scheduled(fixedRateString="${vault.token.renew.rate:60000}") public void refreshVaultToken() { try { logger.info("Renewing Vault token " + obscuredToken + " for " + renewTTL + " milliseconds."); rest.postForObject(refreshUri, request, String.class); } catch (Exception e) { logger.error("Unable to renew Vault token " + obscuredToken + ". Is the token invalid or expired?"); } } @Autowired  VaultTokenRenewalAutoConfiguration(
			ConfigClientOAuth2ResourceDetails configClientOAuth2ResourceDetails,
			ConfigClientProperties configClientProps,
			@Value("${spring.cloud.config.token}") String vaultToken,
			@Value("${vault.token.ttl:300000}") long renewTTL); @Scheduled(fixedRateString="${vault.token.renew.rate:60000}") // <-- Default to renew token every 60 seconds void refreshVaultToken();  }