Spring + App Engine + JSR303

编程入门 行业动态 更新时间:2024-10-26 07:28:45
本文介绍了Spring + App Engine + JSR303的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我是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 provider

I 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

本文发布于:2023-10-07 17:25:39,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1470017.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:App   Spring   Engine

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!