- Notifications
You must be signed in to change notification settings - Fork 41.7k
Closed
Labels
status: duplicateA duplicate of another issueA duplicate of another issue
Description
Suppose I have a property like this:
@Value("${something.with-dash}") private String mySomething;It's hard to make Spring map hyphens like with-dash from an environment variable. Let's say I've built my spring onejar then I can't just provide an environment variable like this (bash):
$ SOMETHING_WITH-DASH=Something java -jar my-spring-onejar.jarYou need to use a work-around like this:
$ env 'SOMETHING_WITH-DASH=Something' java -jar my-spring-onejar.jarBut in certain frameworks such as Kubernetes you cannot use a hyphen in environment variables since they use the C_IDENTIFIER format as the lowest common denominator. I've aded an issue for this in Kubernetes but I'm not sure if they're willing to change it.
So I wonder if instead Spring could enhance its way that hyphens are treated in environment variables when matching the @Value annotation? For example if SOMETHING_WITH_DASH could map to something.with-dash?
visaals
Metadata
Metadata
Assignees
Labels
status: duplicateA duplicate of another issueA duplicate of another issue