Skip to content
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

Diagnostics are poor when using @ConfigurationPropertiesScan and @ConstructorBinding on a Kotlin data class without kotlin-reflect #19312

Closed
wilkinsona opened this issue Dec 5, 2019 · 0 comments
Assignees
Labels
type: bug A general bug
Milestone

Comments

@wilkinsona
Copy link
Member

wilkinsona commented Dec 5, 2019

If @ConstructorBinding is used on a Kotlin data class without a dependency on kotlin-reflect, the annotation isn't found and autowiring is attempted instead. This leads to a failure like this:

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 0 of constructor in ind.ericjturley.mcve.configurationproperties.PushServicesProperties1 required a bean of type 'ind.ericjturley.mcve.configurationproperties.PushServicesProperties1$SnsClient' that could not be found.


Action:

Consider defining a bean of type 'ind.ericjturley.mcve.configurationproperties.PushServicesProperties1$SnsClient' in your configuration.
Consider adding @ConstructorBinding to ind.ericjturley.mcve.configurationproperties.PushServicesProperties1 if you intended to use constructor-based configuration property binding.

The second action is wrong as the class is already annotated with @ConstructorBinding. It would be nice to fail in a more helpful way, for example by detecting that it's a Kotlin class but kotlin-reflect is missing.

With thanks to @ericjturley, the problem can be reproduced with https://github.com/ericjturley/mcve-configurationproperties.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants