Consider a java class containing no setter or constructor, but a static method to return its instance.
public class ClientService {
private static ClientService clientService = new ClientService();
private ClientService() {}
public static ClientService createInstance() {
return clientService;
}
}
So to creating this bean we use factory-method attribute on bean.
<bean id="clientService" class="ex2.ClientService" factory-method="createInstance" />
No comments:
Post a Comment