Spring和Mybatis整合时无法读取properties的处理方案
来源:互联网 发布:java 数组长度 编辑:程序博客网 时间:2024/06/05 00:20
Properties代码
- ##数据库(mysql|mssql|oracle...)
- environment=mysql
- jdbc.driver=com.mysql.jdbc.Driver
- jdbc.url=jdbc:mysql://127.0.0.1:3306/portal?useUnicode=true&characterEncoding=utf8
- jdbc.user=root
- jdbc.password=root
- #初始化连接(根据实际访问量设置大小)
- jdbc.initialSize=10
- #最大空闲连接(根据实际访问量设置大小)
- jdbc.maxIdle=50
- #最小空闲连接(根据实际访问量设置大小)
- jdbc.minIdle=10
- #最大连接数量(根据实际访问量设置大小)
- jdbc.maxActive=200
Xml代码
- <</span>context:property-placeholder
location="classpath:config.properties" /> -
-
- <</span>bean
id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> -
<</span>property name="driverClassName" value="${jdbc.driver}"/> -
<</span>property name="url" value="${jdbc.url}"/> -
<</span>property name="username" value="${jdbc.user}"/> -
<</span>property name="password" value="${jdbc.password}"/> -
<</span>property name="initialSize" value="${jdbc.initialSize}"/> -
<</span>property name="maxIdle" value="${jdbc.maxIdle}"/> -
<</span>property name="minIdle" value="${jdbc.minIdle}"/> -
<</span>property name="maxActive" value="${jdbc.maxActive}"/> -
<</span>property name="removeAbandoned" value="true"/> -
<</span>property name="removeAbandonedTimeout" value="120"/> -
<</span>property name="maxWait" value="3000"/> - </</span>bean>
-
- <</span>bean
id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> -
<</span>property name="dataSource" ref="dataSource"/> -
<</span>property name="configLocation" value="classpath:mybatis-config.xml"/> -
<</span>property name="mapperLocations" value="classpath*:com.anly.portal.*.mapper/*Mapper.xml" /> - </</span>bean>
- <</span>bean
class="org.mybatis.spring.mapper.MapperScannerConfigurer"> -
-
<</span>property name="basePackage" value="com.anly.portal.*.mapper"/> -
<</span>property name="sqlSessionFactory" ref="sqlSessionFactory"/> - </</span>bean>
修改为
原理:使用sqlSessionFactoryBeanNam
这个Bean时,id不能为sqlSessionFactory,如果为这样的话会导致MapperScannerConigurer在bean定义加载时,加载PropertyPlaceholderConfi
0 0
- Spring和Mybatis整合时无法读取properties的处理方案
- Spring和Mybatis整合时无法读取properties的处理方案
- Spring和Mybatis整合时无法读取properties的处理方案
- Spring和Mybatis整合时无法读取properties的处理方案
- Spring和Mybatis整合时无法读取properties的处理方案
- Spring和Mybatis整合时无法读取properties的处理方案
- Spring和Mybatis整合时无法读取properties的处理方案
- spring+mybatis整合时占位符无法读取jdbc.properties的问题
- mybatis与spring整合时读取properties问题的解决
- Spring整合myBatis时无法读取placeholder的问题解决
- 关于Spring与mybatis整合无法读取配置文件的问题
- Spring SpringMvc 3.0 + MyBatis 整合--补充关于.properties文件的读取
- MyBatis+Spring整合方案
- spring和mybatis整合加载jdbc.properties异常
- spring 和 mybatis 的整合
- Mybatis 和 Spring 的整合
- Spring和Mybatis的整合
- Mybatis和Spring的整合
- Eclipse让js进行代码提示,做到和java文件一样;---HTML/CSS/JSP代码提示,同理
- 如何更改dos起始位置
- ANN神经网络
- ACM--最大公约数--HDOJ 1019--Least Common Multiple--水
- 动态规划求解最长公共子序列(LCS)
- Spring和Mybatis整合时无法读取properties的处理方案
- HDOJ 4277 USACO ORZ DFS+剪枝
- BFC问题
- ubuntu安装和配置SVN
- MyEclipse 快捷键1(CTRL)
- Win8系统下VS2012添加MSComm控件
- Android 界面滑动卡顿分析与解决方案(入门)
- linux rm -f rm -rf 命令:删除文件和文件夹
- 日常任务优先级管理