Java CDI | CanDI – Java Injection (JSR-299) for Resin

The Resin 4 core and configuration is built around the Java EE standard CDI dependency injection. Every Resin configuration from the resin.xml to resin-web.xml uses CDI as its configuration engine. CanDI is Resin’s implementation of Java CDI and it is core to Resin 4 Java Application Server.

With CanDI, your own applications can be clearly structured for testing, development, and maintenance as encouraged by the clean design CDI encourages.

The CDI community-designed extensions have become a key shared resource for Java developers, reusing design patterns created by other developers solving the same problems.

The custom, typesafe binding annotations are key to CDI’s self-documentation, because injection points clearly describe the resources or services they expect with adjective-oriented annotations. The annotations are true Java classes; they are documented in JavaDoc and verified by the compiler. Because the binding annotations are a small number of meaningful adjectives, they don’t impose a significant coding burden, and are well worth the small extra development time.


  • standard: JavaEE Web Profile standard ensures compatibility between implementations, frameworks, applications, and IDEs.
  • compact: the standards process keeps CDI well-defined, complete and compact.
  • safe: compiler type-safe checking validates code correctness.
  • clean: annotation processing keeps code focused and configuration tidy.
  • flexible: minimal XML focuses on needed configuration, leaving boilerplate connections for auto-injection.
  • powerful: interceptors, decorators and a typed event system fill out a complete feature set.
  • extensible: standard extension framework gives library developers the space to experiment with features.

Learn more about CanDI and Java CDI

Documentation

Whitepapers

Benefits and Features

Self-Documenting Injection

  • Describes dependencies with custom annotation bindings.
  • Type-safe, application-centric bindings.
  • Discovers services and components with automatic classpath scanning.
  • Integrates with JSP and JSF expressions @Named annotations.
  • Supports advanced interception and event handling.

Lightweight XML

  • Needed only for customization; default wiring doesn’t need XML
  • Type-safe, customizable XML, using namespaces to map Java packages to tags
  • Powerful configuration of Java instances, including sub-bean configuration
  • Used by Resin for all Resin configuration

JavaEE Integration

  • Usable from servlets, filters, EJBs, and JSF managed beans
  • Integrated with JavaEE scopes (session, request, application)
  • Deploy managed beans through servlet WEB-INF and JavaEE-visible jars
  • Cross-fertilized aspects from EJBs: transactions, interception, security, locking

Service Centered Design

  • Centralized registration and lookup.
  • Uniform lifecycle management.
  • Self-documented service declaration and binding.
  • Automatic discovery and wiring.