What is the difference between putting a property on application.yml or bootstrap.yml in spring boot? In logging.config case, the application works different.
Another use for bootstrap.yml is to load configuration from kubernetes configmap and secret resources. The application must import the spring-cloud-starter-kubernetes dependency.
As with the Spring Cloud Config, this has to take place during the bootstrap phrase.
From the docs :
spring:
application:
name: cloud-k8s-app
cloud:
kubernetes:
config:
name: default-name
namespace: default-namespace
sources:
# Spring Cloud Kubernetes looks up a ConfigMap named c1 in namespace default-namespace
- name: c1
So properties stored in the configmap resource with meta.name default-name can be referenced just the same as properties in application.yml
And the same process applies to secrets :
spring:
application:
name: cloud-k8s-app
cloud:
kubernetes:
secrets:
name: default-name
namespace: default-namespace
sources:
# Spring Cloud Kubernetes looks up a Secret named s1 in namespace default-namespace
- name: s1