spring means to read configuration file

Parse the classpath of the application context:

ApplicationContext context = new ClassPathXmlApplicationContext ("application-timer.xml");

PropertiesBean propertiesBean = (PropertiesBean) context.getBean ("propertiesBean");

Second, by providing the tools for Spring ApplicationContext object from the web-inf directory to read xml file:

ServletContext servletContext = request.getSession (). GetServletContext ();

ApplicationContext factory = WebApplicationContextUtils.getWebApplicationContext (servletContext);

分类:Java 时间:2010-12-07 人气:123
blog comments powered by Disqus


  • Use the classpath *: and classpath: difference between loading spring configuration file 2010-03-31

    classpath: applicationContext-config.xml that the current project configuration file to load classpath *: applicationContext-config.xml that loaded from the jar in the package configuration file

  • [Transfer] Spring xml configuration file loaded in several ways 2010-12-29

    A: Spring in support of several containers are assembled using xml bean, including: XmlBeanFactory, ClassPathXmlApplicationContext, FileSystemXmlApplicationContext, XmlWebApplicationContext Loading of these containers xml configuration files are abou

  • spring xml configuration file to read. Get the bean in several ways 2011-01-06

    Spring Framework for managing the instance of the class of means, as follows: Method One: ApplicationContext object stored in the initialization code: ApplicationContext ac = new FileSystemXmlApplicationContext ("applicationContext.xml"); ac.get

  • spring is how to parse its own configuration file (1) 2010-03-29

    Recently all right, wanted to see how the spring loaded configuration file (for example: applicationContext.xml), fear that they will forget, so write it down: 1. Entrance org.springframework.web.context.ContextLoaderListener (where recommended liste

  • 24. Using the Spring configuration file implement the transaction management 2010-03-29

    In front of us about are annotation-based approach to the use affairs to learn now under way on how to configure the XML Service, first PersonServiceBean.java where annotations removed, PersonServiceBean.java package cn.itcast.service.impl; import ja

  • Struts configuration file 2010-03-24

    Struts applications use two XML-based configuration files to configure, respectively web.xml and struts-cofig.xml file. Web.xml file is the configuration for all web applications, while the struts-config.xml file is struts-specific configuration file

  • Detailed Struts configuration file 2010-11-09

    <zt> http://blog.csdn.net/FutureInHands/archive/2006/11/15/1385681.aspx Struts framework reads when it starts its configuration file, according to it to create and configure the various Struts components. Struts configuration file allows developers

  • (Transfer) tomcat server.xml file and context.xml under 2010-11-20

    <Server> Element which represents the entire container, Tomcat instance is the top element. By the org.apache.catalina.Server interface definition. It contains a <Service> element. And it can not be used as child elements of any element. <S

  • the use of multiple spring xml configuration file and parsing 2010-11-20

    1 contextConfigLocation parameters defined in web.xml. Spring will use this parameter to load. All comma separated xml. If this parameter is, spring loaded by default web-inf/applicationContext.xml file. <context-param> <param-name> contextCon

iOS 开发

Android 开发

Python 开发



PHP 开发

Ruby 开发






Javascript 开发

.NET 开发



Copyright (C) codeweblog.com, All Rights Reserved.

CodeWeblog.com 版权所有 闽ICP备15018612号

processed in 0.035 (s). 13 q(s)