Spring 2.5 Autowire no unique bean error

3 messages Options
Embed this post
Permalink
mschipperheyn

Spring 2.5 Autowire no unique bean error

Reply Threaded More More options
Print post
Permalink
Hi all,

Has anyone tried to use Spring 2.5 yet?

You get this error when you try to use the annotated controller with autowiring.

2008-04-03 17:06:20.818::WARN:  Nested in org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'loadCategoryController': Autowiring of methods failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void nl.project.webapp.controller.LoadCategoryController.setCountryManager(org.appfuse.service.GenericManager); nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [org.appfuse.service.GenericManager] is defined: expected single matching bean but found 30:

Does anybody know a way around this apart from hard writing the XML. I'm really happy to be rid of XML configs, so I would love to be able to use this feature knowing that if I don't use it now, I'll have to refactor everything later.

I also saw in Jira that an item Upgrade to Spring 2.5.1 has been marked as resolved. If I need to upgrade to resolve this issue, is there a way to use the alpha for Appfuse 2.0.2?

Cheers,

Marc
mraible

Re: Spring 2.5 Autowire no unique bean error

Reply Threaded More More options
Print post
Permalink
Adding @Qualifier("countryManager") should solve this issue.

If you have JSR-250's JAR in your classpath (or are using JDK 6), you
can also use @Resource(name="countryManager") instead of the more
verbose @Autowired @Qualifier("countryManager").

Matt

On Fri, Apr 4, 2008 at 2:15 AM, mschipperheyn <[hidden email]> wrote:

>
>  Hi all,
>
>  Has anyone tried to use Spring 2.5 yet?
>
>  You get this error when you try to use the annotated controller with
>  autowiring.
>
>  2008-04-03 17:06:20.818::WARN:  Nested in
>  org.springframework.beans.factory.BeanCreationException: Error creating bean
>  with name 'loadCategoryController': Autowiring of methods failed; nested
>  exception is org.springframework.beans.factory.BeanCreationException: Could
>  not autowire method: public void
>  nl.project.webapp.controller.LoadCategoryController.setCountryManager(org.appfuse.service.GenericManager);
>  nested exception is
>  org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique
>  bean of type [org.appfuse.service.GenericManager] is defined: expected
>  single matching bean but found 30:
>
>  Does anybody know a way around this apart from hard writing the XML. I'm
>  really happy to be rid of XML configs, so I would love to be able to use
>  this feature knowing that if I don't use it now, I'll have to refactor
>  everything later.
>
>  I also saw in Jira that an item Upgrade to Spring 2.5.1 has been marked as
>  resolved. If I need to upgrade to resolve this issue, is there a way to use
>  the alpha for Appfuse 2.0.2?
>
>  Cheers,
>
>  Marc
>  --
>  View this message in context: http://www.nabble.com/Spring-2.5-Autowire-no-unique-bean-error-tp16488177s2369p16488177.html
>  Sent from the AppFuse - User mailing list archive at Nabble.com.
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: [hidden email]
>  For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

mschipperheyn

Re: Spring 2.5 Autowire no unique bean error

Reply Threaded More More options
Print post
Permalink
Awesome. Thanks!!!

Marc
mraible wrote:
Adding @Qualifier("countryManager") should solve this issue.

If you have JSR-250's JAR in your classpath (or are using JDK 6), you
can also use @Resource(name="countryManager") instead of the more
verbose @Autowired @Qualifier("countryManager").

Matt

On Fri, Apr 4, 2008 at 2:15 AM, mschipperheyn <m.schipperheyn@gmail.com> wrote:
>
>  Hi all,
>
>  Has anyone tried to use Spring 2.5 yet?
>
>  You get this error when you try to use the annotated controller with
>  autowiring.
>
>  2008-04-03 17:06:20.818::WARN:  Nested in
>  org.springframework.beans.factory.BeanCreationException: Error creating bean
>  with name 'loadCategoryController': Autowiring of methods failed; nested
>  exception is org.springframework.beans.factory.BeanCreationException: Could
>  not autowire method: public void
>  nl.project.webapp.controller.LoadCategoryController.setCountryManager(org.appfuse.service.GenericManager);
>  nested exception is
>  org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique
>  bean of type [org.appfuse.service.GenericManager] is defined: expected
>  single matching bean but found 30:
>
>  Does anybody know a way around this apart from hard writing the XML. I'm
>  really happy to be rid of XML configs, so I would love to be able to use
>  this feature knowing that if I don't use it now, I'll have to refactor
>  everything later.
>
>  I also saw in Jira that an item Upgrade to Spring 2.5.1 has been marked as
>  resolved. If I need to upgrade to resolve this issue, is there a way to use
>  the alpha for Appfuse 2.0.2?
>
>  Cheers,
>
>  Marc
>  --
>  View this message in context: http://www.nabble.com/Spring-2.5-Autowire-no-unique-bean-error-tp16488177s2369p16488177.html
>  Sent from the AppFuse - User mailing list archive at Nabble.com.
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@appfuse.dev.java.net
>  For additional commands, e-mail: users-help@appfuse.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@appfuse.dev.java.net
For additional commands, e-mail: users-help@appfuse.dev.java.net