When the annotation processor runs incrementally, it doesn't keep the properties that are in a nested group (i.e. NestedConfigurationProperty
).
When working in the module where the @ConfigurationProperties
object is defined, such properties became all the sudden invalid.
Comment From: snicoll
The analysis on #18396 is quite interesting and should help us fix this issue.
Comment From: davinkevin
I think I have the same problem.
I have a class annotated with @NestedConfigurationProperty
in a library, then another library use it as a sub section of the properties. Code a better than a long description:
@SpringBootApplication
@EnableConfigurationProperties(FooProperties::class)
class PropertyDemoApplication
fun main(args: Array<String>) {
runApplication<PropertyDemoApplication>(*args)
}
### Library First level, having for dependency the library second level
@ConstructorBinding
@ConfigurationProperties("foo")
data class FooProperties(
/**
* URL of the foo component
*/
val uri: URI,
/**
* Authentication configuration
*/
@NestedConfigurationProperty
val auth: AuthenticateProperties
)
### Library Second Level
@ConstructorBinding
data class AuthProperties (
/**
* The url of the authenticate component
*/
val url: URI,
/**
* Method 1 of auth
*/
@NestedConfigurationProperty
val one: Method1 = Method1(),
/**
* Method 2 of auth
*/
@NestedConfigurationProperty
val two: Method2 = Method2(),
/**
* Method 3 of auth
*/
@NestedConfigurationProperty
val three: Method3 = Method3()
)
@ConstructorBinding
data class Method1(
/**
* key used for method 1
*/
val key: String = ""
)
@ConstructorBinding
data class Method2(
/**
* token used for method 2
*/
val token: String = ""
)
@ConstructorBinding
data class Method3 (
/**
* keyid
*/
val keyId: String = "",
/**
* key
*/
val key: String = ""
)
The result in the JSON file, all groups are created but only keys from FooProperties
and AuthProperties
are generated. Key from MethodX
objects are not present in the final json file (in properties
key).
Do you think this is link to this issue or should I open another issue @snicoll ?