Beanfacotry is the more primitive factory in spring. such as Xmlbeanfactory is a typical beanfactory. The original beanfactory cannot support many of spring's plugins, such as AOP features, Web applications, and so on.
The ApplicationContext interface, which is derived from the Beanfactory interface, provides all beanfactory functionality. ApplicationContext works in a more framework-oriented manner and hierarchies and implements inheritance for contexts, the ApplicationContext package also provides the following features:
Messagesource, providing international message access
• Resource access, such as URLs and files (Uniform resource file read mode)
• Event propagation with powerful event mechanism
• Load Multiple (inherited relationships) contexts so that each context is focused on a specific level, such as the Web tier of the application
Beanfactroy uses lazy loading as a way to inject beans, that is, only when a bean is used (called Getbean ()), the bean is loaded instantiated, so that we cannot discover some of the existing spring configuration problems. ApplicationContext, on the other hand, creates all the beans at once when the container is started. This way, when the container starts, we can discover the configuration errors that exist in spring. The only disadvantage relative to the basic beanfactory,applicationcontext is the memory footprint. When the application configuration bean is large, the program starts slowly.
Beanfactory and ApplicationContext both support the use of beanpostprocessor, beanfactorypostprocessor, but the difference between the two is: Beanfactory need to register manually, The ApplicationContext is automatically registered. (ApplicationContext has added some better-used features than beanfactory.) And many functions of beanfactory need to be implemented programmatically and ApplicationContext can be implemented by configuration. such as post-processing beans, ApplicationContext directly configured in the configuration file can be beanfactory this to be displayed in the code to be written out to be recognized by the container. )
The difference between spring's beanfactory and ApplicationContext