我是Spring新手,并且遇到JSR303验证问题。这个问题似乎与spring-servlet.xml中的< mvc:annotation-driven /> 标签有关。
SEVERE:上下文初始化失败 org.springframework.beans.factory.BeanCreationException:使用名称'org.springframework.validation.beanvalidation.LocalValidatorFactoryBean#0'创建bean时出错:init方法的调用失败;嵌套异常是javax.validation.ValidationException:无法找到默认提供程序我不知道如何解释此消息。我正在使用 validation-api-1.0.0.GA.jar ,它位于WEB-INF / lib目录和我的eclipse构建路径中。
有什么想法?
解决方案看起来您没有任何JSR-303提供者在你的类路径中。 validation-api-1.0.0.GA.jar只定义了JSR-303协议,您将需要hibernate验证器或apache bean验证来执行验证。
您可以在这里查看关于2个JSR-303提供者的问题:是否有JSR-303(bean验证)的实现?
I am new to Spring and having issues with JSR303 Validation. The problem appears to be with the <mvc:annotation-driven/> tag in spring-servlet.xml.
When I include this tag I get the following error on startup of the development server.
SEVERE: Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.validation.beanvalidation.LocalValidatorFactoryBean#0': Invocation of init method failed; nested exception is javax.validation.ValidationException: Unable to find a default providerI have no idea how to interpret this message. I am using validation-api-1.0.0.GA.jar which is in the WEB-INF/lib directory and on my eclipse build path.
Any ideas?
解决方案It looks like you don't have any JSR-303 provider in your classpath. validation-api-1.0.0.GA.jar defines only the JSR-303 contract, and you will need either hibernate validator or apache bean validation to be present to perform the validations.
You can check a question regarding the 2 JSR-303 providers here: Is there an implementation of JSR-303 (bean validation) available?
更多推荐
Spring + App Engine + JSR303
发布评论