-
Notifications
You must be signed in to change notification settings - Fork 41.2k
StackOverflowException on FactoryBean with @Validated and @ConfigurationProperties #13922
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
Comments
Workaround: If the |
This applies to |
@snicoll
so when
P.S. But I'm not sure about this. I can create |
Thanks for the analysis @nosan but I don't think we can ignore |
Here is a possible fix. I'm not sure if it's good, bad, ugly, or some combination of the three. |
I like it, I think. I wonder if we could't generalize this one level up so that any users of the |
I'm a bit wary of moving it one level up in case someone is casting the |
Turns out the fix is ugly as it doesn't work in 2.0.x (perhaps I was mistaken and it also doesn't work in 1.5). The stack overflow still occurs and looks like this:
|
This works because the validation is solely performed by the binder. By contrast, when
|
I've opened SPR-17374 to see if anything can be done in Framework to prevent the unnecessary use of the |
Thanks to the changes made in Framework in spring-projects/spring-framework#21907 and spring-projects/spring-framework#21919 the problem has been resolved as of Boot 2.0.8 and 2.1.0. |
In a Spring Boot 2.0.3 demo application with
spring-boot-starter-validation
, aStackOverflowException
is thrown on startup when there is a bean class that extendsFactoryBean<T>
and if the bean class is annotated with@ConfigurationProperties
and@Validated
.application.properties
demo.name=foo
The text was updated successfully, but these errors were encountered: