spring - BeanFactory vs ApplicationContext -
i'm pretty new spring framework, i've been playing around , putting few samples apps purposes of evaluating spring mvc use in upcoming company project. far see in spring mvc, seems easy use , encourages write classes unit test-friendly.
just exercise, i'm writing main method 1 of sample/test projects. 1 thing i'm unclear exact differences between beanfactory
, applicationcontext
- appropriate use in conditions?
i understand applicationcontext
extends beanfactory
, if i'm writing simple main method, need functionality applicationcontext
provides? , kind of functionality applicationcontext
provide?
in addition answering "which should use in main() method", there standards or guidelines far implementation should use in such scenario? should main() method written depend on bean/application configuration in xml format - safe assumption, or locking user specific?
and answer change in web environment - if of classes needed aware of spring, more need applicationcontext
?
thanks help. know lot of these questions answered in reference manual, i'm having hard time finding clear breakdown of these 2 interfaces , pros/cons of each without reading thru manual fine-tooth comb.
the spring docs great on this: 3.8.1. beanfactory or applicationcontext?. have table comparison, i'll post snippet:
bean factory
- bean instantiation/wiring
application context
- bean instantiation/wiring
- automatic beanpostprocessor registration
- automatic beanfactorypostprocessor registration
- convenient messagesource access (for i18n)
- applicationevent publication
so if need of points presented on application context side, should use applicationcontext.
Comments
Post a Comment