Presentation Notes: TriJUG April 18, 2011

Presentation outline and notes/references for my  Traiangle Java User’s Group presentation given on April 18, 2011.  The slides used during the presentation are merely an instrument for me as the presenter; they aren’t available for download.  Below is the rough outline I (kinda) followed and at the bottom are references and helpful links.  Feel free to leave any and all candid feedback in the comments.  Thanks for attending!

Modern Web Component Development with Java EE6 and Arquillian

Outline

  • About Me
    • Chris Bredesen  – Product Manager, Red Hat Customer Portal
  • Agenda
    • Brief History
    • CDI
    • Arquillian
    • Anatomy of an EE6 application
    • Informal audience survey – Spring / Seam / EE 5/6 usage?
  • J2EE 1.4
    • InitialContext ctx = …..
    • No DI; JNDI gave us a registry
    • Clients look up what’s needed (“traditional” control structure)
  • Java EE 5
    • Limited (but well-defined!) component types…
    • @Stateless / Stateful
    • …that can be injected into other EE 5 components
    • @EJB
    • @Resource
    • @PersistenceContext
  • Seam 1.x & 2.x
    • Leverages EE rather than sidestepping it
      • Introduced what was to become the CDI “programming model”
      • Somewhat tightly coupled with JSF 1 & a web container
      • Annotation-based component declaration
      • Events
      • Stateful/Conversational model that optionally uses EJB3
    • Rich web framework
      • MVC (both pull- and push-style)
      • Security
      • Persistence
      • Localization
      • Greatly improves JSF’s navigation rules (far less verbose and limited)
      • Bookmarkable URL’s / GET support
    • Built-in integration with Drools, RESTEasy, etc
  • Java EE6
    • Robust, flexible DI via CDI
    • EJB 3.1 (no-interface views, finally!)
    • JAX-RS  – Profiles (web, EE)
  • CDI Overview
    • Standarization and improvement of the Seam component model + Guice)
    • @Inject (aligned with JSR-330)
    • @Named
    • @Produces
    • @RequestScoped
  • CDI Overview (cont’d)
    • Contexts
      • @ApplicationScoped
      • @SessionScoped
      • @ConversationScoped
      • @RequestScoped
      • @[Anything]Scoped – pluggable contexts!
        • @ThreadScoped – via ThreadLocal
        • @CacheScoped – via Cache impl
    • Lifecycle
      • Robust scoping requires robust lifecycle management
      • Callbacks
      • Managed instances that end when the scope does
    • Events
      • Bridgeable to JMS
    • Well-defined SPI for creating portable extensions
  • CDI Overview (cont’d)
    • Seam was too many things
    • CDI is a core framework & programming model
    • Web toolkits can be built on top of CDI via portable extensions
  • CDI Overview (cont’d)
    • Stereotypes help group common sets of annotations
  • JSF2 adds many features that Seam had
    • Page level metadata/navigation <f:metadata>
    • EL integration with CDI
    • Better GET support
  • Cross-container testing  – Arquillian  – ShrinkWrap
  • Anatomy of an EE 6 Application

Tools Used

  • JBoss AS 6.0 Final
  • Eclipse for Java EE developers 3.6 SR2
  • JBoss Tools 3.2
  • m2eclipse 0.12 (make sure to install WTP support!)
  • Maven 3.0.3

References & Other Reading Material