Java 类型字符串Jboss6的未满足依赖项

Java 类型字符串Jboss6的未满足依赖项,java,intellij-idea,jboss6.x,Java,Intellij Idea,Jboss6.x,获取错误,不确定原因,因为我在两个模块中都使用了beans.xml WELD-001408在[constructor]@Inject public com.comp.alert.EmailAlertHandler(字符串,字符串)的注入点[[参数1]处具有限定符[@SystemProperty]的类型[String]的未满足依赖项 SystemProperty.java: @Qualifier @Retention(RetentionPolicy.RUNTIME) @Target({Elemen

获取错误,不确定原因,因为我在两个模块中都使用了
beans.xml

WELD-001408在[constructor]@Inject public com.comp.alert.EmailAlertHandler(字符串,字符串)的注入点[[参数1]处具有限定符[@SystemProperty]的类型[String]的未满足依赖项

SystemProperty.java:

@Qualifier
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.PARAMETER, ElementType.FIELD, ElementType.METHOD, ElementType.TYPE})
public @interface SystemProperty {

    @Nonbinding String value();

}
EmailAlertHandler.java(仅包含使用@Systemproperty:

@Email
@Stateless
public class EmailAlertHandler implements AlertHandler {

    @Inject
    public EmailAlertHandler(@SystemProperty("min.email.from") String emailFrom,
                             @SystemProperty("min.email.to") String emailTo) {
        this.emailFrom = emailFrom;
        this.emailTo = emailTo;
    }

    @Override
    public void sendAlert(Alert alert) {
        //body omitted 
    }
}
EmailAlertHandler模块中定义的beans.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://java.sun.com/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="
       http://java.sun.com/xml/ns/javaee
       http://java.sun.com/xml/ns/javaee/beans_1_0.xsd"/>

基本上,我已经在类似的未满足/缺少依赖项错误上找到的所有解决方案都指向配置beans.xml,但这并没有解决任何问题。

看起来没有任何东西生成这些字符串

你们有制片人吗

您可以尝试以下方法:

public class PropertyProducer {

     @Produces
     public String createProperty(InjectionPoint injectionPoint) {
         String value =injectionPoint.getAnnotation(SystemProperty.class).value();
         return System.getProperty(value);
     }
}
@Singleton
@Startup
public class AlertManager {

    @Inject @Email
    private AlertHandler emailAlertHandler;

    @Asynchronous
    public void sendAlertAsync(Alert alert) {
        // Handle alert via email
        emailAlertHandler.sendAlert(alert);
    }

}
public class PropertyProducer {

     @Produces
     public String createProperty(InjectionPoint injectionPoint) {
         String value =injectionPoint.getAnnotation(SystemProperty.class).value();
         return System.getProperty(value);
     }
}