Skip to content

EnvironmentMvcEndpoint throws exception for unresolvable properties #8510

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
brenuart opened this issue Mar 6, 2017 · 3 comments
Closed
Assignees
Labels
type: bug A general bug
Milestone

Comments

@brenuart
Copy link
Contributor

brenuart commented Mar 6, 2017

The EnvironmentMvcEndpoint throws an exception for unresolvable properties instead of printing their unresolved value.

Suppose the following application.properties:

my.foo = ${my.bar}

A call to the endpoint /env shows the applicationConfig entry with the properties unresolved:

"applicationConfig: [classpath:/application.properties]": {
   "my.foo": "${my.bar}"
}

However, a call to /env/my.* throws an exception complaining about ${my.bar} being unresolvable.
This behaviour is annoying when the environment contains some properties that are not used in a given setup (think about feature.enabled=false with an incomplete configuration set for the feature feature).

Note: tested with SpringBoot 1.3.8.RELEASE and 1.4.4.RELEASE

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 6, 2017
@wilkinsona
Copy link
Member

See also #8282

@wilkinsona wilkinsona added priority: normal type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Mar 6, 2017
@wilkinsona wilkinsona added this to the 1.4.6 milestone Mar 6, 2017
@philwebb
Copy link
Member

philwebb commented Mar 6, 2017

Not sure if it's useful, but RelaxedPropertyResolver.ignoringUnresolvableNestedPlaceholders might help when it comes to fixing this.

@brenuart
Copy link
Contributor Author

brenuart commented Mar 6, 2017

Yes it will - but it will then be applicable to the entire Environment - which may not be desired.
I tried to modify the EnvironmentMvcEndpoint to make use of such property resolver instead of delegating to the Environment for property resolution. But I'm not sure it is the way to go...

mbhave added a commit to mbhave/spring-boot that referenced this issue Mar 7, 2017
The NamePatternEnvironmentFilter used to throw an exception if
placeholders in property values could not be resolved.

Fixes spring-projectsgh-8510
@mbhave mbhave self-assigned this Mar 7, 2017
@mbhave mbhave closed this as completed in 67068fc Mar 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

5 participants