@Component
class MultiProvider {
public Foo getFoo();
public Bar getBar();
}
@Component
class FooConsumer {
FooConsumer(Foo f);
}
Can I have MultiProvider.getFoo()
autowired into the FooConsumer
constructor..
- without making
Foo
a bean itself (for example, because Spring should not destroy it, since that isMultiProvider
s responsibility) - and without introducing a dependency from
FooConsumer
toMultiProvider
(or any other class)?