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
Details:
One of my project has a rather complicated deployment which spiders out application contexts somewhat like the following.
parent
web1 parent
web1
web2 parent
web2
web3 parent
web3
One of the things I found is method validation would not work correctly in our web apps.
I think this is because BeanPostProcessors are only applied when they are in the current application context and not from the parent context (which makes senses). But ValidationAutoConfiguration.methodValidationPostProcessor finds that the it already exists in the parent context and does not create it in the child context.
This not only effected controllers, but also any Bean that might have any validation on its methods, such as NotNull, NotBlank etc.
The demo app above is against 2.5.4, but this issue exists at least back to 2.3.9.
The text was updated successfully, but these errors were encountered:
wilkinsona
changed the title
spring boot validation and parent contexts
When a parent context has method validation configuration, it isn't auto-configured in its child contexts
Oct 29, 2021
Summary:
ValidationAutoConfiguration.methodValidationPostProcessor
should have@ConditionalOnMissingBean(search = SearchStrategy.CURRENT)
Demo code: https://github.com/cmercer/spring-boot-validation-issue
The above code has a fix enabled by default, readme contains information about reenabling the break.
Details:
One of my project has a rather complicated deployment which spiders out application contexts somewhat like the following.
One of the things I found is method validation would not work correctly in our web apps.
I think this is because BeanPostProcessors are only applied when they are in the current application context and not from the parent context (which makes senses). But ValidationAutoConfiguration.methodValidationPostProcessor finds that the it already exists in the parent context and does not create it in the child context.
This not only effected controllers, but also any Bean that might have any validation on its methods, such as NotNull, NotBlank etc.
The demo app above is against 2.5.4, but this issue exists at least back to 2.3.9.
The text was updated successfully, but these errors were encountered: