Note that there are some explanatory texts on larger screens.

plurals
  1. POBeanFactory vs ApplicationContext
    text
    copied!<p>I'm pretty new to the Spring Framework, I've been playing around with it and putting a few samples apps together for the purposes of evaluating Spring MVC for use in an upcoming company project. So far I really like what I see in Spring MVC, seems very easy to use and encourages you to write classes that are very unit test-friendly.</p> <p>Just as an exercise, I'm writing a main method for one of my sample/test projects. One thing I'm unclear about is the exact differences between <code>BeanFactory</code> and <code>ApplicationContext</code> - which is appropriate to use in which conditions?</p> <p>I understand that <code>ApplicationContext</code> extends <code>BeanFactory</code>, but if I'm just writing a simple main method, do I need the extra functionality that <code>ApplicationContext</code> provides? And just exactly what kind of extra functionality does <code>ApplicationContext</code> provide?</p> <p>In addition to answering "which should I use in a main() method", are there any standards or guidelines as far as which implementation I should use in such a scenario? Should my main() method be written to depend on the bean/application configuration to be in XML format - is that a safe assumption, or am I locking the user into something specific?</p> <p>And does this answer change in a web environment - if any of my classes needed to be aware of Spring, are they more likely to need <code>ApplicationContext</code>?</p> <p>Thanks for any help. I know a lot of these questions are probably answered in the reference manual, but I'm having a hard time finding a clear breakdown of these two interfaces and the pros/cons of each without reading thru the manual with a fine-tooth comb.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload