I am running a Java application with springboot and using vault to store dependencies. I’m getting errors like:
Vault location [my_vault_location] not resolvable:not found
and
c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at : http://localhost:8888
Could not locate PropertySource: I/O error on GET request for “http://localhost:8888/application/default”: Connection refused: connect;
In the later life of my application, I get:
Cannot renew token; nested excep
tion is org.springframework.web.client.ResourceAccessException: I/O error on POST request for “https://actual_vault_location.com”: No such host is known (actual_vault_location.com); nested exception is java.
net.UnknownHostException: No such host is known (actual_vault_location.com)
This is weird to me, because I can confirm that the application is loading from vault successfully. I have run it with the correct settings – it comes up fine. I go into the vault local profile and change the database connection string to something else, the whole app crashes with “invalid db url” types of errors. I set it back in vault, the app runs again. What do I need to do to get rid of these errors?
Here is my bootstrap.properties (with certain items replaced due to company security policy):
# Spring cloud app operates by creating a bootstrap context, which is parent context for the main application.
# it is responsible for loading configuration properties from external sources.
# The bootstrap process can be controlled using spring.cloud.bootstrap.enabled which can be true(enable) or false(disable)
spring.cloud.bootstrap.enabled=true
spring.cloud.vault.enabled=true
# get the app properties
spring.cloud.vault.uri=https://myvault_url.com
spring.cloud.vault.host=myvault_url.com
spring.cloud.vault.port=my_port_number
spring.cloud.vault.scheme=https
spring.cloud.vault.namespace=mynamespace
spring.cloud.vault.fail-fast=true
# Vault Credentials
spring.cloud.vault.authentication=vault_role
spring.cloud.vault.app-role.role-id=vault_role_id
spring.cloud.vault.app-role.secret-id=my_secret_id
# Vault Application Settings
# Enable the key value backend
spring.cloud.vault.kv.enabled=true
# default backend
spring.cloud.vault.kv.backend=backend_name
spring.cloud.vault.kv.application-name=applications/my_application
# it can be a list where we specify active profiles of vault.
spring.cloud.vault.kv.profiles=local