Is It Possible To Spring Autowire the same Instance of a protoype scoped class in two places
- by Mark
Hi
** changed the example to better express the situation
i am using spring 2.5 and have the following situation
@Component
@Scope("prototype")
Class Foo
{
}
class A
{
@Autowired
Foo fooA;
}
class B
{
@Autowired
Foo fooB;
}
class C
{
@Autowired
Foo fooC;
}
i am trying to understand if there is some way to use @Autowired and bind the same instance of FOO onto
fooA and fooB while binding a different instance to fooC
i understand that if the scope of FOO will be singleton it will work
but i am wandering if there is a way to achieve the same goal while using a protoype scope.
also please explain is this the correct usage of the autowiring concept ? am i trying to abuse the spring framework purpose