<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:classpath="http://www.springframework.org/schema/c"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<!-- 启动SpringMVC的注解功能,它会自动注册HandlerMapping、HandlerAdapter、ExceptionResolver的相-->
<mvc:annotation-driven />
<mvc:default-servlet-handler />
<!--扫描,Controller类-->
<context:component-scan base-package="com.test"/>
<context:property-placeholder location="classpath:jdbc.properties"/>
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"
p:driverClass="${driver}"
p:jdbcUrl="${url}"
p:user="${username}"
p:password="${password}"
p:idleConnectionTestPeriod="${idleConnectionTestPeriod}"
p:maxIdleTime="${maxIdleTime}"
p:acquireIncrement="${acquireIncrement}"
p:initialPoolSize="${initialPoolSize}"
p:maxPoolSize="${maxPoolSize}"
p:minPoolSize="${minPoolSize}"
p:autoCommitOnClose="${autoCommitOnClose}"
p:checkoutTimeout="${checkoutTimeout}"
p:acquireRetryAttempts="${acquireRetryAttempts}"
p:preferredTestQuery="SELECT 1"
p:maxConnectionAge="3000"/>
<!-- mybatis文件配置,扫描所有mapper文件 -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="configLocation" value="classpath:mybatis-config.xml"/>
<property name="typeAliasesPackage" value="com.test.entity"/>
<property name="mapperLocations" value="classpath:mapper/*.xml"/>
</bean>
<!-- spring与mybatis整合配置,扫描所有dao,指定的映射器类是接口,接口方法可以用注解来指定 SQL 语句,但是 MyBatis 的映射器 XML 文件也可以用。 -->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"
p:basePackage="com.test.dao"
p:sqlSessionFactoryBeanName="sqlSessionFactory"/>
</beans>
没有合适的资源?快使用搜索试试~ 我知道了~
IDEA SpringMVC集成mybatis
共32个文件
jar:22个
xml:4个
class:3个
4星 · 超过85%的资源 需积分: 34 66 下载量 110 浏览量
2017-08-03
14:35:34
上传
评论
收藏 21.38MB RAR 举报
温馨提示
IDEA SpringMVC集成mybatis教程。 配套教程http://blog.csdn.net/ljheee/article/details/76618762
资源推荐
资源详情
资源评论
收起资源包目录
seckill.rar (32个子文件)
META-INF
MANIFEST.MF 90B
WEB-INF
web.xml 1KB
classes
mybatis-config.xml 500B
jdbc.properties 310B
com
test
dao
UserDao.class 368B
controller
UserController.class 2KB
entity
User.class 2KB
mapper
UserDao.xml 1KB
spring
spring-dao.xml 3KB
lib
spring-webmvc-4.3.3.RELEASE.jar 892KB
spring-test-4.3.3.RELEASE.jar 579KB
spring-context-support-4.3.3.RELEASE.jar 183KB
standard-1.1.2.jar 384KB
spring-aop-4.3.3.RELEASE.jar 371KB
spring-jdbc-4.3.3.RELEASE.jar 416KB
spring-beans-4.3.3.RELEASE.jar 743KB
mybatis-spring-1.3.0.jar 52KB
jackson-annotations-2.6.0.jar 46KB
mysql-connector-java-5.1.39.jar 966KB
spring-tx-4.3.3.RELEASE.jar 261KB
spring-core-4.3.3.RELEASE.jar 1.06MB
spring-expression-4.3.3.RELEASE.jar 258KB
mybatis-3.4.1.jar 1.51MB
spring-web-4.3.3.RELEASE.jar 794KB
jstl-1.2.jar 405KB
commons-logging-1.2.jar 60KB
jackson-databind-2.6.7.jar 1.12MB
spring-context-4.3.3.RELEASE.jar 1.08MB
javax.servlet-api-3.1.0.jar 94KB
jackson-core-2.6.7.jar 253KB
c3p0-0.9.1.1.jar 594KB
index.jsp 70B
共 32 条
- 1
资源评论
- IT菜籽U2018-04-03不错good!不错
- qingshuiwater2018-08-27这个非常不错,已成功运行
- 奋斗的菜鸟儿2018-03-18好好好好好
- bm0302020-12-30很好 ,非常不错
- beiwangwangchao2018-04-18学习一次看看效果
ljheee
- 粉丝: 824
- 资源: 439
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功