I've recently started learning the Spring Framework, and I'm a bit unclear on how the ApplicationContext is supposed to be used - in both standalone and web applications. I understand that the ApplicationContext, once instantiated with the spring configuration xml, is the "spring container" and is a singleton.
But:
- In the starting point - main method - of an app do I use ApplicationContext.getBean("className") and then rely on DI for all other registered beans or is there a way to use only DI?
- Is there any other place besides the main method where I could/should use ApplicationContext.getBean("className")?
- If and when should ApplicationContext.getBean("className") be used in a web app?
- If in your opinion there is information I MUST know regarding DI related to web applications, even though I may not of specifically inquired about it, please share.