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

ptmain do-not-reply at jboss.com
Wed Aug 16 00:23:53 EDT 2006


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

BTW, I had a terrible time with the following pattern today when referencing a simple java object that doesn't have a Seam @Name tag:

@In (create = true)
  | @Out (scope = SESSION)
  | private DocumentManager docMgr;

I'm not including the DocumentManager code, as it's just a java class with a simple public constructor.

I kept getting the error where it was complaining about the docMgr attribute being required but not being initialized (I don't have the log file handy right now).  Anyway, the only way I could make it work was to add an @Name tag to the DocumentManager class.  This was even more frustrating because directly beneath those lines was the following block of code:

@In (create = true)
  | @Out (scope = SESSION)
  | private QCCache qcCache;

And this worked fine without any changes!  (And QCCache has no @Name annotation either).  Very odd that it worked for one case and not another...

I was sort of assuming that Seam would be following the "use an intuitive default" approach and would use the variable's name as the context key, without having to instrument the referenced object.  After all, I might want to reference a java.util.Date object, and I can't add a @Name annotaton to that without subclassing it.

Any ideas?  Am I just abusing the bijection feature?


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

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



More information about the jboss-user mailing list