Skip to content
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

Add some guidance to the reference documentation about diagnosing unexpected property values #18583

Closed
mdeinum opened this issue Oct 15, 2019 · 3 comments
Labels
status: superseded An issue that has been superseded by another type: documentation A documentation update

Comments

@mdeinum
Copy link
Contributor

mdeinum commented Oct 15, 2019

Lately I have been answering question on stackoverflow for people using "reserved" property names. Like env, environment, classpath and the likes. I think it would be beneficial to add a note/section to the reference guide mentioning those properties. This both as to add clarity and as a reference for answering questions.

See: https://stackoverflow.com/questions/58387443/spring-boot-reading-different-value-for-one-key-from-application-properties

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Oct 15, 2019
@snicoll snicoll changed the title Document "reserved" property names. Document "reserved" property names Oct 15, 2019
@wilkinsona
Copy link
Member

wilkinsona commented Oct 18, 2019

Thanks for the suggestion.

Lately I have been answering question on stackoverflow for people using "reserved" property names. Like env, environment, classpath and the likes.

I'm not sure that any of those are reserved. As far as I can tell, none of them is set by default as either a system property or an environment variable. We already document the property source ordering which should help people to diagnose why a property set in one source is being overridden.

The env and configprops endpoints can also be useful in determining why a property has a particular value. I think the best option here is probably to add a note to the docs about using those two endpoints to diagnose unexpected property values.

@wilkinsona wilkinsona added type: documentation A documentation update and removed status: waiting-for-triage An issue we've not yet triaged labels Oct 18, 2019
@wilkinsona wilkinsona added this to the 2.1.x milestone Oct 18, 2019
@wilkinsona wilkinsona changed the title Document "reserved" property names Add some guidance to the reference documentation about diagnosing unexpected property values Oct 18, 2019
@mdeinum
Copy link
Contributor Author

mdeinum commented Oct 18, 2019

If I remember correctly the environment issue arose due to use an SpEL expression, #{environment} instead of a value expression, ${environment}. The SpEL expression resolves to the Environment instance configured, the value expression would indeed fail. So the first was due to a faulty use of SpEL to obtain a pre-configured property.

The classpath isn't indeed default set but when set through env or system properties it might be confusing.

Adding additional information on how to resolve/investigate this will certainly help. Another addition could be a best practice for naming properties, like to put them in a application/component namespace, so that they don't get mixed up with other properties.

@wilkinsona
Copy link
Member

Closing in favour of #24336.

@wilkinsona wilkinsona removed this from the 2.3.x milestone Jan 15, 2021
@wilkinsona wilkinsona added the status: superseded An issue that has been superseded by another label Jan 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: superseded An issue that has been superseded by another type: documentation A documentation update
Projects
None yet
4 participants