org.springframework
spring-webmvc
${spring.version}
[](
)3.mybatis以及spring整合mybatis相关jar包
org.mybatis
mybatis
3.4.5
org.mybatis
mybatis-spring
2.0.5
[](
)4.连接数据库相关jar包
com.alibaba
druid
1.1.22
mysql
mysql-connector-java
5.1.47
[](
)5.日志相关jar包
log4j
log4j
1.2.17
org.slf4j
slf4j-api
1.7.10
org.slf4j
slf4j-log4j12
1.7.10
[](
)6.测试相关jar包
junit
junit
4.12
test
[](
)二、配置文件
[](
)1.spring整合mybatis spring-mybatis.xml
[](
)jdbc.properties
jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/videos?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8
jdbc.username=root
jdbc.password=123456
initialSize=5
maxActive=20
maxWait=2000
[](
)spring-mybatis.xml
<?xml version="1.0" encoding="UTF-8"?><beans xmlns=“http://www.springframework.org/schema/beans”
xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”
xmlns:context=“http://www.springframework.org/schema/context”
xmlns:tx=“http://www.springframework.org/schema/tx”
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<context:component-scan base-package=“com.liubo.SSMTemplate.service”/>
<context:property-placeholder location=“classpath:jdbc.properties”/>
<tx:annotation-driven transaction-manager=“transactionManager”/>
[](
)2.springMVC配置文件
[](
)spring-mybatis.xml
<?xml version="1.0" encoding="UTF-8"?><beans xmlns=“http://www.springframework.org/schema/beans”
xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”
xmlns:context=“http://www.springframework.org/schema/context”
xmlns:mvc=“http://www.springframework.org/schema/mvc”
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframewo
【一线大厂Java面试题解析+核心总结学习笔记+最新架构讲解视频+实战项目源码讲义】
浏览器打开:qq.cn.hn/FTf 免费领取
rk.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<context:component-scan base-package=“com.liubo.SSMTemplate.controller”/>
mvc:default-servlet-handler/
mvc:annotation-driven/
mvc:interceptors
mvc:interceptor
<mvc:mapping path="/video/*"/>
<mvc:mapping path="/speaker/*"/>
<mvc:mapping path="/course/*"/>
</mvc:interceptor>
</mvc:interceptors>
[](
)3.mybatis配置文件
[](
)mybatis-config.xml
此文件多用与配置一些在spring-mybatis文件中不方便配置的东西
<?xml version="1.0" encoding="UTF-8"?>