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
@ConfigurationProperties prefix with capital letters causes fail #9545
Comments
Lots of things worked in 1.x that weren't expressly supported. We've tightened things up in 2.0 so that things are hopefully significantly easier to understand and to implement. As a result some things that used to work no longer do. This could well be one of them. We may want to support this or, perhaps, to improve the error message to explain why the prefix is invalid. To that end, can you please share the full stack trace and message of the error that you saw? |
|
It's because of this line, where we try to convert a |
I think my preference would be to enforce the canonical format there. I think that's what's required for; e.g. But we should change that error message to explain why it's invalid (describing a bit more what the canonical format is). |
* The prefix name of ConfigurationProperties should be lower-case. * Error message is misleading, and spring boot may refine this. * Details see: spring-projects/spring-boot#9545 Signed-off-by: Pan Li <panli@microsoft.com>
* The prefix name of ConfigurationProperties should be lower-case. * Error message is misleading, and spring boot may refine this. * Details see: spring-projects/spring-boot#9545 Signed-off-by: Pan Li <panli@microsoft.com>
* Upgrade spring boot version to M6. * Adjust some unit tests due to version change. * Align the ServiceEndpoint configuration prefix. * Meet one mock injection failure on class MappingDocumentDbConverter. Signed-off-by: Pan Li <panli@microsoft.com> * Align the restriction of ConfigurationProperties prefix. * The prefix name of ConfigurationProperties should be lower-case. * Error message is misleading, and spring boot may refine this. * Details see: spring-projects/spring-boot#9545 Signed-off-by: Pan Li <panli@microsoft.com> * Align the code change for spring boot 2.0.0.RELEASE * One expected exception changes. * yamlPropertySourceLoad API change. * Add default constructor for documentdb sample. Signed-off-by: Pan Li <panli@microsoft.com> * Upgrade spring-data-documentdb to version 2.0.1 * For fix the Mock cannot find class MappingDocumentDbConverter. Signed-off-by: Pan Li <panli@microsoft.com> * Remove unnecessary dependences. * Repository url of snapshot and milestone. * Spring security. * Json. Signed-off-by: Pan Li <panli@microsoft.com> * Re-enable DocumentDBAutoConfigurationTest. * As documentdb is not available in previous. Signed-off-by: Pan Li <panli@microsoft.com> * Remove unnecessary Autowired Annontation. Signed-off-by: Pan Li <panli@microsoft.com>
@mumukiller this issue is closed and that comment is not really telling us anything. If you think you've found a bug, please create a separate issue with a proper description of the problem. A sample that reproduces it would be ideal. Thank you. |
In the documentation on canonical property names it is mentioned that non-canonical representations are implicitly normalized. https://github.com/spring-projects/spring-boot/wiki/Canonical-properties#simple-types:
If the goal was to make things consistent and easier to understand, I think it would be good to apply the same transformation for the Actually to above documentation doesn't seem to be correct as dashes won't be removed from the properties key as far as I understood. Actually they might be required to match the bean property names which are camel case by spec. |
I discovered this in trying to upgrade from Spring boot 1.4.1 to 2.0.0.M2
If I have a yaml file with the following:
myProperties: name: 'Sam'
and I have a configuration class:
I will get a bunch of errors trying to create the
MyConfig
bean. Essentially the error boils down to:I notice that if I change this line to:
@ConfigurationProperties(prefix="myproperties")
the error goes away. Using a prefix with capital letters in it used to work in 1.4.1 and 1.5.4
The text was updated successfully, but these errors were encountered: