Jakarta ee 从@Named移动到自定义限定符将导致NPE

Jakarta ee 从@Named移动到自定义限定符将导致NPE,jakarta-ee,jax-rs,cdi,Jakarta Ee,Jax Rs,Cdi,我有一个非常简单的JAX-RS服务: @Path("/test") public class Service { @Inject @Message String thingie; @GET public String test(){ return thingie; } } 其中该字符串来自@products带注释的方法: public class Producer { @Produces @Message

我有一个非常简单的JAX-RS服务:

@Path("/test")
public class Service {

    @Inject
    @Message
    String thingie;

    @GET
    public String test(){
        return thingie;
    }
}
其中该字符串来自@products带注释的方法:

public class Producer {
    @Produces
    @Message
    public String thingie(){
        return "thingie";
    }
}
@Message限定符如下所示:

@Qualifier
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER })
@Retention(RetentionPolicy.RUNTIME)
public @interface Message {
}
为了完整起见,我的另一个代码是JAX-RS激活器类:

@ApplicationPath("/rest")
public class JAXRSActivator extends Application {
}
和一个空的beans.xml。我使用的应用服务器是Wildfly 10.0.10

当我进行GET-to/rest/test时,我得到了500的响应,内容类型为plain/text,文本为“java.lang.NullPointerException”。但是日志或消息中没有进一步的信息(特别不是NPE来自的位置)

调用了我的producer方法,但服务类中的test()方法没有调用


使用@Named(“message”)而不是@message可以很好地工作,那么我错过了什么呢

tldr;将@Message放入一个包中

所以,正如您可能猜到的,这是一个测试某些东西的玩具示例,我将其全部放在默认包中

Hibernate验证器不处理默认包中的注释,因为它假定将有一个包