[jboss-user] [EJB 3.0] - Re: Question on @Service annotated beans

wolfc do-not-reply at jboss.com
Thu May 15 14:05:55 EDT 2008


A bean annotated with @Service acts as a stateful bean with just one instance available. So in effect it's the same as a singleton in EJB 3.1. Any lookup or injection of the service bean will result in an association with that single instance.

With the use of @Management the service bean will also expose a JMX view of itself. Note that lifecycle mbean methods are currently invoked, but I would rather eliminate that function and have the option of exposing a JMX view for stateless beans as well.

In effect this means that the service (/singleton) bean has the same 'prohibitions' as any other EJB. The limitations are put in place to make the bean portable and easily maintainable. You can create threads or access the file system in an EJB, but that means governing your own resources and giving up portability.

Resources available to any EJB (JPA entity managers, declarative transactions etc) are fully supported from a service bean.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4151181#4151181

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4151181



More information about the jboss-user mailing list