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?
Try Java
@Configurationinstead: