You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Above configuration is valid and bind to all properties but the spring-boot-configuration-processor cannot render the metadata of the BaseConfig#nest property (nested property on parent class).
Example 2
publicclassOverrideChildConfigextendsBaseConfig {
privatelonglongValue;
privatefinalCustomNestnest = newCustomNest();
@OverridepublicCustomNestgetNest() { // override getter as return the custom nested objectreturnnest;
}
// getter and setter ...publicstaticclassCustomNestextendsNest { // custom class of nested class defined in parent classprivatelonglongValue;
// getter and setter ...
}
}
Above configuration is valid and bind to all properties but the spring-boot-configuration-processor cannot render the metadata of the OverrideChildConfig#nest property.
We might be able to refine PropertyDescriptor.isParentTheSame to detect these types. Processing complicated class relationships with the annotation processor is unfortunately quite difficult.
Thanks for your quick response !!
I found a workaround as follow:
For Example1
publicclassSpringBootChildConfigextendsChildConfig {
@ConfigurationProperties("my.child.nest") // mark nested configuration property on sub class@OverridepublicNestgetNest() {
returnsuper.getNest();
}
@ConfigurationProperties("my.child.child-nest") // mark nested configuration property on sub class@OverridepublicChildNestgetChildNest() {
returnsuper.getChildNest();
}
}
For Example2
publicclassSpringBootOverrideChildConfigextendsOverrideChildConfig {
@ConfigurationProperties("my.override-child.nest") // mark nested configuration property on sub class@OverridepublicCustomNestgetNest() { // override getter as return the custom nested objectreturnsuper.getNest();
}
}
philwebb
changed the title
Some properties on inheritance relationship class cannot be render to configuration metadata
Metadata generated by the configuration properties annotation processor can miss inherited properties from nested classes
Jun 21, 2022
Uh oh!
There was an error while loading. Please reload this page.
Some properties of 3rd party provided class with inheritance relationship cannot be render to configuration metadata.
Versions
Details
For example, following class provides from 3rd-party library:
Example 1
Above configuration is valid and bind to all properties but the
spring-boot-configuration-processor
cannot render the metadata of theBaseConfig#nest
property (nested property on parent class).Example 2
Above configuration is valid and bind to all properties but the
spring-boot-configuration-processor
cannot render the metadata of theOverrideChildConfig#nest
property.Executable examples
The text was updated successfully, but these errors were encountered: