Mapper的XML配置文件之properties
2016-11-24 08:42
381 查看
介绍一下Mapper的XML配置文件
Mapper 的XML 配置文件包含一些设置和属性,用于增强MyBatis 的动作。一般为sqlmap-config.xml,文档的深层次结果如下:具体介绍每个节点的用途
一、属性(properties)JAVA 属性文件就可以配置直观的、可代替的属性,或者是属性项的子项。比如:
<properties resource="org/mybatis/example/config.properties"> <property name="username" value="dev_user"/> <property name="password" value="F2Fa3!33TYyg"/> </properties>
通过动态配置,这些属性都可以用替换整个文件的值。例如:
<dataSource type="POOLED"> <property name="driver" value="${driver}"/> <property name="url" value="${url}"/> <property name="username" value="${username}"/> <property name="password" value="${password}"/> </dataSource>
例子中的usrname 和password 将被属性文件中设置的值所替换, driver 和value 属性也将被
config.properties 文件中值所替换,这为配置提供了多种选择。
相关文章推荐
- 配置文件:persistence.xml-----beans.xml----jdbc.properties----log4j.properties---oscache----paoding---struts.config---web.xml
- java读写xml和properties配置文件and Properties支持中文(转)
- Struts 2框架有两个核心配置文件:struts.xml和struts.properties
- log4j 配置文件 (XML/.properties)
- properties和xml配置文件加载效率
- LOG4J 配置文件 properties --> XML
- Struts1.2总结,web.xml、.properties资源文件的配置
- 【引用】ssh配置文件(web.xml,struts.xml,applicationContext.xml,persistence.xml,log4j.properties)
- java读取配置文件 xml properties的几种方法
- 演示log4j 配置文件 (XML/.properties)
- java读取xml/.properties配置文件
- java对配置文件(XML/properties)的操作
- Spring、MyBatis的整合数据映射器类(UserMapper->iocContext.xml)配置文件详解
- xml、properties配置文件的读取
- web.xml、.properties资源文件的配置
- Spring的配置文件,可以用applicationContext.xml+applicationContext.properties
- struts2中struts.properties配置文件详解(及在struts.xml文件中的配置)
- struts2的struts.xml struts.properties配置文件
- log4j 配置文件 (XML/.properties)
- Mapper的XML映射文件---2.1: 属性(properties)