Tag Archives: cdi

DeltaSpike 1.0 – Extend #JavaEE beyond #JavaEE (Tech Tip #32)

Do you want @Transactional and @TransactionScoped-like features introduced in Java EE 7 in JBoss EAP 6.x or any other Java EE 6 compliant application server ?

Need a CDI scope for window/tab for a JSF application ?

Simplified JPA Criteria API ?

How about boot and shutdown CDI container in a Java SE application ?

Simplified annotation-based security in Java EE ?

This is not a wish list for Java EE 8, but is possible today using DeltaSpike. All of this is possible by using the power of CDI portable extensions to unleash the power of a Java EE application server beyond what is defined in the existing specifications.

deltaspike-logo

DeltaSpike consist of a number of portable CDI extensions that provide useful features for Java application developers.

What are CDI portable extensions ?

CDI portable extensions extend the functionality of the container using an Service Provider Interface (SPI). A portable extension may integrate with the container by:

  • Providing its own beans, interceptors, and decorators to the container
  • Injecting dependencies into its own objects using the dependency injection service
  • Providing a contextual implementation for a custom scope
  • Augmenting or overriding the annotation-based metadata with metadata from some other source

DeltaSpike also ensure true portability! They are tested on different CDI implementations like JBoss Weld and Apache OpenWebBeans, and also on different Java EE servers like Apache Tomcat and TomEE, JBoss AS7, WildFly 8, Oracle GlassFish 3.1+ and 4.x+, IBM WebSphere 8.x, Oracle WebLogic Server 12c, Jetty, and others.

DeltaSpike has a core API and Impl module. The extensions themselves are available in different modules:

  • Security: Intercept and check security
  • Java Persistence API: @Transactional, @TransactionScoped, Extended persistence context, and more
  • Java Server Faces: Multi-window handling, New scopes, Type-safe view configs
  • Bean Validation: Add CDI support in Bean Validation
  • Servlet: Injection of common Servlet objects, propagation of Servlet events to the CDI event bus
  • Data: provides enhanced JPA experience with declarative queries, reducing boilerplate to a minimum.
  • Test Control: Allows to write CDI based tests easily
  • Scheduler: Simple integration with Quartz v2 (per default) or any other scheduler which supports cron-expressions for job-classes.
  • Container Control: Allows to boot and shutdown the CDI container in SE applications, control the life-cycle of the built-in contexts of the CDI container

You may realize that some of the functionality is already available in Java EE 7 so this would certainly be lot more relevant to Java EE 6 compliant application server. But there are still several features that can be used in Java EE 7 compliant app servers, like WildFly. And then it has the potential to be the playground for new features that are being discussed in Java EE 8!

Getting started is easy if you are using Maven. Add core and impl <dependency>s to “pom.xml”:

And then configure one of the modules as explained here.

Complete documentation for all the modules is available here.

One of the frequently needed features is accessing ServletRequest in a CDI bean. With DeltaSpike, this can be easily achieved using the following annotation:

A complete sample showcasing this functionality is available at github.com/arun-gupta/wildfly-samples/tree/master/deltaspike.

DeltaSpike 1.0 was recently announced and the complete list of JIRA tickets fixed is here.

There are usual ways to connect with the team:

Let us know what would you like to see in DeltaSpike!