-
Notifications
You must be signed in to change notification settings - Fork 40.8k
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
Properties migrator causes an application to fail to start if it tries to map a property whose metadata data entry contains an invalid configuration property name #32729
Comments
Thanks for the suggestion. Unfortunately, I cannot reproduce the behavior that you have described. I have some json describing the properties that looks like this: {
"groups": [
{
"name": "some",
"type": "com.example.demo.SomeProperties",
"sourceType": "com.example.demo.SomeProperties"
}
],
"properties": [
{
"name": "broken¢∞§¢#¢∞broken",
"type": "java.lang.Boolean"
},
{
"name": "some.two",
"type": "java.lang.String",
"sourceType": "com.example.demo.SomeProperties"
},
{
"name": "some.one",
"type": "java.lang.String",
"sourceType": "com.example.demo.SomeProperties",
"deprecated": true,
"deprecation": {
"replacement": "some.two"
}
}
],
"hints": []
} And some configuration that sets the deprecated property:
The app then starts successfully, warning me about the deprecated property and its mapping:
Can you please provide a minimal example that shows the property with invalid characters causing a failure? |
Thanks for looking into this. Running |
Thanks, @larsgrefer. I've reproduced the problem now. |
I don't think we can address this by failing compile time as it may result in compilation failures for things that are currently harmless. Without the properties migrator on the classpath, everything works nice with the IDE reporting that |
Possible change to the properties migrator that I'd like to discuss with @snicoll. |
Allowing the properties migrator to work with non-canonical property keys would be Ideal. This way it's easier to provide migration metadata for older (before spring boot) properties. |
That change looks good @wilkinsona, thanks! |
TL;DR: The
spring-boot-configuration-processor
should check for (or fix) invalid configuration property names found inMETA-INF/additional-spring-configuration-metadata.json
at compile time.We currently have the following situation:
META-INF/additional-spring-configuration-metadata.json
of an external library.spring-boot-configuration-processor
copies the invalid property name over toMETA-INF/spring-configuration-metadata.json
.spring-boot-properties-migrator
org.springframework.boot.context.properties.source.InvalidConfigurationPropertyNameException
.Since the library is an external dependency out of our control, our only option is to exclude
spring-boot-properties-migrator
in our application until the metadata is fixed by the author of the external library.This problem could have been prevented, if the invalid name were already caught in Step 2.
I therefore propose that
spring-boot-configuration-processor
should checkMETA-INF/additional-spring-configuration-metadata.json
for invalid property names, before copying them over toMETA-INF/spring-configuration-metadata.json
. It can then either fail the compilation or convert the properties to their correct form.The text was updated successfully, but these errors were encountered: