SlideShare a Scribd company logo
1 of 76
Download to read offline
JSR-299 (CDI), Weld and
the Future of Seam



Dan Allen
Principal Software Engineer
JBoss by Red Hat
Agenda

    ●   Java EE today
    ●   Where JSR-299 fits in
    ●   JSR-299 themes
    ●   CDI programming model tour
    ●   CDI extensions
    ●   Weld
    ●   Seam 3




2                   JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Technology terminology

    ●   JSR-299 (CDI)
        ●   Contexts & Dependency Injection for the
            Java EE Platform
    ●   Weld
        ●   JSR-299 Reference Implementation & TCK
        ●   Extended CDI support (Servlets, Java SE)
        ●   Portable CDI enhancements for extension writers
    ●   Seam 3
        ●   Portable extensions for Java EE
        ●   Portable integrations with non-Java EE technologies

3                      JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
What is Java EE?

    ●   Standard platform comprised of
        managed components & services



    ●   Business logic as components
         1. Less code
         2. Higher signal-to-noise ratio
         3. Powerful mechanisms for free
         4. Portable knowledge


4                       JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Why reinvest?
                                                              Java EE 5




5
    Seam 2   JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Stated goal of JSR-299




                Web tier                     Transactional tier
                 (JSF)                            (EJB)

6            JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
What CDI provides

    ●   Services for Java EE components
         ●   Lifecycle management of stateful beans bound to
             well-defined contexts (including conversation context)
         ●   A type-safe approach to dependency injection
         ●   Interaction via an event notification facility
         ●   Reduced coupling between interceptors and beans
         ●   Decorators, which intercept specific bean instances
         ●   Unified EL integration (bean names)
    ●   SPI for developing extensions for the Java EE platform
         ●   Java EE architecture  flexible, portable, extensible

7                        JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
What CDI provides

    ●   Services for Java EE components
         ●   Lifecycle management of stateful beans bound to
             well-defined contexts (including conversation context)
         ●   A type-safe approach to dependency injection
         ●   Interaction via an event notification facility
         ●   Reduced coupling between interceptors and beans
         ●   Decorators, which intercept specific bean instances
         ●   Unified EL integration (bean names)
    ●   SPI for developing extensions for the Java EE platform
         ●   Java EE architecture  flexible, portable, extensible

8                        JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
CDI: The big picture

    ●   Fill in
    ●   Catalyze
    ●   Evolve




9                  JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Why dependency injection?

     ●   Weakest aspect of Java EE 5
     ●   Closed set of injectable resources
          ●   @EJB
          ●   @PersistenceContext, @PersistenceUnit
          ●   @Resource (e.g., DataSource, UserTransaction)
     ●   Name-based injection is fragile
     ●   Lacked rules




10                      JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Leverage and extend Java’s type system



     @Annotation                                   <TypeParam>



          This information is pretty useful!



                                Type


11            JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
JSR-299 theme



                                                       @Produces @WishList
 Loose coupling...                                     List<Product> getWishList()

                                                                      Event<Order>
               @InterceptorBinding
     @Inject                                           @UserDatabase EntityManager
                   @Observes
      @Qualifier                                             ...with strong typing




12                   JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Loose coupling

     ●
         Decouple server and client
          ●   Using well-defined types and “qualifiers”
          ●   Allows server implementation to vary
     ●
         Decouple lifecycle of collaborating components
          ●   Automatic contextual lifecycle management
          ●   Stateful components interact like services
     ●
         Decouple orthogonal concerns (AOP)
          ●   Interceptors & decorators
     ●
         Decouple message producer from consumer
          ●   Events
13                       JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Strong typing

     ●   Type-based injection
          ●   Eliminate reliance on string-based names
          ●   Refactor friendly
     ●   Compiler can detect typing errors
          ●   No special authoring tools required
          ●   Casting mostly eliminated
     ●   Semantic code errors detected at application startup
     ●   Tooling can detect ambiguous dependencies (optional)



14                       JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Who's bean is it anyway?

     ●   Everyone throwing around this term “bean”
          ●   JSF
          ●   EJB
          ●   Seam
          ●   Spring
          ●   Guice
          ●   Web Beans
     ●   Need a “unified bean definition”




15                     JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Managed bean specification

     ●   Common bean definition
     ●   Instances managed by                                              Managed
         the container                                                      Beans


     ●   Common services
         ●   Lifecycle callbacks
         ●   Resource injections
         ●   Interceptors                                JSF           EJB         CDI   JAX-RS

     ●   Foundation spec


     How managed beans evolved: http://www.infoq.com/news/2009/11/weld10
16                        JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
CDI bean ingredients

     ●   Set of bean types
     ●   Set of qualifiers
     ●   Scope
     ●   Bean EL name (optional)
     ●   Set of interceptor bindings
     ●   Alternative classification
     ●   Bean implementation class

                                 Auto-discovered!


17                     JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Welcome to CDI, managed beans!

 public class Welcome {
    public String buildPhrase(String city) {
       return "Welcome to " + city + "!";
    }
 }




18               JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Welcome to CDI, EJB 3.1 session beans!

 @Stateless public class Welcome {
    public String buildPhrase(String city) {
       return "Welcome to " + city + "!";
    }
 }




19               JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
When is a bean recognized?

     ●   Bean archive (WAR)                       ●   Bean archive (JAR)




                      beans.xml can be empty!




20                  JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Injection 101

 public class Greeter {
    @Inject Welcome w;

     public void welcome() {
        System.out.println(
           w.buildPhrase("San Francisco"));
     }
 }




21                JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Where can it be injected?

     ●   Field
     ●   Method parameter
          ●   Constructor*
          ●   Initializer
          ●   Producer
          ●   Observer




22                          JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
What can be injected?

     Managed bean

     Object returned by producer

     EJB session bean (local or remote)

     Java EE resource (DataSource, JMS destination, etc)

     JTA UserTransaction

     Persistence unit or context

     Security principle

     Bean Validation factory

     Web service reference

     Additional resources introduced through SPI


23                             JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
The bean vs “the other implementation”

     ●   Multiple implementations of same interface
     ●   One implementation extends another
 public class Welcome {
    public String buildPhrase(String city) {
       return "Welcome to " + city + "!";
    }
 }

 public class TranslatingWelcome extends Welcome {

         @Inject GoogleTranslator translator;

         public String buildPhrase(String city) {
            return translator.translate(
               "Welcome to " + city + "!");
         }
 }
24                    JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Quiz: Which implementation gets injected?

 public class Greeter {
    private Welcome welcome;

     @Inject
     void init(Welcome welcome) {
        this.welcome = welcome;
     }

     ...
 }



                              It's ambiguous!




25                JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Working out an ambiguous resolution

     ●   Qualifier
     ●   Alternative
     ●   Producer
     ●   Veto (or hide)




