Knowledge Walls
J2EE Technologies Tutorial
Hyderabad, Andhra Pradesh, India
What is Application Context in Spring Framework
2310 Views
ClassPathXmlApplicationContext Example
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");
ErrorHandler handler = (ErrorHandler) context.getBean("errHandler");
handler.showError();
Define 
Application context is used to load and wire bean object reads from xml configuration file.

Application xml file can read by three different classes in spring framework.
1) ClassPathXmlApplicationContext
2) FileSystemXmlApplicationContext
3) XmlWebApplicationContext

ClassPathXmlApplicationContext
   ClassPathXmlApplicationContext used to reads a xml from classes path.

FileSystemXmlApplicationContext
   FileSystemXmlApplicationContext used to reads a xml from machine path of the file.

XmlWebApplicationContext
   XmlWebApplicationContext used to reads a xml from a internet web location.
Best Lessons of "Spring 3.0 Examples"
Top lessons which are viewed more times.
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details