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
This commit is contained in:
Andy Wilkinson 2016-12-16 12:13:26 +00:00
parent 61fcf64f0a
commit cedac27c80
1 changed files with 2 additions and 2 deletions

View File

@ -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