26                     JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
qualifier

     n. an annotation used to resolve an API
     implementation variant at an injection point




27        JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Defining a qualifier

 @Qualifier
 @Retention(RUNTIME)
 @Target({TYPE, METHOD, FIELD, PARAMETER})
 public @interface Translating {}


              @interface means annotation
              @interface means annotation




28               JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Qualifying an implementation

 @Translating
 public class TranslatingWelcome extends Welcome {

     @Inject GoogleTranslator translator;

     public String buildPhrase(String city) {
        return translator.translate(
           "Welcome to " + city + "!");
     }
 }

     ●   makes type more specific
     ●   assigns semantic meaning




29                 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Qualifier as a “binding type”




30            JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Explicitly request qualified interface

 public class Greeter {
     private Welcome welcome;                 No reference to implementation class!
                                              No reference to implementation class!
     @Inject
     void init(@Translating Welcome welcome) {
        this.welcome = welcome;
     }

     public void welcomeVisitors() {
        System.out.println(
           welcome.buildPhrase("San Francisco"));
     }
 }




31                JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Alternative bean

     ●   Swap replacement implementation per deployment
     ●   Replaces bean and its producer methods and fields
     ●   Disabled by default
          ●   Must be activated in /META-INF/beans.xml


 In other words, an override




32                      JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Defining an alternative

 @Alternative
 public class TranslatingWelcome extends Welcome {

     @Inject GoogleTranslator translator;

     public String buildPhrase(String city) {
        return translator.translate(
           "Welcome to " + city + "!");
     }
 }




33                JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Substituting the alternative

     ●   Activated using beans.xml
 <beans>
   <alternatives>
     <class>com.acme.TranslatingWelcome</class>
   </alternatives>
 </beans>




34                   JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Assigning a bean (EL) name

 @Named("greeter")
 public class Greeter {
    private Welcome welcome;

     @Inject
     void init(Welcome welcome) {
        this.welcome = welcome;
     }

     public void welcomeVisitors() {
        System.out.println(
           welcome.buildPhrase("San Francisco"));
     }
 }




35                JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Assigning a bean (EL) name by convention

 @Named
 public class Greeter {
    private Welcome welcome;                     Bean name is decapitalized
                                                 Bean name is decapitalized
                                                 simple class name
                                                 simple class name
     @Inject
     void init(Welcome welcome) {
        this.welcome = welcome;
     }

     public void welcomeVisitors() {
        System.out.println(
           welcome.buildPhrase("San Francisco"));
     }
 }




36                JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Welcome to CDI, JSF!

     ●   Use the bean directly in the JSF view
 <h:form>
    <h:commandButton value="Welcome visitors"
       action="#{greeter.welcomeVisitors}"/>
 </h:form>




37                    JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
JSF
                  managed
                   beans



                          CDI


38   JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Stashing the bean in a context

     ●   Bean saved for the duration of a request
 @Named
 @RequestScoped
 public class Greeter {
    @Inject private Welcome w;
    private String city;

         public String getCity() { return city; }

         public void setCity(String city) {
            this.city = city;
         }

         public void welcomeVisitors() {
            System.out.println(w.buildPhrase(city));
         }
 }

39                    JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Collapsing layers with state management

     ●   Now it’s possible for bean to hold state
 <h:form>
    <h:inputText value="#{greeter.city}"/>
    <h:commandButton value="Welcome visitors"
       action="#{greeter.welcomeVisitors}"/>
 </h:form>



     San Francisco




 Prints:
 Welcome to San Francisco!


40                     JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Mission accomplished: We have a deal!




                Web tier                        Business tier
                 (JSF)                        (managed bean)

41           JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Scope types and contexts

     ●   Default scope - @Dependent
          ●   Bound to lifecycle of bean holding reference
     ●   Servlet scopes
          ●   @ApplicationScoped
          ●   @RequestScoped
          ●   @SessionScoped
     ●   JSF conversation scope - @ConversationScoped
     ●   Custom scopes
          ●   Define scope type annotation (e.g., @FlashScoped)
          ●   Implement the context API in an extension
42                       JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Scope transparency

     ●   Scopes not visible to client (no coupling)
     ●   Scoped beans are proxied for thread safety




43                     JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Conversation context

     ●   Request ≤ Conversation ≪ Session


     ●




     ●   Boundaries demarcated by application


     ●   Optimistic transaction
          ●   Conversation-scoped persistence context
          ●   No fear of exceptions on lazy fetch operations

44                       JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Controlling the conversation

 @ConversationScoped
 public class BookingAgent {

     @Inject @BookingDatabase EntityManager em;
     @Inject Conversation conversation;

     private Hotel selected;
     private Booking booking;

     public void select(Hotel h) {
        selected = em.find(Hotel.class, h.getId());
        conversation.begin();
     }

     ...




45                JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Controlling the conversation

     ...

     public boolean confirm() {
        if (!isValid()) {
           return false;
        }

         em.persist(booking);
         conversation.end();
         return true;
     }
 }




46                 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
producer method

     n. a method whose return value produces
     an injectable object




47        JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Producer method examples

 @Produces @RequestScoped
 public FacesContext getFacesContext() {                                   From non-bean
                                                                           From non-bean
    return FacesContext.getInstance();
 }

 @Produces
 public PaymentProcessor getPaymentProcessor(
       @Synchronous PaymentProcessor sync,
                                               Runtime selection
                                               Runtime selection
       @Asynchronous PaymentProcessor async) {
    return isSynchronous() ? sync : async;
 }

 @Produces @SessionScoped @WishList            Dynamic result set
                                                Dynamic result set
 public List<Product> getWishList() {
    return em.createQuery("...").getResultList();
 }




48                JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Injecting producer return values

 @Inject FacesContext ctx;

 @Inject PaymentProcessor pp;

 @Inject @WishList List<Product> wishlist;



         Origin of product is hidden at injection point




49               JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Bridging Java EE resources

     ●   Use producer field to expose Java EE resource
 @Stateless
 public class UserEntityManagerProducer {
    @Produces @UserRepository
    @PersistenceContext(unitName = "users")
    EntityManager em;
 }

 @Stateless
 public class PricesTopicProducer {
    @Produces @Prices
    @Resource(name = "java:global/env/jms/Prices")
    Topic pricesTopic;
 }




50                   JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Injecting resources in type-safe way

     ●   String-based resource names are hidden
 public class UserManager {
    @Inject @UserRepository EntityManager userEm;
    ...
 }

 public class StockDisplay {
    @Inject @Prices Topic pricesTopic;
    ...
 }




51                   JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Rethinking interceptors

 @Interceptors(
    SecurityInterceptor.class,
    TransactionInterceptor.class,
    LoggingInterceptor.class
 )
 @Stateful public class BusinessComponent {
    ...
 }




                      Um, what's the point?




