I want to be able to autowire a singleton bean (foo
)
@Component
public class FooUser {
@Autowire Foo foo;
}
created by another singleton's method (FooFactory.createFoo
)
@Service
public class FooFactory {
public Foo createFoo() {...}
}
with xml it's simply factory-method
. How can i do it with annotation?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…