mercredi 2 mars 2016

How can we create a factory pattern to return a spring bean

I want to have a Factory class, which has a method getInstance.

public PersonService getInstance(String someParameter1, Object someParameter 2, ...)

I dont want to instantiate a factory class. i just want to call a method on my factory like

PersonService service = MyFactory.getInstance(..) // some arguments passed

How we can achieve this in spring?

Aucun commentaire:

Enregistrer un commentaire