In this tutorial we will learn three features of CDI programming: Interceptors, Decorators and Alternatives. All these features allow you to perform a separation of concerns in your applications in a type safe manner through annotations.
This tutorial shows how you can integrate Context Dependency Injection (CDI) to produce resources for JPA Applications. We will also learn how to handle multiple Database resources through CDI annotations.
The beans.xml file is the bean archive descriptor for CDI applications. It can be used for any CDI compliant container, such as Weld which is included in WildFly application server. First off, it’s worth understanding that the bean descriptor in CDI (META-INF/beans.xml or WEB-INF/beans.xml) is not there to define beans in XML. Rather, you can … Read more
In the second article about CDI 2 we will learn how to create a standalone J2SE application featuring CDI2. Let’s get started! Using Context Dependency Injection for J2SE application is something not totally new to developers. For example,before CDI 2 you could start-up the Weld CDI container using the specific classes provided by it. This … Read more
CDI 2.0 is the new version of Context and Dependency Injection for the Java EE Platform and it’s now in public review status. While you can now grab the specification at: https://jcp.org/aboutJava/communityprocess/pr/jsr365/index.html in this tutorial we will have a first look on running some of its features on the last version of WildFly 10 CDI … Read more
The building blocks of the application server are modules which are, often, Java libraries which can be run out of the application server context. It is however possible to deploy CDI Beans or use AS Resources in your modules. Let’s see how. In our example project, we will use a Java class which contains CDI … Read more
Weld BootstrapService exception If you are starting to practice with CDI on Weld container, a common obscure exception that you might get is the following one: JBAS014775: New missing/unsatisfied dependencies: service jboss.deployment.unit.”jmsdemo.war”.WeldBootstrapService (unavailable) dependents: [service jboss.deployment.unit.”jmsdemo.war”.CdiValidatorFactoryService, service jboss.deployment.unit.”jmsdemo.war”.component.”javax.faces.webapp.FacetTag”.WeldInstantiator, service jboss.deployment.unit.”jmsdemo.war”.component.”javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV”.WeldInstantiator, service jboss.deployment.unit.”jmsdemo.war”.component.”com.sample.Test”.WeldInstantiator, JBAS014799: … and 10 more ] service jboss.deployment.unit.”jmsdemo.war”.WeldStartService (unavailable) dependents: [service jboss.deployment.unit.”jmsdemo.war”.CdiValidatorFactoryService, service jboss.deployment.unit.”jmsdemo.war”.component.”javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV”.WeldInstantiator, … Read more
Today I’ve found one interesting question on StackOverFlow of one user asking to read the web.xml context params from a CDI Bean. Luckily it’s not complicated at all to accomplish this task. In order to be able to read the web.xml context-params from a CDI Bean all you need to do is injecting the ServletContext … Read more
In this tutorial we will show how to upgrade our Java EE 6 EJB based application into a CDI based application using Eclipse and Eclipse Maven plugin. Contexts and Dependency Injection(CDI) is a new addition to the Java EE specification as of Java EE 6. It provides several benefits that were missing to Java EE … Read more
In this tutorial we will illustrate how to use CDI to choose between different EJB implementation at deployment time, or at injection point. CDI stands for Context Dependency Injection and can be used to for injecting Context and Dependencies into your application. This concept is not at all new for Java developers. Spring developers for … Read more