小编Cap*_*aps的帖子

javax.validation.ValidationException:无法找到默认提供程序

我目前正在使用Spring MVC Web应用程序并尝试使用@Valid注释挂钩验证.当我启动应用程序时,我得到以下异常:

javax.validation.ValidationException: Unable to find a default provider
Run Code Online (Sandbox Code Playgroud)

我在类路径上有Hibernate Validator 3.1.0.GA以及javax验证1.0.0.GA,Hibernate Core 3.3.1.GA和Hibernate Annotations 3.4.0.GA.

在那些我没有看到的版本中是否存在不兼容性,或者是否有人会想到为什么我仍然在类路径上使用Hibernate Validator获得此异常的原因?

干杯,

帽子

java spring hibernate-validator bean-validation

32
推荐指数
3
解决办法
9万
查看次数

将具体类型列表转换为Java中的接口列表

有没有办法将具体类型列表转换为Java中的接口列表?

例如:

public class Square implements Shape { ... }

public SquareRepository implements Repository {

  private List<Square> squares;

  @Override
  public List<Shape> getShapes() {
    return squares; // how can I return this list of shapes properly cast?
  }

}
Run Code Online (Sandbox Code Playgroud)

提前致谢,

帽子

java types casting list

7
推荐指数
2
解决办法
3952
查看次数

带有 maven-failsafe-plugin 的 VM 参数

我正在尝试将 VM 参数传递到 Maven,特别是针对由故障安全运行的一套测试。

我的 pom.xml 如下所示:

...
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-failsafe-plugin</artifactId>
  <configuration>
    <argLine>-Dtest.data=true</argLine>
  </configuration>
  <version>2.7.2</version>
  <executions>
    <execution>
      <id>integration-test</id>
      <goals>
        <goal>integration-test</goal>
      </goals>
    </execution>
    <execution>
      <id>verify</id>
      <goals>
        <goal>verify</goal>
      </goals>
    </execution>
  </executions>
</plugin>
...
Run Code Online (Sandbox Code Playgroud)

当我运行命令时,mvn clean verify依赖于 test.data 设置为 true 的测试失败。但是,当我运行命令时,mvn -Dtest.data=true clean verify测试全部通过。我需要在我的 CI 环境的 pom 中设置参数。

我在这里错过了什么吗?

提前致谢,

皮特

java build-automation continuous-integration maven-plugin maven

5
推荐指数
1
解决办法
8884
查看次数