Skip to content

Add prefix support for environment variables #3450

Closed
@philwebb

Description

@philwebb

Currently environment variables get bound to @Configuration properties directly (for example SERVER_PORT to Server.port). This can cause problems when trying to set ignoreInvalidFields or if you want to run two different boot apps as the same user.

@gregturn suggested that we consider supporting a prefix when binding. For example:

springApplication.setEnvironmentPrefix("MYAPP_");
...

Which would then bind MYAPP_SERVER_PORT rather than SERVER_PORT.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions