Skip to main content

Manfred Riem

I love working with a broad range of technologies. At work it is mostly JavaEE and JavaSE technologies, as a hobby I do some Java on devices.

 

mriem's blog

JavaEE Tip #5 - Resource

Posted by mriem on December 15, 2014 at 4:57 AM PST

With the @Resource annotation you define the resource you want to inject. Note this annotation is an older style annotation. Going forward the recommendation is to use the CDI @Inject annotation.

In code

  @Resource
  UserTransaction utx;

Enjoy!

JavaEE Tip #4 - PreDestroy

Posted by mriem on December 13, 2014 at 7:29 AM PST

With the @PreDestroy annotation you annotate a single method in your class that you want to be called just before your object (EJB, JSF managed bean, CDI bean) is taken out of service.

In code

  @PreDestroy
  public void destroy() {
    // put your destroy code here.
  }

Enjoy!

JavaEE Tip #3 - PostConstruct

Posted by mriem on December 12, 2014 at 6:40 AM PST

The @PostConstruct annotation makes it possible to run initialization code just before something (EJB, JSF managed bean, CDI bean) is put into service.

In code

  @PostConstruct
  public void init() {
    // put your initialization code here.
  }

JavaEE Tip #2 - Location of the JavaEE tutorial

Posted by mriem on November 6, 2014 at 8:37 AM PST

And it is tutorial time!

Where are the JavaEE tutorials for each of the JavaEE versions?

Enjoy!

JavaEE Tip #1 - Location of the JavaEE API documentation

Posted by mriem on November 5, 2014 at 11:40 AM PST

If you want to find a specific version of the JavaEE API documentation the following links connect you to them:

JSF 2.3 Injecting the view map

Posted by mriem on October 31, 2014 at 2:22 AM PDT

Another CDI alignment issue done

In code

@ViewMap
@Inject
Map viewMap;

In words you can now inject the view map for use in your CDI managed bean.

Enjoy!

JSF 2.3 changes

Posted by mriem on October 30, 2014 at 12:38 PM PDT

The following spec issues were addressed

#1333 - Support @Inject for UIViewRoot
#1332 - Let CDI handle #{view}
#1331 - Let CDI handle #{application}

And the following other issues that have a 2.3 impact were addressed

#3425 - Apply Java SE 7 Strings in switch
#3427 - Apply Java SE 7 multi-catch
#3444 - Apply Java SE 7 multi-catch: part 3 of 3

JSF 2.3 Injecting the UIViewRoot

Posted by mriem on October 29, 2014 at 11:53 AM PDT

And now you can inject the UIViewRoot

In code

@Inject
UIViewRoot viewRoot;

Enjoy!

JSF 2.3 allow CDI to handle #{application}

Posted by mriem on October 27, 2014 at 1:04 PM PDT

Nothing really fancy, but #{application} EL resolving is now done using a 2.3 CDI producer.

Note there won't be @Inject support for this as it is not referring to a specific typed artifact.

Enjoy!

JSF 2.3 changes

Posted by mriem on October 23, 2014 at 10:30 AM PDT

While it looks like not a whole lot has been going on issue wise some additional work not covered by specification issues has be done

a) Javadoc cleanup for JavaSE 8
b) Apply diamond operator to sources

And the following specification issues were handled:

#1254 - contracts attribute too restrictive.
#1328 - Let CDI handle #{session} EL resolving