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

Posted by: Pdfprep Category: CoreSpringV3.2 Tags: , ,

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

Leave a Reply

Your email address will not be published.