[jboss-user] [JBoss Seam] - Re: Using the @Factory annotation and stateless session bean

chuckadams do-not-reply at jboss.com
Mon Sep 25 10:51:03 EDT 2006


If you want something run on every invocation in a SLSB (or anything else for that matter), you're looking for an interceptor.  Check out the @LoggedIn interceptor in the booking example for a simple implementation.  The manual covers this interceptor in section 2.6

All @Factory does is initialize a component that's in an instance variable, and it'll only be called if it's not already set.  It's not the best name I can think of, since @Unwrap is the annotation that actually yells "Factory Method" to me.  But even @Unwrap is not going to give you the behavior you want, only an interceptor will.

@Factory is used all over the examples.  The blog example has some of the best uses of it, though the booking and dvdstore examples are probably easier to understand.


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

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



More information about the jboss-user mailing list