[jboss-user] [JBoss Seam] - Re: Injection woes

stan.silvert@jboss.com do-not-reply at jboss.com
Wed Aug 16 10:26:18 EDT 2006


"ptmain" wrote : It would get the job done, but my goal also was to reduce it to one annotation, since @Singleton really says it all.  :-)
  | 

I don't think @Singleton really says it all.  There is a difference between:

Inject from any scope, create if needed, and outject to SINGLETON scope:
@In (create = true)
  | @Out (scope = SINGLETON)
  | private DocumentManager docMgr;

Inject from any scope, outject to SINGLETON scope:
@In
  | @Out (scope = SINGLETON)
  | private DocumentManager docMgr;

Inject from any scope, one of which could be SINGLETON
@In
  | private DocumentManager docMgr;

Don't inject, but outject to SINGLETON scope
@Out (scope = SINGLETON)
  | private DocumentManager docMgr;

I don't think this can/should be reduced to one annotation.  Just my humble opinion.

The more I think about it, the more I like the idea of a SINGLETON scope.  Most of the time when you use application scope you really want a web app singleton.  But application scope allows the singleton instance to be replaced or removed which could be a source of errors.

Stan

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

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



More information about the jboss-user mailing list