Category Archives: Contexts and Dependency Injection (CDI)

Auxiliary Tools :: Hibernate CDI Standalone Example

  Based on https://www.sitepoint.com/cdi-weld-inject-jpa-hibernate-entity-managers/ with my changes and extensions: project structure, multiple entity producer, injectable logger… Environment: Weld 2.3.3.Final, J2SE 8, Hibernate 5.1.8.Final, h2-1.4.196. Project structure:   Creating an Injectable Entity Manager Using the @PersistentContext Annotation The most painless way, … Continue reading

Posted in Contexts and Dependency Injection (CDI) | Leave a comment

Auxiliary Tools :: Introduction to Contexts and Dependency Injection (CDI) – Part II – Producers

  in progress Producer Method A producer method is a method that acts as a source of bean instances. When no instance exists in the specified context, the method declaration itself describes the bean, and the container invokes the method … Continue reading

Posted in Auxiliary Tools, Contexts and Dependency Injection (CDI) | Leave a comment

Auxiliary Tools :: Wildfly 10 JSF CDI Example

  index.xhtml: <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”> <html xmlns=”http://www.w3.org/1999/xhtml” xmlns:ui=”http://java.sun.com/jsf/facelets” xmlns:h=”http://java.sun.com/jsf/html” xmlns:f=”http://java.sun.com/jsf/core” xmlns:c=”http://java.sun.com/jsp/jstl/core”> <h:head> </h:head> <h:body> <h2>JSF on Wildfly 10 CDI Example</h2> <h:form> <h:panelGrid columns=”2″ styleClass=”default”> <h:outputText value=”Code:” /> <h:inputText value=”#{country.code}” /> <h:outputText value=”Name:” /> <h:inputText value=”#{country.name}” … Continue reading

Posted in Contexts and Dependency Injection (CDI) | Leave a comment

Auxiliary Tools :: Introduction to Contexts and Dependency Injection (CDI) – Part I

  in progress Based on Oracle and RedHat documentation: https://docs.oracle.com/javaee/7/tutorial/cdi-basic.htm https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.0/html/development_guide/contexts_and_dependency_injection_cdi and https://dzone.com/refcardz/contexts-and-depencency https://dzone.com/articles/define-cdi-qualifier http://buraktas.com/cdi-dependency-injection-producer-method-example/ About CDI CDI 1.2 is a specification designed to enable Enterprise Java Beans (EJB) 3 components to be used as Java Server Faces (JSF) managed … Continue reading

Posted in Contexts and Dependency Injection (CDI) | Leave a comment