52               JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Define an interceptor binding type

 @InterceptorBinding
 @Retention(RUNTIME)
 @Target({TYPE, METHOD})
 public @interface Secure {}




53               JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Mark the interceptor implementation

 @Secure
 @Interceptor
 public class SecurityInterceptor {

     @AroundInvoke
     public Object aroundInvoke(InvocationContext ctx)
           throws Exception {
        // enforce security...
        ctx.proceed();
     }

 }




54                JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Interceptor wiring with proper semantics

 @Secure
 public class AccountManager {

     public boolean transfer(Account a, Account b) {
        ...
     }

 }




55                JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Enabling and ordering interceptors

     ●   Bean archive has no enabled interceptors by default
     ●   Interceptors activated in beans.xml of bean archive
          ●   Referenced by binding type
          ●   Ordering is per-module
          ●   Declared in module in which the interceptor is used
 <beans>
    <interceptors>
         <class>com.acme.SecurityInterceptor</class>
         <class>com.acme.TransactionInterceptor</class>
    </interceptors>
 </beans>
                                                     Interceptors applied in order listed
                                                     Interceptors applied in order listed



56                       JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Annotation jam!

 @Secure
 @Transactional
 @RequestScoped
 @Named
 public class AccountManager {

     public boolean transfer(Account a, Account b) {
        ...
     }

 }




57                JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
stereotype

     n. an annotation used to group common
     architectural patterns (recurring roles)




58        JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Define a stereotype to bundle annotations

 @Secure
 @Transactional
 @RequestScoped
 @Named
 @Stereotype
 @Retention(RUNTIME)
 @Target(TYPE)
 public @interface BusinessComponent {}




59               JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Using a stereotype

 @BusinessComponent
 public class AccountManager {

     public boolean transfer(Account a, Account b) {
        ...
     }

 }




60                JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Portable extensions

     ●   SPI – Service Provider Interface
     ●   Automatically discovered
     ●   Application-scoped instance
     ●   Observes events from CDI event bus
          ●   Before/after bean discovery
          ●   After deployment validation
          ●   etc...
     ●   Can override, augment, replace or veto beans



61                       JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
62   JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Weld: JSR-299 Reference Implementation

     ●   Implementation & TCK
     ●   Weld (portable) extensions
     ●   Apache software licensed (version 2.0)




63                    JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
64   JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Seam’s mission statement




       To provide a fully integrated development
     platform for building rich Internet applications
         based upon the Java EE environment.




65             JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Seam’s new modular ecosystem




66          JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Portable modules

     ●   Module per domain or integration
     ●   Independently...
          ●   lead
          ●   versioned
          ●   released
     ●   Per-module structure
          ●   Based on CDI
          ●   API & implementation
          ●   Reference documentation & examples


67                        JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Stack releases




68           JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
What's on the menu so far?

     ●   Drools                                        ●   JavaScript remoting
     ●   jBPM                                          ●   Security
     ●   JMS                                           ●   Servlet
     ●   Faces                                         ●   Wicket
     ●   International                                 ●   XML configuration
     ●   Persistence                                   ●   Exception handling
                                                           ...and more
                                                               http://github.com/seam



69                       JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
XML-based configuration

 <beans ...
    xmlns:app="java:urn:com.acme">
    <app:TranslatingWelcome>
       <app:Translating/>
       <app:defaultLocale>en-US</app:defaultLocale>
    </app:TranslatingWelcome>
 </beans>

     ●   Define, specialize or override beans
     ●   Add annotations (qualifiers, interceptor bindings, ...)
     ●   Assign initial property values




