What is meant by “application-context” in spring and how do you create one?

"application-context" in spring means nothing but it is core component of spring container in spring framework. Ideally we can say "application-context" one of the Spring Container in Spring Framework and other container is "bean-factory". The configuration for "application-context" is loaded by the one of concrete implementation of ApplicationContext interface.
The ApplicationContext is the central interface within a Spring Application for providing configuration information to the application. It is read-only at run time , but can be reloaded if necessary and supported by the application.

Popular Tutorials

Major Responsibilities of "application-context" container
application-context in Spring


Creating one "application-context"


Accessing Application Context in the other classes:
You could also access the "application-context" container into other classes. You can implement ApplicationContextAware as in the following example:
public class AnotherClass implements ApplicationContextAware {

    private ApplicationContext applicationContext;

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        this.applicationContext = applicationContext;
    }

}



Spring MVC Related Posts
  1. Spring MVC Web Tutorial
  2. Spring MVC Interview Questions
  3. MVC Design Pattern
  4. Spring MVC DispatcherServlet
  5. Spring MVC WebApplicationContext and Root Application Context
  6. Spring MVC @Controller Annotation
  7. Spring MVC @RequestMapping Annotation
  8. Spring MVC @RequestParam Annotation
  9. Spring MVC ContextLoaderListener
  10. Spring MVC @RequestParam and @PathVariable annotations
  11. Spring MVC InternalResourceViewResolver
  12. Spring MVC Hello World Example
  13. Spring MVC Exception Handling Example
  14. Spring MVC with Hibernate CRUD Example
  15. Spring MVC Tiles Plugin with Example
  16. Spring MVC Interceptor with example
  17. Spring MVC with MongoDB CRUD Example
  18. Spring MVC Internationalization & Localization with Example


Labels: