Best practice question: bean factory & standalone app
Springers,
I’m developing a spring-based standalone application, and I was wondering how gurus create their bean factory (or app context) and retrieve the singletons.
Here is what I’m doing:
I have a BeanManager class that I instanciate in the main function and that is responsible for creating the bean factory (and reading the config files). This class also keeps a reference to the bean factory.
The BeanManager class has a getBean method that simply redirects to factory.getBean. Most singletons are autowired to other beans; I only use BeanManager.getBean for the beans I use a bit everywhere (like the bean that contains my application parameters).
Does it sound right to you, or is there a better, more spring-like, way of handling this?
Thanks,
Susie.