首先我要说这在JBoss 7.1.1 Final中有效,所以我不确定7.1.3是否引入了错误或者是否有效地修复了不应该一起工作的注释组合。
如果我使用@ValidateRequest或@Stateless注释我的RESTful类,那么它可以正常工作。如果我添加两个注释,那么我得到:
org.jboss.resteasy.spi.UnhandledException: javax.validation.ConstraintDeclarationException: Only the root method of an overridden method in an inheritance hierarchy may be annotated with parameter constraints, but there are parameter constraints defined at all of the following overridden methods: [MethodMetaData
所以:
@Path("/somepath")
@Stateless
有效,
@Path("/somepath")
@ValidateRequest
有效但
@Path("/somepath")
@ValidateRequest
@Stateless
出现上述错误。
我更感兴趣的是,如果这是一个错误或某些规范导致两个注释发生冲突,据我所知,应该没有理由说这两个注释不能一起使用。