1

在我在 Spring 3.1 中开发的项目中,我试图通过使用 Apache Commons Validator 来执行客户端和服务器端验证。但是仅仅通过添加下面提到的代码就会导致一些 xml 异常。

在 pom.xml 中添加了依赖项:-

                    <dependency>
                         <groupId>org.springmodules</groupId>
                         <artifactId>spring-modules-validation</artifactId> 
                         <version>0.8</version>
                    </dependency> 

servlet-context.xml 中的编译时异常 --> 资源路径位置类型 引用的文件包含错误 (jar:file:/C:/Users/shift/.m2/repository/org/springframework/spring-beans/3.1.0. RELEASE/spring-beans-3.1.0.RELEASE.jar!/org/springframework/beans/factory/xml/spring-beans-3.0.xsd)。

我在某处读到 Spring 3.1 的 jar 可能与 Spring 2.x 发生冲突(它被添加到 maven 存储库中,因为 [i]spring-modules-validation[/i] 带来了它)。之后,我添加了一个排除项,如下所述:-

      <exclusion>
          <groupId>org.springframework</groupId>
          <artifactId>spring</artifactId>
      </exclusion>

之后异常消失了,但编译器找不到内置类,如 InternalResourceViewResolver、DataSourceTransactionManager 等。

除了 Commons Validator 之外,还有什么我遗漏的东西可以在 Spring 3.1 中执行客户端和服务器端验证吗?

4

0 回答 0