In this tutorial we will illustrate how to use CDI to choose between different Bean implementations at deployment time, or at injection point.
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.
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.
Contexts and Dependency Injection (CDI) (JSR 299) defines a set of services for the Java EE environment that makes applications much easier to develop. It provides an architecture that allows Java EE components such as servlets, enterprise beans, and JavaBeans to exist within the lifecycle of an application with well-defined scopes.
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
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