How to inject JPA resources with CDI

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.

Read more

Categories cdi

Context Dependency Injection with JBoss Weld

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.

Read more

Categories cdi

Building a CDI 2 standalone Java application

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

Categories cdi

Introduction to CDI 2.0 API

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

Categories cdi

Using CDI Beans in JBoss – WildFly modules

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

Categories cdi

Accessing ServletContext and ServletRequest in CDI Beans

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

Categories cdi

Java EE 6 CDI example application

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