mein Qualifier Arbeits ist:Dependecy Injection nicht
@Qualifier
@Target({ TYPE, METHOD, PARAMETER, FIELD })
@Retention(RUNTIME)
@Documented
public @interface JPADAOQ {
}
dies die Bohne ist, dass ich
@JPADAOQ
@ApplicationScoped
public class PlotDaoImpl extends JpaDao<Long, Plot> implements PlotDao {
public PlotDaoImpl() {
super(Plot.class);
}
}
injizieren wollen endlich da ist, wo ich meine Bohne wollen
@ManagedBean
@SessionScoped
public class PlotController {
@Inject @JPADAOQ
private PlotDaoImpl plotDaoImpl;
@PostConstruct
public void init() {
if (plotDaoImpl==null) {
System.out.println("plotDaoImpl null");
} else {
System.out.println("plotDaoImpl not null");
}
}
injiziert werden
Aber ich habe es immer null, also kann ich es nicht benutzen.
Meine Konfiguration:
1.beans.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
bean-discovery-mode="all">
</beans>
2.pom.xml basierend auf Wildfly quickstart Form here.
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-7.0</artifactId>
<version>${version.jboss.spec.javaee.7.0}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.annotation</groupId>
<artifactId>jboss-annotations-api_1.2_spec</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.servlet</groupId>
<artifactId>jboss-servlet-api_3.1_spec</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
Ich kann nicht herausfinden, warum meine Bohne nicht Int @ PostConstruct-Methode injiziert wird.