How can a bean of type LegacySingleton be created (using XML configuration)? (select one)

How can a bean of type LegacySingleton be created (using XML configuration)? (select one)

Consider the following class:

public class LegacySingleton {

private LegacySingleton(){}

public static LegacySingleton getAServiceInstance() {

return new LegacySingleton();

}

}
A . It is not possible, the constructor must be public
B . Use the factory-method attribute on the <bean> tag
C . Use the init-method attribute on the <bean> tag
D . Use autowiring

Answer: B

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments