Creating BeanFactory:
ClassPathResource res = new ClassPathResource("beans.xml");
XmlBeanFactory factory = new XmlBeanFactory(res);
Creating Application Context:
ClassPathXmlApplicationContext : It Loads context definition from an XML file located in the classpath
ApplicationContext context = new ClassPathXmlApplicationContext("bean_test.xml");
*FileSystemXmlApplicationContext : It loads context definition from an XML file in the filesystem.
ApplicationContext context = new FileSystemXmlApplicationContext("bean_test.xml");
Creating WebApplicationContext;
WebApplicationContext springApplicationContext = WebApplicationContextUtils
.getWebApplicationContext(config.getContext());
ClassPathResource res = new ClassPathResource("beans.xml");
XmlBeanFactory factory = new XmlBeanFactory(res);
Creating Application Context:
ClassPathXmlApplicationContext : It Loads context definition from an XML file located in the classpath
ApplicationContext context = new ClassPathXmlApplicationContext("bean_test.xml");
*FileSystemXmlApplicationContext : It loads context definition from an XML file in the filesystem.
ApplicationContext context = new FileSystemXmlApplicationContext("bean_test.xml");
Creating WebApplicationContext;
WebApplicationContext springApplicationContext = WebApplicationContextUtils
.getWebApplicationContext(config.getContext());
No comments:
Post a Comment