Browse Source

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
pull/7671/head
Andy Wilkinson 9 years ago
parent
commit
cedac27c80
  1. 4
      spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/validation/ValidationAutoConfiguration.java

4
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/validation/ValidationAutoConfiguration.java

@ -17,7 +17,7 @@ @@ -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 @@ -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

Loading…
Cancel
Save