70                     JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Cross-field validator in Seam Faces

 @FacesValidator("addressValidator")
 public class AddressValidator implements Validator {

     @Inject   Directory directory;
     @Inject   @InputField String city;
     @Inject   @InputField String state;
     @Inject   @InputField ZipCode zip;

     public void validate(FacesContext ctx, UIComponent c,
           Object v) throws ValidatorException {
        if (!directory.exists(city, state, zip) {
           throw new ValidatorException("Bad address");
        }
     }
 }




71                  JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Wiring the validator to the inputs

 <h:form id="address">
    City: <h:inputText id="city" value="#{bean.city}"/>
    State: <h:inputText id="state" value="#{bean.state}"/>
    Zip: <h:inputText id="zipCode" value="#{bean.zip}"/>
    <h:commandButton value="Update"
       action="#{addressController.update}"/>
    <s:validateForm validatorId="addressValidator"
       fields="zip=zipCode">
 </h:form>




72               JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Arquillian: Container-oriented testing for Java EE
                                                         Throwing complexity over the wall
                                                         Throwing complexity over the wall
     @RunWith(Arquillian.class)
                                                         Wed @ 4:45
                                                         Wed @ 4:45
     public class GreeterTestCase {                      Hilton, Golden Gate 4/5
                                                         Hilton, Golden Gate 4/5
         @Deployment
         public static Archive<?> createDeployment() {
           return ShrinkWrap.create(JavaArchive.class)
             .addClasses(Greeter.class, GreeterBean.class);
         }

         @EJB private Greeter greeter;

         @Test
         public void shouldBeAbleToInvokeEJB() throws Exception {
           assertEquals("Hello, Earthlings", greeter.greet("Earthlings"));
         }
     }

73                           JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Summary

     ●   Java EE 6 is leaner and more productive
     ●   JSR-299 (CDI) provides a set of services for Java EE
          ●   Bridges JSF and EJB
          ●   Offers loose coupling with strong typing
          ●   Provides a type-based event bus
          ●   Catalyzed managed bean & interceptor specifications
          ●   Extensive SPI for third-party integration with Java EE
     ●   Weld: JSR-299 reference implementation & add-ons
     ●   Seam 3: Portable extensions for Java EE


74                       JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
How do I get started?

     ●   Download a Java EE 6 container
          ●   JBoss AS 6 – http://jboss.org/jbossas
          ●   GlassFish V3 – http://glassfish.org
     ●   Generate a Java EE project using a Maven archetype
          ●   http://tinyurl.com/goweld
     ●   Read the Weld reference guide
          ●   http://tinyurl.com/weld-reference-101
     ●   Browse the CDI JavaDoc
          ●   http://docs.jboss.org/cdi/api/latest/
     ●   Check out the Seam 3 project
          ●   http://seamframework.org/Seam3
75                        JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
Q&A


Dan Allen
Principal Software Engineer
JBoss by Red Hat

http://seamframework.org/Weld
http://seamframework.org/Seam3

More Related Content

What's hot

OSGi-enabled Java EE Applications using GlassFish at JCertif 2011
OSGi-enabled Java EE Applications using GlassFish at JCertif 2011OSGi-enabled Java EE Applications using GlassFish at JCertif 2011
OSGi-enabled Java EE Applications using GlassFish at JCertif 2011Arun Gupta
 
PL/SQL Development
PL/SQL DevelopmentPL/SQL Development
PL/SQL DevelopmentThanh Nguyen
 
Running your Java EE applications in the Cloud
Running your Java EE applications in the CloudRunning your Java EE applications in the Cloud
Running your Java EE applications in the CloudArun Gupta
 
GlassFish v3, OSGi Equinox Felix
GlassFish v3, OSGi Equinox FelixGlassFish v3, OSGi Equinox Felix
GlassFish v3, OSGi Equinox FelixLudovic Champenois
 
Why should i switch to Java SE 7
Why should i switch to Java SE 7Why should i switch to Java SE 7
Why should i switch to Java SE 7Vinay H G
 
Glidein startup Internals and Glidein configuration - glideinWMS Training Jan...
Glidein startup Internals and Glidein configuration - glideinWMS Training Jan...Glidein startup Internals and Glidein configuration - glideinWMS Training Jan...
Glidein startup Internals and Glidein configuration - glideinWMS Training Jan...Igor Sfiligoi
 
Cloud Best Practices
Cloud Best PracticesCloud Best Practices
Cloud Best PracticesEric Bottard
 
Running your Java EE 6 applications in the Cloud
Running your Java EE 6 applications in the CloudRunning your Java EE 6 applications in the Cloud
Running your Java EE 6 applications in the CloudArun Gupta
 
Airbus Internship Presentation 2012
Airbus Internship Presentation 2012Airbus Internship Presentation 2012
Airbus Internship Presentation 2012Paveen Juntama
 
The Java EE 7 Platform: Productivity & HTML5 at JavaOne Latin America 2012
The Java EE 7 Platform: Productivity & HTML5 at JavaOne Latin America 2012The Java EE 7 Platform: Productivity & HTML5 at JavaOne Latin America 2012
The Java EE 7 Platform: Productivity & HTML5 at JavaOne Latin America 2012Arun Gupta
 
Tdd and a new paradigm for hardware verification
Tdd and a new paradigm for hardware verificationTdd and a new paradigm for hardware verification
Tdd and a new paradigm for hardware verificationdrewz lin
 
GlassFish & Java EE Business Update @ CEJUG
GlassFish & Java EE Business Update @ CEJUGGlassFish & Java EE Business Update @ CEJUG
GlassFish & Java EE Business Update @ CEJUGArun Gupta
 
Java Summit Chennai: JAX-RS 2.0
Java Summit Chennai: JAX-RS 2.0Java Summit Chennai: JAX-RS 2.0
Java Summit Chennai: JAX-RS 2.0Arun Gupta
 
OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010
OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010
OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010Arun Gupta
 
Adopting Agile Tools & Methods In A Legacy Context
Adopting Agile Tools & Methods In A Legacy ContextAdopting Agile Tools & Methods In A Legacy Context
Adopting Agile Tools & Methods In A Legacy ContextXavier Warzee
 
Modules all the way down: OSGi and the Java Platform Module System
Modules all the way down: OSGi and the Java Platform Module SystemModules all the way down: OSGi and the Java Platform Module System
Modules all the way down: OSGi and the Java Platform Module SystemTim Ellison
 
Quality on Submit
Quality on SubmitQuality on Submit
Quality on SubmitAgileSparks
 

What's hot (20)

OSGi-enabled Java EE Applications using GlassFish at JCertif 2011
OSGi-enabled Java EE Applications using GlassFish at JCertif 2011OSGi-enabled Java EE Applications using GlassFish at JCertif 2011
OSGi-enabled Java EE Applications using GlassFish at JCertif 2011
 
PL/SQL Development
PL/SQL DevelopmentPL/SQL Development
PL/SQL Development
 
Running your Java EE applications in the Cloud
Running your Java EE applications in the CloudRunning your Java EE applications in the Cloud
Running your Java EE applications in the Cloud
 
Dayal rtp q2_07
Dayal rtp q2_07Dayal rtp q2_07
Dayal rtp q2_07
 
Lesson2 software process_contd2
Lesson2 software process_contd2Lesson2 software process_contd2
Lesson2 software process_contd2
 
GlassFish v3, OSGi Equinox Felix
GlassFish v3, OSGi Equinox FelixGlassFish v3, OSGi Equinox Felix
GlassFish v3, OSGi Equinox Felix
 
Why should i switch to Java SE 7
Why should i switch to Java SE 7Why should i switch to Java SE 7
Why should i switch to Java SE 7
 
Glidein startup Internals and Glidein configuration - glideinWMS Training Jan...
Glidein startup Internals and Glidein configuration - glideinWMS Training Jan...Glidein startup Internals and Glidein configuration - glideinWMS Training Jan...
Glidein startup Internals and Glidein configuration - glideinWMS Training Jan...
 
Cloud Best Practices
Cloud Best PracticesCloud Best Practices
Cloud Best Practices
 
Running your Java EE 6 applications in the Cloud
Running your Java EE 6 applications in the CloudRunning your Java EE 6 applications in the Cloud
Running your Java EE 6 applications in the Cloud
 
Airbus Internship Presentation 2012
Airbus Internship Presentation 2012Airbus Internship Presentation 2012
Airbus Internship Presentation 2012
 
Glidein internals
Glidein internalsGlidein internals
Glidein internals
 
The Java EE 7 Platform: Productivity & HTML5 at JavaOne Latin America 2012
The Java EE 7 Platform: Productivity & HTML5 at JavaOne Latin America 2012The Java EE 7 Platform: Productivity & HTML5 at JavaOne Latin America 2012
The Java EE 7 Platform: Productivity & HTML5 at JavaOne Latin America 2012
 
Tdd and a new paradigm for hardware verification
Tdd and a new paradigm for hardware verificationTdd and a new paradigm for hardware verification
Tdd and a new paradigm for hardware verification
 
GlassFish & Java EE Business Update @ CEJUG
GlassFish & Java EE Business Update @ CEJUGGlassFish & Java EE Business Update @ CEJUG
GlassFish & Java EE Business Update @ CEJUG
 
Java Summit Chennai: JAX-RS 2.0
Java Summit Chennai: JAX-RS 2.0Java Summit Chennai: JAX-RS 2.0
Java Summit Chennai: JAX-RS 2.0
 
OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010
OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010
OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010
 
Adopting Agile Tools & Methods In A Legacy Context
Adopting Agile Tools & Methods In A Legacy ContextAdopting Agile Tools & Methods In A Legacy Context
Adopting Agile Tools & Methods In A Legacy Context
 
Modules all the way down: OSGi and the Java Platform Module System
Modules all the way down: OSGi and the Java Platform Module SystemModules all the way down: OSGi and the Java Platform Module System
Modules all the way down: OSGi and the Java Platform Module System
 
Quality on Submit
Quality on SubmitQuality on Submit
Quality on Submit
 

Similar to JSR-299 (CDI), Weld and the Future of Seam: An Introduction to Contexts and Dependency Injection

Gustavo Garnica: Evolución de la Plataforma Java y lo que Significa para Ti
Gustavo Garnica: Evolución de la Plataforma Java y lo que Significa para TiGustavo Garnica: Evolución de la Plataforma Java y lo que Significa para Ti
Gustavo Garnica: Evolución de la Plataforma Java y lo que Significa para TiSoftware Guru
 
Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011Arun Gupta
 
DDD&Scalaで作られたプロダクトはその後どうなったか?(Current state of products made with DDD & Scala)
DDD&Scalaで作られたプロダクトはその後どうなったか?(Current state of products made with DDD & Scala)DDD&Scalaで作られたプロダクトはその後どうなったか?(Current state of products made with DDD & Scala)
DDD&Scalaで作られたプロダクトはその後どうなったか?(Current state of products made with DDD & Scala)MicroAd, Inc.(Engineer)
 
Illia shestakov - The Future of Java JDK #9
Illia shestakov - The Future of Java JDK #9Illia shestakov - The Future of Java JDK #9
Illia shestakov - The Future of Java JDK #9Anna Shymchenko
 
Haj 4344-java se 9 and the application server-1
Haj 4344-java se 9 and the application server-1Haj 4344-java se 9 and the application server-1
Haj 4344-java se 9 and the application server-1Kevin Sutter
 
Revolutionizing the Data Abstraction Layer with IBM Optim pureQuery and DB2
Revolutionizing the Data Abstraction Layer with IBM Optim pureQuery and DB2Revolutionizing the Data Abstraction Layer with IBM Optim pureQuery and DB2
Revolutionizing the Data Abstraction Layer with IBM Optim pureQuery and DB2Vladimir Bacvanski, PhD
 
OTN Developer Days - Java EE 6
OTN Developer Days - Java EE 6OTN Developer Days - Java EE 6
OTN Developer Days - Java EE 6glassfish
 
Rafael Bagmanov «Scala in a wild enterprise»
Rafael Bagmanov «Scala in a wild enterprise»Rafael Bagmanov «Scala in a wild enterprise»
Rafael Bagmanov «Scala in a wild enterprise»e-Legion
 
Java2 MicroEdition-J2ME
Java2 MicroEdition-J2MEJava2 MicroEdition-J2ME
Java2 MicroEdition-J2MERohan Chandane
 
Accelerating Cassandra Workloads on Ceph with All-Flash PCIE SSDS
Accelerating Cassandra Workloads on Ceph with All-Flash PCIE SSDSAccelerating Cassandra Workloads on Ceph with All-Flash PCIE SSDS
Accelerating Cassandra Workloads on Ceph with All-Flash PCIE SSDSCeph Community
 
Amazon DocumentDB vs MongoDB 의 내부 아키텍쳐 와 장단점 비교
Amazon DocumentDB vs MongoDB 의 내부 아키텍쳐 와 장단점 비교Amazon DocumentDB vs MongoDB 의 내부 아키텍쳐 와 장단점 비교
Amazon DocumentDB vs MongoDB 의 내부 아키텍쳐 와 장단점 비교Amazon Web Services Korea
 
Spark SQL Adaptive Execution Unleashes The Power of Cluster in Large Scale wi...
Spark SQL Adaptive Execution Unleashes The Power of Cluster in Large Scale wi...Spark SQL Adaptive Execution Unleashes The Power of Cluster in Large Scale wi...
Spark SQL Adaptive Execution Unleashes The Power of Cluster in Large Scale wi...Databricks
 
MongoDB for Java Developers with Spring Data
MongoDB for Java Developers with Spring DataMongoDB for Java Developers with Spring Data
MongoDB for Java Developers with Spring DataChris Richardson
 
Groovy In the Cloud
Groovy In the CloudGroovy In the Cloud
Groovy In the CloudJim Driscoll
 
Java 40 versions_sgp
Java 40 versions_sgpJava 40 versions_sgp
Java 40 versions_sgpmichaelisvy
 
RenderMan*: The Role of Open Shading Language (OSL) with Intel® Advanced Vect...
RenderMan*: The Role of Open Shading Language (OSL) with Intel® Advanced Vect...RenderMan*: The Role of Open Shading Language (OSL) with Intel® Advanced Vect...
RenderMan*: The Role of Open Shading Language (OSL) with Intel® Advanced Vect...Intel® Software
 
Spring - CDI Interop
Spring - CDI InteropSpring - CDI Interop
Spring - CDI InteropRay Ploski
 
Running your Java EE 6 Apps in the Cloud - JavaOne India 2011
Running your Java EE 6 Apps in the Cloud - JavaOne India 2011Running your Java EE 6 Apps in the Cloud - JavaOne India 2011
Running your Java EE 6 Apps in the Cloud - JavaOne India 2011Arun Gupta
 

Similar to JSR-299 (CDI), Weld and the Future of Seam: An Introduction to Contexts and Dependency Injection (20)

Gustavo Garnica: Evolución de la Plataforma Java y lo que Significa para Ti
Gustavo Garnica: Evolución de la Plataforma Java y lo que Significa para TiGustavo Garnica: Evolución de la Plataforma Java y lo que Significa para Ti
Gustavo Garnica: Evolución de la Plataforma Java y lo que Significa para Ti
 
Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011
 
DDD&Scalaで作られたプロダクトはその後どうなったか?(Current state of products made with DDD & Scala)
DDD&Scalaで作られたプロダクトはその後どうなったか?(Current state of products made with DDD & Scala)DDD&Scalaで作られたプロダクトはその後どうなったか?(Current state of products made with DDD & Scala)
DDD&Scalaで作られたプロダクトはその後どうなったか?(Current state of products made with DDD & Scala)
 
Illia shestakov - The Future of Java JDK #9
Illia shestakov - The Future of Java JDK #9Illia shestakov - The Future of Java JDK #9
Illia shestakov - The Future of Java JDK #9
 
Haj 4344-java se 9 and the application server-1
Haj 4344-java se 9 and the application server-1Haj 4344-java se 9 and the application server-1
Haj 4344-java se 9 and the application server-1
 
Revolutionizing the Data Abstraction Layer with IBM Optim pureQuery and DB2
Revolutionizing the Data Abstraction Layer with IBM Optim pureQuery and DB2Revolutionizing the Data Abstraction Layer with IBM Optim pureQuery and DB2
Revolutionizing the Data Abstraction Layer with IBM Optim pureQuery and DB2
 
OTN Developer Days - Java EE 6
OTN Developer Days - Java EE 6OTN Developer Days - Java EE 6
OTN Developer Days - Java EE 6
 
Rafael Bagmanov «Scala in a wild enterprise»
Rafael Bagmanov «Scala in a wild enterprise»Rafael Bagmanov «Scala in a wild enterprise»
Rafael Bagmanov «Scala in a wild enterprise»
 
Java2 MicroEdition-J2ME
Java2 MicroEdition-J2MEJava2 MicroEdition-J2ME
Java2 MicroEdition-J2ME
 
Accelerating Cassandra Workloads on Ceph with All-Flash PCIE SSDS
Accelerating Cassandra Workloads on Ceph with All-Flash PCIE SSDSAccelerating Cassandra Workloads on Ceph with All-Flash PCIE SSDS
Accelerating Cassandra Workloads on Ceph with All-Flash PCIE SSDS
 
Icsm11a.ppt
Icsm11a.pptIcsm11a.ppt
Icsm11a.ppt
 
Amazon DocumentDB vs MongoDB 의 내부 아키텍쳐 와 장단점 비교
Amazon DocumentDB vs MongoDB 의 내부 아키텍쳐 와 장단점 비교Amazon DocumentDB vs MongoDB 의 내부 아키텍쳐 와 장단점 비교
Amazon DocumentDB vs MongoDB 의 내부 아키텍쳐 와 장단점 비교
 
Spark SQL Adaptive Execution Unleashes The Power of Cluster in Large Scale wi...
Spark SQL Adaptive Execution Unleashes The Power of Cluster in Large Scale wi...Spark SQL Adaptive Execution Unleashes The Power of Cluster in Large Scale wi...
Spark SQL Adaptive Execution Unleashes The Power of Cluster in Large Scale wi...
 
MongoDB for Java Developers with Spring Data
MongoDB for Java Developers with Spring DataMongoDB for Java Developers with Spring Data
MongoDB for Java Developers with Spring Data
 
Groovy In the Cloud
Groovy In the CloudGroovy In the Cloud
Groovy In the Cloud
 
Grails 101
Grails 101Grails 101
Grails 101
 
Java 40 versions_sgp
Java 40 versions_sgpJava 40 versions_sgp
Java 40 versions_sgp
 
RenderMan*: The Role of Open Shading Language (OSL) with Intel® Advanced Vect...
RenderMan*: The Role of Open Shading Language (OSL) with Intel® Advanced Vect...RenderMan*: The Role of Open Shading Language (OSL) with Intel® Advanced Vect...
RenderMan*: The Role of Open Shading Language (OSL) with Intel® Advanced Vect...
 
Spring - CDI Interop
Spring - CDI InteropSpring - CDI Interop
Spring - CDI Interop
 
Running your Java EE 6 Apps in the Cloud - JavaOne India 2011
Running your Java EE 6 Apps in the Cloud - JavaOne India 2011Running your Java EE 6 Apps in the Cloud - JavaOne India 2011
Running your Java EE 6 Apps in the Cloud - JavaOne India 2011
 

Recently uploaded

TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 

Recently uploaded (20)

TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 

JSR-299 (CDI), Weld and the Future of Seam: An Introduction to Contexts and Dependency Injection

  • 1. JSR-299 (CDI), Weld and the Future of Seam Dan Allen Principal Software Engineer JBoss by Red Hat
  • 2. Agenda ● Java EE today ● Where JSR-299 fits in ● JSR-299 themes ● CDI programming model tour ● CDI extensions ● Weld ● Seam 3 2 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 3. Technology terminology ● JSR-299 (CDI) ● Contexts & Dependency Injection for the Java EE Platform ● Weld ● JSR-299 Reference Implementation & TCK ● Extended CDI support (Servlets, Java SE) ● Portable CDI enhancements for extension writers ● Seam 3 ● Portable extensions for Java EE ● Portable integrations with non-Java EE technologies 3 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 4. What is Java EE? ● Standard platform comprised of managed components & services ● Business logic as components 1. Less code 2. Higher signal-to-noise ratio 3. Powerful mechanisms for free 4. Portable knowledge 4 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 5. Why reinvest? Java EE 5 5 Seam 2 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 6. Stated goal of JSR-299 Web tier Transactional tier (JSF) (EJB) 6 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 7. What CDI provides ● Services for Java EE components ● Lifecycle management of stateful beans bound to well-defined contexts (including conversation context) ● A type-safe approach to dependency injection ● Interaction via an event notification facility ● Reduced coupling between interceptors and beans ● Decorators, which intercept specific bean instances ● Unified EL integration (bean names) ● SPI for developing extensions for the Java EE platform ● Java EE architecture  flexible, portable, extensible 7 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 8. What CDI provides ● Services for Java EE components ● Lifecycle management of stateful beans bound to well-defined contexts (including conversation context) ● A type-safe approach to dependency injection ● Interaction via an event notification facility ● Reduced coupling between interceptors and beans ● Decorators, which intercept specific bean instances ● Unified EL integration (bean names) ● SPI for developing extensions for the Java EE platform ● Java EE architecture  flexible, portable, extensible 8 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 9. CDI: The big picture ● Fill in ● Catalyze ● Evolve 9 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 10. Why dependency injection? ● Weakest aspect of Java EE 5 ● Closed set of injectable resources ● @EJB ● @PersistenceContext, @PersistenceUnit ● @Resource (e.g., DataSource, UserTransaction) ● Name-based injection is fragile ● Lacked rules 10 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 11. Leverage and extend Java’s type system @Annotation <TypeParam> This information is pretty useful! Type 11 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 12. JSR-299 theme @Produces @WishList Loose coupling... List<Product> getWishList() Event<Order> @InterceptorBinding @Inject @UserDatabase EntityManager @Observes @Qualifier ...with strong typing 12 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 13. Loose coupling ● Decouple server and client ● Using well-defined types and “qualifiers” ● Allows server implementation to vary ● Decouple lifecycle of collaborating components ● Automatic contextual lifecycle management ● Stateful components interact like services ● Decouple orthogonal concerns (AOP) ● Interceptors & decorators ● Decouple message producer from consumer ● Events 13 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 14. Strong typing ● Type-based injection ● Eliminate reliance on string-based names ● Refactor friendly ● Compiler can detect typing errors ● No special authoring tools required ● Casting mostly eliminated ● Semantic code errors detected at application startup ● Tooling can detect ambiguous dependencies (optional) 14 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 15. Who's bean is it anyway? ● Everyone throwing around this term “bean” ● JSF ● EJB ● Seam ● Spring ● Guice ● Web Beans ● Need a “unified bean definition” 15 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 16. Managed bean specification ● Common bean definition ● Instances managed by Managed the container Beans ● Common services ● Lifecycle callbacks ● Resource injections ● Interceptors JSF EJB CDI JAX-RS ● Foundation spec How managed beans evolved: http://www.infoq.com/news/2009/11/weld10 16 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 17. CDI bean ingredients ● Set of bean types ● Set of qualifiers ● Scope ● Bean EL name (optional) ● Set of interceptor bindings ● Alternative classification ● Bean implementation class Auto-discovered! 17 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 18. Welcome to CDI, managed beans! public class Welcome { public String buildPhrase(String city) { return "Welcome to " + city + "!"; } } 18 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 19. Welcome to CDI, EJB 3.1 session beans! @Stateless public class Welcome { public String buildPhrase(String city) { return "Welcome to " + city + "!"; } } 19 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 20. When is a bean recognized? ● Bean archive (WAR) ● Bean archive (JAR) beans.xml can be empty! 20 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 21. Injection 101 public class Greeter { @Inject Welcome w; public void welcome() { System.out.println( w.buildPhrase("San Francisco")); } } 21 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 22. Where can it be injected? ● Field ● Method parameter ● Constructor* ● Initializer ● Producer ● Observer 22 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 23. What can be injected? Managed bean Object returned by producer EJB session bean (local or remote) Java EE resource (DataSource, JMS destination, etc) JTA UserTransaction Persistence unit or context Security principle Bean Validation factory Web service reference Additional resources introduced through SPI 23 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 24. The bean vs “the other implementation” ● Multiple implementations of same interface ● One implementation extends another public class Welcome { public String buildPhrase(String city) { return "Welcome to " + city + "!"; } } public class TranslatingWelcome extends Welcome { @Inject GoogleTranslator translator; public String buildPhrase(String city) { return translator.translate( "Welcome to " + city + "!"); } } 24 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 25. Quiz: Which implementation gets injected? public class Greeter { private Welcome welcome; @Inject void init(Welcome welcome) { this.welcome = welcome; } ... } It's ambiguous! 25 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 26. Working out an ambiguous resolution ● Qualifier ● Alternative ● Producer ● Veto (or hide) 26 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 27. qualifier n. an annotation used to resolve an API implementation variant at an injection point 27 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 28. Defining a qualifier @Qualifier @Retention(RUNTIME) @Target({TYPE, METHOD, FIELD, PARAMETER}) public @interface Translating {} @interface means annotation @interface means annotation 28 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 29. Qualifying an implementation @Translating public class TranslatingWelcome extends Welcome { @Inject GoogleTranslator translator; public String buildPhrase(String city) { return translator.translate( "Welcome to " + city + "!"); } } ● makes type more specific ● assigns semantic meaning 29 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 30. Qualifier as a “binding type” 30 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 31. Explicitly request qualified interface public class Greeter { private Welcome welcome; No reference to implementation class! No reference to implementation class! @Inject void init(@Translating Welcome welcome) { this.welcome = welcome; } public void welcomeVisitors() { System.out.println( welcome.buildPhrase("San Francisco")); } } 31 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 32. Alternative bean ● Swap replacement implementation per deployment ● Replaces bean and its producer methods and fields ● Disabled by default ● Must be activated in /META-INF/beans.xml In other words, an override 32 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 33. Defining an alternative @Alternative public class TranslatingWelcome extends Welcome { @Inject GoogleTranslator translator; public String buildPhrase(String city) { return translator.translate( "Welcome to " + city + "!"); } } 33 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 34. Substituting the alternative ● Activated using beans.xml <beans> <alternatives> <class>com.acme.TranslatingWelcome</class> </alternatives> </beans> 34 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 35. Assigning a bean (EL) name @Named("greeter") public class Greeter { private Welcome welcome; @Inject void init(Welcome welcome) { this.welcome = welcome; } public void welcomeVisitors() { System.out.println( welcome.buildPhrase("San Francisco")); } } 35 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 36. Assigning a bean (EL) name by convention @Named public class Greeter { private Welcome welcome; Bean name is decapitalized Bean name is decapitalized simple class name simple class name @Inject void init(Welcome welcome) { this.welcome = welcome; } public void welcomeVisitors() { System.out.println( welcome.buildPhrase("San Francisco")); } } 36 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 37. Welcome to CDI, JSF! ● Use the bean directly in the JSF view <h:form> <h:commandButton value="Welcome visitors" action="#{greeter.welcomeVisitors}"/> </h:form> 37 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 38. JSF managed beans CDI 38 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 39. Stashing the bean in a context ● Bean saved for the duration of a request @Named @RequestScoped public class Greeter { @Inject private Welcome w; private String city; public String getCity() { return city; } public void setCity(String city) { this.city = city; } public void welcomeVisitors() { System.out.println(w.buildPhrase(city)); } } 39 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 40. Collapsing layers with state management ● Now it’s possible for bean to hold state <h:form> <h:inputText value="#{greeter.city}"/> <h:commandButton value="Welcome visitors" action="#{greeter.welcomeVisitors}"/> </h:form> San Francisco Prints: Welcome to San Francisco! 40 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 41. Mission accomplished: We have a deal! Web tier Business tier (JSF) (managed bean) 41 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 42. Scope types and contexts ● Default scope - @Dependent ● Bound to lifecycle of bean holding reference ● Servlet scopes ● @ApplicationScoped ● @RequestScoped ● @SessionScoped ● JSF conversation scope - @ConversationScoped ● Custom scopes ● Define scope type annotation (e.g., @FlashScoped) ● Implement the context API in an extension 42 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 43. Scope transparency ● Scopes not visible to client (no coupling) ● Scoped beans are proxied for thread safety 43 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 44. Conversation context ● Request ≤ Conversation ≪ Session ● ● Boundaries demarcated by application ● Optimistic transaction ● Conversation-scoped persistence context ● No fear of exceptions on lazy fetch operations 44 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 45. Controlling the conversation @ConversationScoped public class BookingAgent { @Inject @BookingDatabase EntityManager em; @Inject Conversation conversation; private Hotel selected; private Booking booking; public void select(Hotel h) { selected = em.find(Hotel.class, h.getId()); conversation.begin(); } ... 45 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 46. Controlling the conversation ... public boolean confirm() { if (!isValid()) { return false; } em.persist(booking); conversation.end(); return true; } } 46 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 47. producer method n. a method whose return value produces an injectable object 47 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 48. Producer method examples @Produces @RequestScoped public FacesContext getFacesContext() { From non-bean From non-bean return FacesContext.getInstance(); } @Produces public PaymentProcessor getPaymentProcessor( @Synchronous PaymentProcessor sync, Runtime selection Runtime selection @Asynchronous PaymentProcessor async) { return isSynchronous() ? sync : async; } @Produces @SessionScoped @WishList Dynamic result set Dynamic result set public List<Product> getWishList() { return em.createQuery("...").getResultList(); } 48 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 49. Injecting producer return values @Inject FacesContext ctx; @Inject PaymentProcessor pp; @Inject @WishList List<Product> wishlist; Origin of product is hidden at injection point 49 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 50. Bridging Java EE resources ● Use producer field to expose Java EE resource @Stateless public class UserEntityManagerProducer { @Produces @UserRepository @PersistenceContext(unitName = "users") EntityManager em; } @Stateless public class PricesTopicProducer { @Produces @Prices @Resource(name = "java:global/env/jms/Prices") Topic pricesTopic; } 50 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 51. Injecting resources in type-safe way ● String-based resource names are hidden public class UserManager { @Inject @UserRepository EntityManager userEm; ... } public class StockDisplay { @Inject @Prices Topic pricesTopic; ... } 51 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 52. Rethinking interceptors @Interceptors( SecurityInterceptor.class, TransactionInterceptor.class, LoggingInterceptor.class ) @Stateful public class BusinessComponent { ... } Um, what's the point? 52 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 53. Define an interceptor binding type @InterceptorBinding @Retention(RUNTIME) @Target({TYPE, METHOD}) public @interface Secure {} 53 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 54. Mark the interceptor implementation @Secure @Interceptor public class SecurityInterceptor { @AroundInvoke public Object aroundInvoke(InvocationContext ctx) throws Exception { // enforce security... ctx.proceed(); } } 54 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 55. Interceptor wiring with proper semantics @Secure public class AccountManager { public boolean transfer(Account a, Account b) { ... } } 55 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 56. Enabling and ordering interceptors ● Bean archive has no enabled interceptors by default ● Interceptors activated in beans.xml of bean archive ● Referenced by binding type ● Ordering is per-module ● Declared in module in which the interceptor is used <beans> <interceptors> <class>com.acme.SecurityInterceptor</class> <class>com.acme.TransactionInterceptor</class> </interceptors> </beans> Interceptors applied in order listed Interceptors applied in order listed 56 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 57. Annotation jam! @Secure @Transactional @RequestScoped @Named public class AccountManager { public boolean transfer(Account a, Account b) { ... } } 57 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 58. stereotype n. an annotation used to group common architectural patterns (recurring roles) 58 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 59. Define a stereotype to bundle annotations @Secure @Transactional @RequestScoped @Named @Stereotype @Retention(RUNTIME) @Target(TYPE) public @interface BusinessComponent {} 59 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 60. Using a stereotype @BusinessComponent public class AccountManager { public boolean transfer(Account a, Account b) { ... } } 60 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 61. Portable extensions ● SPI – Service Provider Interface ● Automatically discovered ● Application-scoped instance ● Observes events from CDI event bus ● Before/after bean discovery ● After deployment validation ● etc... ● Can override, augment, replace or veto beans 61 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 62. 62 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 63. Weld: JSR-299 Reference Implementation ● Implementation & TCK ● Weld (portable) extensions ● Apache software licensed (version 2.0) 63 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 64. 64 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 65. Seam’s mission statement To provide a fully integrated development platform for building rich Internet applications based upon the Java EE environment. 65 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 66. Seam’s new modular ecosystem 66 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 67. Portable modules ● Module per domain or integration ● Independently... ● lead ● versioned ● released ● Per-module structure ● Based on CDI ● API & implementation ● Reference documentation & examples 67 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 68. Stack releases 68 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 69. What's on the menu so far? ● Drools ● JavaScript remoting ● jBPM ● Security ● JMS ● Servlet ● Faces ● Wicket ● International ● XML configuration ● Persistence ● Exception handling ...and more  http://github.com/seam 69 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 70. XML-based configuration <beans ... xmlns:app="java:urn:com.acme"> <app:TranslatingWelcome> <app:Translating/> <app:defaultLocale>en-US</app:defaultLocale> </app:TranslatingWelcome> </beans> ● Define, specialize or override beans ● Add annotations (qualifiers, interceptor bindings, ...) ● Assign initial property values 70 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 71. Cross-field validator in Seam Faces @FacesValidator("addressValidator") public class AddressValidator implements Validator { @Inject Directory directory; @Inject @InputField String city; @Inject @InputField String state; @Inject @InputField ZipCode zip; public void validate(FacesContext ctx, UIComponent c, Object v) throws ValidatorException { if (!directory.exists(city, state, zip) { throw new ValidatorException("Bad address"); } } } 71 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 72. Wiring the validator to the inputs <h:form id="address"> City: <h:inputText id="city" value="#{bean.city}"/> State: <h:inputText id="state" value="#{bean.state}"/> Zip: <h:inputText id="zipCode" value="#{bean.zip}"/> <h:commandButton value="Update" action="#{addressController.update}"/> <s:validateForm validatorId="addressValidator" fields="zip=zipCode"> </h:form> 72 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 73. Arquillian: Container-oriented testing for Java EE Throwing complexity over the wall Throwing complexity over the wall @RunWith(Arquillian.class) Wed @ 4:45 Wed @ 4:45 public class GreeterTestCase { Hilton, Golden Gate 4/5 Hilton, Golden Gate 4/5 @Deployment public static Archive<?> createDeployment() { return ShrinkWrap.create(JavaArchive.class) .addClasses(Greeter.class, GreeterBean.class); } @EJB private Greeter greeter; @Test public void shouldBeAbleToInvokeEJB() throws Exception { assertEquals("Hello, Earthlings", greeter.greet("Earthlings")); } } 73 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 74. Summary ● Java EE 6 is leaner and more productive ● JSR-299 (CDI) provides a set of services for Java EE ● Bridges JSF and EJB ● Offers loose coupling with strong typing ● Provides a type-based event bus ● Catalyzed managed bean & interceptor specifications ● Extensive SPI for third-party integration with Java EE ● Weld: JSR-299 reference implementation & add-ons ● Seam 3: Portable extensions for Java EE 74 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 75. How do I get started? ● Download a Java EE 6 container ● JBoss AS 6 – http://jboss.org/jbossas ● GlassFish V3 – http://glassfish.org ● Generate a Java EE project using a Maven archetype ● http://tinyurl.com/goweld ● Read the Weld reference guide ● http://tinyurl.com/weld-reference-101 ● Browse the CDI JavaDoc ● http://docs.jboss.org/cdi/api/latest/ ● Check out the Seam 3 project ● http://seamframework.org/Seam3 75 JSR-299 (CDI), Weld and the Future of Seam | Dan Allen
  • 76. Q&A Dan Allen Principal Software Engineer JBoss by Red Hat http://seamframework.org/Weld http://seamframework.org/Seam3