I have a class named Bar with the following annotation:
@Configurable(autowire = Autowire.BY_TYPE)
On a private member I have the following annotation:
@Autowired(required = true)
private Foo foo;
In the spring configuration I have a bean of class Foo. If the bean is defined with scope="prototype"
it doesn't work and I get the following exception:
NoSuchBeanDefinitionException: No matching bean of type Foo found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency
Once I change the injected bean scope to "singleton"
it works fine.
Isn't auto wiring of prototype scoped bean allowed?
Is there any workaround (beside getting the bean manually)?
Thanks in advance, Avner