You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by Frank Zhang <Fr...@citrix.com> on 2013/02/09 02:39:38 UTC

what's rule for using @Component and xml bean file

I see client/tomcatconf/componentContext.xml.in defining lots of beans while I also see many beans use @Component
Is there any guideline here?

Re: what's rule for using @Component and xml bean file

Posted by Rohit Yadav <bh...@apache.org>.
So, the rule of thumb is that if you want to give the sysadmin an
option to disable a component (like a plugin for example), you define
that bean (name, class map) in a context xml file, else you use the
@Component annotation on the class (generally an impl) so spring
creates a singleton/bean and autowires/injects wherever you may need
it.

Regards.

On Sat, Feb 9, 2013 at 7:09 AM, Frank Zhang <Fr...@citrix.com> wrote:
> I see client/tomcatconf/componentContext.xml.in defining lots of beans while I also see many beans use @Component
> Is there any guideline here?