Hello my name is Felipe and i have a CDI doubts.
I have installed the tomee and i setup all the classes and it works fine,
but my server has very little ram memory, and this reason led me to try to
install only the apache
codi<http://myfaces.apache.org/extensions/cdi/index.html>core into
apache
tomcat 7 <http://tomcat.apache.org/download-70.cgi> .
The project *compiles successfully*, but *the red line below* remains null!
Question: Is it necessary to add some additional dependency in order to
the dependency injection works ?
*So, I followed the following steps:*
1.
*Using maven to include only the cdi core *
<!-- **************************************************** CODI CDI
dependencies -->
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-atinject_1.0_spec</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jcdi_1.0_spec</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.apache.myfaces.extensions.cdi.core</groupId>
<artifactId>myfaces-extcdi-core-api</artifactId>
<version>${codi.version}</version>
</dependency>
<dependency>
<groupId>org.apache.myfaces.extensions.cdi.core</groupId>
<artifactId>myfaces-extcdi-core-impl</artifactId>
<version>${codi.version}</version>
</dependency>
*2 Setup my producer.*
@javax.enterprise.context.ApplicationScoped
public class FacadeFactory {
@javax.enterprise.inject.Produces
public GrowUpFacadeAdapter getFacade() {
return new GrowUpFacade();
}
}
public class GrowUpFacade implements GrowUpFacadeAdapter {
....
}
public interface GrowUpFacadeAdapter extends Serializable {
....
}
*3 My JSF bean*
*@ManagedBean(name="pedidoMBean")
@javax.faces.bean.SessionScoped@[email protected]
public class PedidoMBean extends AutenticadorMBean { @javax.inject.Inject
private GrowUpFacadeAdapter facade; <------ remains null !!!!
.....}*
public class AutenticadorMBean implements Serializable {
.....
}
*4 beans.xml*
*<beans xmlns="http://java.sun.com/xml/ns/javaee
<http://java.sun.com/xml/ns/javaee>"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
<http://www.w3.org/2001/XMLSchema-instance>"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
<http://java.sun.com/xml/ns/javaee>
http://java.sun.com/xml/ns/javaee/beans_1_0.xsd
<http://java.sun.com/xml/ns/javaee/beans_1_0.xsd>"> </beans>*
--
Atenciosamente,
Felipe Pina
--
Atenciosamente,
Felipe Pina