Commit cedac27c authored by Andy Wilkinson's avatar Andy Wilkinson

Require Bean Validation 1.1 to enable validation auto-configuration

Previously, ValidationAutoConfiguration would configure a
MethodValidationPostProcessor if any Bean Validation 1.0 or later
implementation was available, however the underlying infrastructure
requires Bean Validation 1.1 with any implementation or
Bean Validation 1.0 with Hibernate Validator 4.3.

This caused a problem on TomEE which uses Apache BVal, and Bean
Validation 1.0 implementation. Spring Framework would identify that
Bean Validaton 1.0 was being used and then try to load Hibernate
Validator classes that are not present.

This commit fixes the problem by requiring Bean Validation 1.1 before
auto-configuring a MethodValidationPostProcessor.

Closes gh-7665
parent 61fcf64f
......@@ -17,7 +17,7 @@
package org.springframework.boot.autoconfigure.validation;
import javax.validation.Validation;
import javax.validation.Validator;
import javax.validation.executable.ExecutableValidator;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionMessage;
......@@ -41,7 +41,7 @@ import org.springframework.validation.beanvalidation.MethodValidationPostProcess
* @author Stephane Nicoll
* @since 1.5.0
*/
@ConditionalOnClass({ Validator.class })
@ConditionalOnClass(ExecutableValidator.class)
public class ValidationAutoConfiguration {
@Bean
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment