Environment variable mapped to spring boot configuration property but in my infra(Kubernetes Cluster), the environment variable not mapped to spring boot configuration
Answered
Environment variable mapped to spring boot configuration property in intellij ,but in my infra(Kubernetes Cluster), the environment variable not mapped to spring boot configuration property.Is the IDE doing some mapping.
Please sign in to leave a comment.
Hi, Could you please clarify the problem? Providing some screenshots or a demo project would be helpful.
I have an application in spring boot.
I have a class similar to the one shown below in my project.
@Configuration
@ConfigurationProperties(prefix = "client")
@Data
public class ClientConfiguration {
private Map<String, String> clientId;
}
When running in intellij, i am running it as spring boot application with with env variable specified as shown below and then spring is able to map that env variable to spring config(
)

But the same way when i create env variable in kubernetes cluster , its not able to map that environment variable to spring boot configuration.
Change in deployment.yaml shown below:
env:
- name: CLIENT_CLIENTID_ENG-USA
value: "abc123"
Then the environment variable is created inside the container but its not mapped to corresponding spring boot config variable.
I hope the above details would help you to understand the issue.
Hi, Are you referring to external configuration? https://docs.spring.io/spring-boot/docs/1.5.5.RELEASE/reference/html/boot-features-external-config.html#boot-features-external-config
No, it's not IDEA dependent, it's spring boot feature.