Posted by: Pdfprep
Post Date: January 25, 2021
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