JBoss Seam: @create= true and @Autocreate

As a Sean beginner I was wondering what exactly the @create= true annotation does inside of the @In injection declaration.  Here is the mystery unveiled:

– When a Seam component is requested, the container looks into the lowest context to see if its there, if not the next context up in the hierarchy is searched.

– If no instance is found thats when the above mentioned annotations kick in:

  • If the injection that triggered the search is declared as  @create=true, the component is instantiated
  • If the component is marked with a @Autocreate annotation on the class level, a new instance will be created in any case and the @create=true annotation becomes obsolete.

Expression Language Tricks

1. Concatenation: Looking up a composite key in a dictionary


2. Conditional composite String output

#{condition?’ok’: messages[‘ex.pression1’].concat(‘  ‘).concat(messages[‘ex.pression2’])}

3. Projections: Looping over a collection and printing one field



Source: Seam Documentation