jsr342-experts@javaee-spec.java.net

[jsr342-experts] Make all EE components Managed Bean

From: Antonio Goncalves <antonio.goncalves_at_gmail.com>
Date: Thu, 23 Jun 2011 18:10:58 +0200

Hi all,

I came across a mistake recently. I was working on a project and wrote a
Logging interceptor to add some traces (so I could easily follow what
was happening). I then wrote an InterceptorBinding (the good old @Loggable)
and started to intercept my EJBs... and then some CDI beans... and then some
JAX-RS classes... and then, without even thinking of it, I've added the
@Loggable on the doGet method of a Servlet. Didn't work for the servlet...
because a servlet is not a Managed Bean. I didn't try with JAX-WS SOAP web
services but I hope interception works

If a ManagedBean is only about injection, life cycle and interceptors, why
not make all the components of the platform as ManagedBeans ? The spec is
not clear about that. I'm not sure Servlets 3.0 are not managed bean, maybe
just because it didn't had time to align with ManagedBean... or maybe there
a technical reason.

Any thoughts ?

-- 
Antonio Goncalves
Software architect and Java Champion
Web site <http://www.antoniogoncalves.org> |
Twitter<http://twitter.com/agoncal>|
Blog <http://feeds.feedburner.com/AntonioGoncalves> |
LinkedIn<http://www.linkedin.com/in/agoncal>| Paris
JUG <http://www.parisjug.org>