Log unknown properties when using @ConfigurationProperties
See original GitHub issueEnhancement
With YAML properties it’s too easy to corrupt properties, by just adding whitespace. eg:
# incorrect
spring:
cloud:
stream:
input:
consumer:
maxAttempts: 5
group: api
# correct
spring:
cloud:
stream:
input:
consumer:
maxAttempts: 5
group: api
If would be great if regardless the ignoreUnknownFields
property, Spring Boot could load a WARN
that unmatched property was found. I think that will preserve many stupid mistakes people are making. I can possibly do a PR if you agree it should be implemented.
Issue Analytics
- State:
- Created 6 years ago
- Comments:16 (16 by maintainers)
Top Results From Across the Web
configurationproperties is an unknown property - Stack Overflow
In my application properties file, all of the variables "is an unknown property" with yellow underline. I run the application but the same...
Read more >Configuring a Spring Boot Module with ... - Reflectoring
An in-depth look at Spring Boot's support to bind external configuration parameters to fields of a Spring bean.
Read more >IntelliJ – Cannot Resolve Spring Boot Configuration ...
During a build, the annotation processor searches for all classes that are annotated with @ConfigurationProperties. It generates custom property ...
Read more >Using @ConfigurationProperties in Spring Boot - amitph
In this tutorial we'll learn about mapping the properties file or yaml file into Java Bean using @ConfigurationProperties annotation.
Read more >Core Features - Spring
Here you can learn about the key features that you may want to use and ... To do so, you need to enable...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yes. Thank you.
Of course, it’s better to have such properties included in the metadata than not. However please keep in mind, that a lot of production systems keep properties in the separate repository than the application source code. The IDE plugin doesn’t use metadata in non-java projects so it can be used only during development. Often even the operation teams manage those properties directly, using vi instead of the Intellij. So the very first moment to verify the properties is during the application startup - in such case the sooner the better. In my opinion, WARN is adequate to seriousness of the situation, but of course if I must choose between DEBUG and nothing I prefer DEBUG.
I’ve checked our applications and currently, there are no invalid properties. We include over 15 different Spring Boot & Spring Cloud starters. However, the problem I found is that after adding unknown property it’s logged 3 times: