我被卡住了......我知道https://github.com/gunnarmorling/methodvalidation-integration/tree/master/methodvalidation-cdi,它工作得很好,而且我知道有 Seam Validation 可以帮助我验证我的方法参数在 Hibernate Validator 4.2.0 中
我重构了上面的示例以使用 Seam Validation:
- 替换
AutoValidating
为ValidationInterceptor
Seam Validation 的类 - 改用
beans.xml
了org.jboss.seam.validation.ValidationInterceptor
- 更改
CdiMethodValidationTest
为使用 Seam ValidationValidationInterceptor
- 添加
seam-validation-api
3.1.0.Finalseam-validation
到 Maven POM - 在 POM 中更改
arquillian-weld-se-embedded-1
为arquillian-weld-ee-embedded-1.1
我得到的只是
java.lang.NoSuchMethodError: org.jboss.weld.bootstrap.api.Bootstrap.parse(Ljava/lang/Iterable;)Lorg/jboss/weld/bootstrap/spi/BeansXml;
at org.jboss.arquillian.container.weld.ee.embedded_1_1.mock.TestContainer.<init>(TestContainer.java:215)
at org.jboss.arquillian.container.weld.ee.embedded_1_1.WeldEEMockContainer.deploy(WeldEEMockContainer.java:76)
at org.jboss.arquillian.impl.handler.ContainerDeployer.callback(ContainerDeployer.java:62)
at org.jboss.arquillian.impl.handler.ContainerDeployer.callback(ContainerDeployer.java:50)
at org.jboss.arquillian.impl.event.MapEventManager.fire(MapEventManager.java:63)
at org.jboss.arquillian.impl.context.AbstractEventContext.fire(AbstractEventContext.java:115)
at org.jboss.arquillian.impl.EventTestRunnerAdaptor.beforeClass(EventTestRunnerAdaptor.java:96)
at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:162)
at org.jboss.arquillian.junit.Arquillian$3$1.evaluate(Arquillian.java:186)
at org.jboss.arquillian.junit.Arquillian$MultiStatementExecutor.execute(Arquillian.java:297)
at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:182)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:127)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
我究竟做错了什么?