-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Description
John Mark opened SPR-11272 and commented
I currently have javax.validation:validation-api:1.1.0.Final on my classpath since I include an artifact that uses that jar. Spring seems to detect this and try to create a validator using org.springframework.validation.beanvalidation.LocalValidatorFactoryBean which then fails since I don't have a validation provider like Hibernate Validator on my classpath. This then causes my entire webapp to fail to start.
This behavior does not make sense to me. If I don't have a validation provider on my classpath, then why does Spring think I want to use validation? I would think that mvc:annotation-driven should use the same type of detection mechanism that LocalValidatorFactoryBean uses to determine if a validation provider is on the classpath. That way it wouldn't try to create a validator just because I have the validation API on my classpath. It should only try to create a validator if a provider implementation exists. According to the documentation at http://docs.spring.io/spring-framework/docs/current/spring-framework-reference/html/mvc.html (Section 16.1.1) mvc:annotation-driven/ should only enable validation if a JSR-303 Provider is present on the classpath.
Affects: 4.0 GA
Issue Links:
- Support for @Valid in @MessageMapping annotated methods [SPR-11185] #15811 Support for
@Validin@MessageMappingannotated methods
Referenced from: commits b9c8f47, 6a5a3c9, e334489, 6aabb5f, c48da0d, 8d1e55d