ApplicationContext.xml中加载properties配置文件
2014-12-18 21:39
351 查看
<!-- 加载配置属性文件 -->
<context:property-placeholder ignore-unresolvable="true" location="classpath*:/abc.properties" />
在Maven项目中,该配置文件在/src/main/resources/下
之后比如配置数据库连接,方言等,可以直接用EL表达式来配置
eg:
<context:property-placeholder ignore-unresolvable="true" location="classpath*:/abc.properties" />
在Maven项目中,该配置文件在/src/main/resources/下
之后比如配置数据库连接,方言等,可以直接用EL表达式来配置
eg:
数据源配置 <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" value="${jdbc.driver}" /> <property name="url" value="${jdbc.url}" /> <property name="username" value="${jdbc.username}"/> <property name="password" value="${jdbc.password}"/> </bean>
相关文章推荐
- 【引用】ssh配置文件(web.xml,struts.xml,applicationContext.xml,persistence.xml,log4j.properties)
- 请慎用spring-ClassPathXmlApplicationContext手动加载spring配置文件
- 请慎用spring-ClassPathXmlApplicationContext手动加载spring配置文件
- applicationContext.xml文件如何调用外部properties等配置文件
- 【Spring学习笔记-2】Myeclipse下第一个Spring程序-通过ClassPathXmlApplicationContext加载配置文件
- applicationContext.xml文件如何调用外部properties等配置文件
- Tomcat启动时,spring加载配置文件applicationContext.xml出错,抛出nested exception is og.xml.sax.SAXParseException
- 使用Spring中的ClassPathXmlApplicationContext加载配置文件
- applicationContext.xml文件如何调用外部properties等配置文件
- spring学习笔记(3)——配置文件applicationContext.xml的加载
- spring 配置文件无法加载,junit找不到xml配置文件java.lang.IllegalStateException: Failed to load ApplicationContext
- Spring的配置文件,可以用applicationContext.xml+applicationContext.properties
- applicationContext.xml文件中怎么配置struts2和spring配置文件的加载路径
- Spring加载配置文件applicationContext.xml的方式
- applicationContext.xml的配置文件
- applicationContext.xml import spring模块配置文件
- 搭建SSH框架的时候的applicationContext.xml配置文件
- Spring配置文件applicationContext.xml(2)之AOP
- 加载spring时applicationContext.xml文件出错
- 加载spring时applicationContext.xml文件出错