Maven 搭建 SSM框架——Spring+SpringMVC+Mybatis的搭建教程
一:概述
SSM框架在项目开发中经常使用到,相比于SSH框架,它在仅几年的开发中运用的更加广泛。
Spring作为一个轻量级的框架,有很多的拓展功能,最主要的我们一般项目使用的就是IOC和AOP。
SpringMVC是Spring实现的一个Web层,相当于Struts的框架,但是比Struts更加灵活和强大!
Mybatis是 一个持久层的框架,在使用上相比Hibernate更加灵活,可以控制sql的编写,使用 XML或注解进行相关的配置!
根据上面的描述,学习SSM框架就非常的重要了!
二:搭建一个SSM的过程
使用Maven管理项目
使用Maven在Eclipse中创建一个webapp的项目 ,具体的创建过程不做演示,如有不会创建的创建项目
也可以使用Maven命令进行创建,在Dos窗口进入指定的目录,执行下面命令:
mvn archetype:create -DgroupId=org.ssm.dufy -DartifactId=ssm-demo -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false
使用命令要注意,系统安装了Maven,并配置好了环境变量!Maven的安装和环境变量配置
1、导入项目(命名创建),添加依赖
如下项目结构:
然后直接配置 pom.xml文件中的包依赖!
1 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 2 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 3 <modelVersion>4.0.0</modelVersion> 4 <groupId>org.dufy</groupId> 5 <artifactId>ssm</artifactId> 6 <packaging>war</packaging> 7 <version>0.0.1-SNAPSHOT</version> 8 <name>ssmDemo</name> 9 <url>http://maven.apache.org</url> 10 <properties> 11 <spring.version>4.0.5.RELEASE</spring.version> 12 <mybatis.version>3.2.1</mybatis.version> 13 <slf4j.version>1.6.6</slf4j.version> 14 <log4j.version>1.2.12</log4j.version> 15 <mysql.version>5.1.35</mysql.version> 16 17 18 </properties> 19 <dependencies> 20 <!-- 添加Spring依赖 --> 21 <dependency> 22 <groupId>org.springframework</groupId> 23 <artifactId>spring-core</artifactId> 24 <version>${spring.version}</version> 25 </dependency> 26 <dependency> 27 <groupId>org.springframework</groupId> 28 <artifactId>spring-webmvc</artifactId> 29 <version>${spring.version}</version> 30 </dependency> 31 <dependency> 32 <groupId>org.springframework</groupId> 33 <artifactId>spring-context</artifactId> 34 <version>${spring.version}</version> 35 </dependency> 36 <dependency> 37 <groupId>org.springframework</groupId> 38 <artifactId>spring-context-support</artifactId> 39 <version>${spring.version}</version> 40 </dependency> 41 <dependency> 42 <groupId>org.springframework</groupId> 43 <artifactId>spring-aop</artifactId> 44 <version>${spring.version}</version> 45 </dependency> 46 <dependency> 47 <groupId>org.springframework</groupId> 48 <artifactId>spring-aspects</artifactId> 49 <version>${spring.version}</version> 50 </dependency> 51 <dependency> 52 <groupId>org.springframework</groupId> 53 <artifactId>spring-tx</artifactId> 54 <version>${spring.version}</version> 55 </dependency> 56 <dependency> 57 <groupId>org.springframework</groupId> 58 <artifactId>spring-jdbc</artifactId> 59 <version>${spring.version}</version> 60 </dependency> 61 <dependency> 62 <groupId>org.springframework</groupId> 63 <artifactId>spring-web</artifactId> 64 <version>${spring.version}</version> 65 </dependency> 66 <!--spring单元测试依赖 --> 67 <dependency> 68 <groupId>org.springframework</groupId> 69 <artifactId>spring-test</artifactId> 70 <version>${spring.version}</version> 71 <scope>test</scope> 72 </dependency> 73 74 <!-- spring webmvc相关jar --> 75 <dependency> 76 <groupId>org.springframework</groupId> 77 <artifactId>spring-webmvc</artifactId> 78 <version>${spring.version}</version> 79 </dependency> 80 <dependency> 81 <groupId>org.springframework</groupId> 82 <artifactId>spring-web</artifactId> 83 <version>${spring.version}</version> 84 </dependency> 85 86 <!-- mysql驱动包 --> 87 <dependency> 88 <groupId>mysql</groupId> 89 <artifactId>mysql-connector-java</artifactId> 90 <version>${mysql.version}</version> 91 </dependency> 92 93 <!-- alibaba data source 相关jar包--> 94 <dependency> 95 <groupId>com.alibaba</groupId> 96 <artifactId>druid</artifactId> 97 <version>0.2.23</version> 98 </dependency> 99 100 <!-- alibaba fastjson 格式化对 --> 101 <dependency> 102 <groupId>com.alibaba</groupId> 103 <artifactId>fastjson</artifactId> 104 <version>1.1.41</version> 105 </dependency> 106 107 <!-- logback start --> 108 <dependency> 109 <groupId>log4j</groupId> 110 <artifactId>log4j</artifactId> 111 <version>${log4j.version}</version> 112 </dependency> 113 <dependency> 114 <groupId>org.slf4j</groupId> 115 <artifactId>slf4j-api</artifactId> 116 <version>${slf4j.version}</version> 117 </dependency> 118 <dependency> 119 <groupId>ch.qos.logback</groupId> 120 <artifactId>logback-classic</artifactId> 121 <version>1.1.2</version> 122 </dependency> 123 <dependency> 124 <groupId>ch.qos.logback</groupId> 125 <artifactId>logback-core</artifactId> 126 <version>1.1.2</version> 127 </dependency> 128 <dependency> 129 <groupId>org.logback-extensions</groupId> 130 <artifactId>logback-ext-spring</artifactId> 131 <version>0.1.1</version> 132 </dependency> 133 134 <!--mybatis依赖 --> 135 <dependency> 136 <groupId>org.mybatis</groupId> 137 <artifactId>mybatis</artifactId> 138 <version>${mybatis.version}</version> 139 </dependency> 140 141 <!-- mybatis/spring包 --> 142 <dependency> 143 <groupId>org.mybatis</groupId> 144 <artifactId>mybatis-spring</artifactId> 145 <version>1.2.0</version> 146 </dependency> 147 <!-- 添加servlet3.0核心包 --> 148 <dependency> 149 <groupId>javax.servlet</groupId> 150 <artifactId>javax.servlet-api</artifactId> 151 <version>3.0.1</version> 152 </dependency> 153 <dependency> 154 <groupId>javax.servlet.jsp</groupId> 155 <artifactId>javax.servlet.jsp-api</artifactId> 156 <version>2.3.2-b01</version> 157 </dependency> 158 <!-- jstl --> 159 <dependency> 160 <groupId>javax.servlet</groupId> 161 <artifactId>jstl</artifactId> 162 <version>1.2</version> 163 </dependency> 164 <!--单元测试依赖 --> 165 <dependency> 166 <groupId>junit</groupId> 167 <artifactId>junit</artifactId> 168 <version>3.8.1</version> 169 <scope>test</scope> 170 </dependency> 171 </dependencies> 172 <build> 173 <finalName>ssmDemo</finalName> 174 </build> 175 </project>
2、创建数据库和表,生成代码
创建数据库我参考别人的博客数据库设计,这块没有自己去书写,直接添上代码
1 DROP TABLE IF EXISTS `user_t`; 2 3 CREATE TABLE `user_t` ( 4 `id` int(11) NOT NULL AUTO_INCREMENT, 5 `user_name` varchar(40) NOT NULL, 6 `password` varchar(255) NOT NULL, 7 `age` int(4) NOT NULL, 8 PRIMARY KEY (`id`) 9 ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; 10 11 /*Data for the table `user_t` */ 12 13 insert into `user_t`(`id`,`user_name`,`password`,`age`) values (1,'测试','123456',24)
生成代码请查看:
生成的代码导入图片解释:
3、Spring 和 mybatis整合,连接数据库,进行Junit测试
将生成的代码拷贝到项目中,然后进行Spring和Mybatis的整合,添加配置文件!
主要有
applicationContent.xml :Spring的相关配置!
Spring-mhbatis.xml : Spring和Mybatis集成配置!
jdbc.properties : 数据库信息配置!
logback.xml : 日志输出信息配置!(不做介绍,详细信息查看源码)
主要介绍applicationContext.xml、Spring-mhbatis.xml、jdbc.properties。主要内容如下:
jdbc.properties
1 jdbc_driverClassName =com.mysql.jdbc.Driver 2 jdbc_url=jdbc:mysql://localhost:3306/ssm?useUnicode=true&characterEncoding=utf8 3 jdbc_username=root 4 jdbc_password=root
applicationContext.xml
1 <?xml version="1.0" encoding="UTF-8"?> 2 <beans xmlns="http://www.springframework.org/schema/beans" 3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 4 xmlns:context="http://www.springframework.org/schema/context" 5 xmlns:aop="http://www.springframework.org/schema/aop" 6 xmlns:tx="http://www.springframework.org/schema/tx" 7 xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 8 http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd 9 http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd 10 http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd 11 "> 12 <!-- 1.配置jdbc文件 --> 13 <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> 14 <property name="locations" value="classpath:jdbc.properties"/> 15 </bean> 16 17 <!-- 2.扫描的包路径,这里不扫描被@Controller注解的类 --><!--使用<context:component-scan/> 可以不在配置<context:annotation-config/> --> 18 <context:component-scan base-package="org.ssm.dufy"> 19 <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/> 20 </context:component-scan> 21 22 <import resource="classpath:spring-mybatis.xml" /> 23 24 </beans>
spring-mybatis.xml
1 <?xml version="1.0" encoding="UTF-8"?> 2 <beans xmlns="http://www.springframework.org/schema/beans" 3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" 4 xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" 5 xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd 6 http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd 7 http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd 8 http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd"> 9 10 <!-- 3.配置数据源 ,使用的alibba的数据库--> 11 <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close"> 12 <!-- 基本属性 url、user、password --> 13 <property name="driverClassName" value="${jdbc_driverClassName}"/> 14 <property name="url" value="${jdbc_url}"/> 15 <property name="username" value="${jdbc_username}"/> 16 <property name="password" value="${jdbc_password}"/> 17 18 <!-- 配置初始化大小、最小、最大 --> 19 <property name="initialSize" value="10"/> 20 <property name="minIdle" value="10"/> 21 <property name="maxActive" value="50"/> 22 23 <!-- 配置获取连接等待超时的时间 --> 24 <property name="maxWait" value="60000"/> 25 <!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 --> 26 <property name="timeBetweenEvictionRunsMillis" value="60000" /> 27 28 <!-- 配置一个连接在池中最小生存的时间,单位是毫秒 --> 29 <property name="minEvictableIdleTimeMillis" value="300000" /> 30 31 <property name="validationQuery" value="SELECT 'x'" /> 32 <property name="testWhileIdle" value="true" /> 33 <property name="testOnBorrow" value="false" /> 34 <property name="testOnReturn" value="false" /> 35 36 <!-- 打开PSCache,并且指定每个连接上PSCache的大小 如果用Oracle,则把poolPreparedStatements配置为true,mysql可以配置为false。--> 37 <property name="poolPreparedStatements" value="false" /> 38 <property name="maxPoolPreparedStatementPerConnectionSize" value="20" /> 39 40 <!-- 配置监控统计拦截的filters --> 41 <property name="filters" value="wall,stat" /> 42 </bean> 43 44 45 46 <!-- spring和MyBatis完美整合,不需要mybatis的配置映射文件 --> 47 <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> 48 <property name="dataSource" ref="dataSource" /> 49 <!-- 自动扫描mapping.xml文件 --> 50 <property name="mapperLocations" value="classpath:org/ssm/dufy/mapper/*.xml"></property> 51 </bean> 52 53 54 <!-- DAO接口所在包名,Spring会自动查找其下的类 ,自动扫描了所有的XxxxMapper.xml对应的mapper接口文件,只要Mapper接口类和Mapper映射文件对应起来就可以了--> 55 <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> 56 <property name="basePackage" value="org.ssm.dufy.dao" /> 57 <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"></property> 58 </bean> 59 60 <!-- (事务管理)transaction manager, use JtaTransactionManager for global tx --> 61 <!-- 配置事务管理器 --> 62 <bean id="transactionManager" 63 class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> 64 <property name="dataSource" ref="dataSource" /> 65 </bean> 66 67 <!--======= 事务配置 End =================== --> 68 <!-- 配置基于注解的声明式事务 --> 69 <!-- enables scanning for @Transactional annotations --> 70 <tx:annotation-driven transaction-manager="transactionManager" /> 71 72 73 </beans>
4、测试代码,两种方式:
测试1:
1 package org.ssm.dufy.service; 2 3 import org.junit.Test; 4 import org.junit.runner.RunWith; 5 import org.springframework.beans.factory.annotation.Autowired; 6 import org.springframework.test.context.ContextConfiguration; 7 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 8 import org.ssm.dufy.entity.User; 9 10 /** 11 * 配置spring和junit整合,junit启动时加载springIOC容器 spring-test,junit 12 */ 13 @RunWith(SpringJUnit4ClassRunner.class) 14 // 告诉junit spring配置文件 15 @ContextConfiguration({ "classpath:applicationContext.xml"}) 16 public class IUserServiceTest { 17 18 @Autowired 19 public IUserService userService; 20 21 @Test 22 public void getUserByIdTest(){ 23 24 User user = userService.getUserById(1); 25 System.out.println(user.getUserName()); 26 } 27 28 }
测试2
1 package org.ssm.dufy.service; 2 3 import org.springframework.context.ApplicationContext; 4 import org.springframework.context.support.ClassPathXmlApplicationContext; 5 import org.ssm.dufy.entity.User; 6 7 public class IUserServiceTest2 { 8 9 10 public static void main(String[] args) { 11 ApplicationContext application = new ClassPathXmlApplicationContext("applicationContext.xml"); 12 IUserService uService = (IUserService) application.getBean("userService"); 13 User user = uService.getUserById(1); 14 System.out.println(user.getUserName()); 15 } 16 }
5、整合SpringMVC,添加配置,创建jsp
SpringMVC需要的依赖在pom.xml中已经加上了,现在需在Web项目中的web.xml中添加启动SpringMVC启动配置和Spring整合SpringMVC的配置了。
新增如下两个文件:
spring-mvc.xml
1 <?xml version="1.0" encoding="UTF-8"?> 2 <beans xmlns="http://www.springframework.org/schema/beans" 3 xmlns:p="http://www.springframework.org/schema/p" 4 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 5 xmlns:context="http://www.springframework.org/schema/context" 6 xmlns:mvc="http://www.springframework.org/schema/mvc" 7 xsi:schemaLocation=" 8 http://www.springframework.org/schema/beans 9 http://www.springframework.org/schema/beans/spring-beans-3.2.xsd 10 http://www.springframework.org/schema/context 11 http://www.springframework.org/schema/context/spring-context-3.2.xsd 12 http://www.springframework.org/schema/mvc 13 http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd"> 14 15 <!-- 扫描controller(controller层注入) --> 16 <context:component-scan base-package="org.ssm.dufy.web" use-default-filters="false"> 17 <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/> 18 </context:component-scan> 19 20 <mvc:annotation-driven /> 21 22 <!-- 内容协商管理器 --> 23 <!--1、首先检查路径扩展名(如my.pdf);2、其次检查Parameter(如my?format=pdf);3、检查Accept Header--> 24 <bean id="contentNegotiationManager" class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean"> 25 <!-- 扩展名至mimeType的映射,即 /user.json => application/json --> 26 <property name="favorPathExtension" value="true"/> 27 <!-- 用于开启 /userinfo/123?format=json 的支持 --> 28 <property name="favorParameter" value="true"/> 29 <property name="parameterName" value="format"/> 30 <!-- 是否忽略Accept Header --> 31 <property name="ignoreAcceptHeader" value="false"/> 32 33 <property name="mediaTypes"> <!--扩展名到MIME的映射;favorPathExtension, favorParameter是true时起作用 --> 34 <value> 35 json=application/json 36 xml=application/xml 37 html=text/html 38 </value> 39 </property> 40 <!-- 默认的content type --> 41 <property name="defaultContentType" value="text/html"/> 42 </bean> 43 44 45 <!-- 当在web.xml 中 DispatcherServlet使用 <url-pattern>/</url-pattern> 映射时,能映射静态资源 --> 46 <mvc:default-servlet-handler /> 47 <!-- 静态资源映射 --> 48 <mvc:resources mapping="/static/**" location="/WEB-INF/static/"/> 49 50 51 <!-- 对模型视图添加前后缀 --> 52 <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver" 53 p:prefix="/WEB-INF/jsp/" p:suffix=".jsp"/> 54 55 56 </beans>
web.xml
1 <?xml version="1.0" encoding="UTF-8"?> 2 <web-app> 3 <display-name>SSM-DEMO</display-name> 4 <!-- 读取spring配置文件 --> 5 <context-param> 6 <param-name>contextConfigLocation</param-name> 7 <param-value>classpath:applicationContext.xml</param-value> 8 </context-param> 9 10 <!-- 设计路径变量值 11 <context-param> 12 <param-name>webAppRootKey</param-name> 13 <param-value>springmvc.root</param-value> 14 </context-param> 15 --> 16 17 <!-- Spring字符集过滤器 --> 18 <filter> 19 <filter-name>SpringEncodingFilter</filter-name> 20 <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> 21 <init-param> 22 <param-name>encoding</param-name> 23 <param-value>UTF-8</param-value> 24 </init-param> 25 <init-param> 26 <param-name>forceEncoding</param-name> 27 <param-value>true</param-value> 28 </init-param> 29 </filter> 30 <filter-mapping> 31 <filter-name>SpringEncodingFilter</filter-name> 32 <url-pattern>/*</url-pattern> 33 </filter-mapping> 34 35 <!-- 添加日志监听器 --> 36 <context-param> 37 <param-name>logbackConfigLocation</param-name> 38 <param-value>classpath:logback.xml</param-value> 39 </context-param> 40 <listener> 41 <listener-class>ch.qos.logback.ext.spring.web.LogbackConfigListener</listener-class> 42 </listener> 43 44 <listener> 45 <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 46 </listener> 47 48 <!-- springMVC核心配置 --> 49 <servlet> 50 <servlet-name>dispatcherServlet</servlet-name> 51 <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> 52 <init-param> 53 <param-name>contextConfigLocation</param-name> 54 <!--spingMVC的配置路径 --> 55 <param-value>classpath:spring-mvc.xml</param-value> 56 </init-param> 57 <load-on-startup>1</load-on-startup> 58 </servlet> 59 <!-- 拦截设置 --> 60 <servlet-mapping> 61 <servlet-name>dispatcherServlet</servlet-name> 62 <url-pattern>/</url-pattern> 63 </servlet-mapping> 64 65 66 <welcome-file-list> 67 <welcome-file>index.jsp</welcome-file> 68 </welcome-file-list> 69 </web-app>
新增index.jsp文件
1 <%@ page contentType="text/html; charset=utf-8"%> 2 <!doctype html> 3 <html> 4 <body> 5 <h2>Hello World!</h2> 6 </body> 7 </html>
6、启动web服务,测试
将上面的项目添加到Tomcat中,启动,控制台没有报错,并在地址栏访问,http://localhost:8080/quartz。页面显示 Hello World! 项目配置ok!
7、编写Controller,和对应得业务界面
新增UserController ,通过参数传递uid获取用户,若用户存在,跳转到showName.jsp ,若用户不存在,则跳转到error.jsp,并返回提示信息!
1 package org.ssm.dufy.web; 2 3 import javax.servlet.http.HttpServletRequest; 4 5 import org.springframework.beans.factory.annotation.Autowired; 6 import org.springframework.stereotype.Controller; 7 import org.springframework.ui.Model; 8 import org.springframework.web.bind.annotation.RequestMapping; 9 import org.springframework.web.bind.annotation.RequestMethod; 10 import org.springframework.web.bind.annotation.RequestParam; 11 import org.springframework.web.servlet.ModelAndView; 12 import org.ssm.dufy.entity.User; 13 import org.ssm.dufy.service.IUserService; 14 15 @Controller 16 public class UserController { 17 18 @Autowired 19 private IUserService userService; 20 21 @RequestMapping(value="/showname",method=RequestMethod.GET) 22 public String showUserName(@RequestParam("uid") int uid,HttpServletRequest request,Model model){ 23 System.out.println("showname"); 24 User user = userService.getUserById(uid); 25 if(user != null){ 26 request.setAttribute("name", user.getUserName()); 27 model.addAttribute("mame", user.getUserName()); 28 return "showName"; 29 } 30 request.setAttribute("error", "没有找到该用户!"); 31 return "error"; 32 } 33 }
Jsp内容如下:
showName.jsp
1 <%@ page contentType="text/html; charset=utf-8"%> 2 <!doctype html> 3 <html> 4 <head> 5 <title>show name</title> 6 </head> 7 <body> 8 <h1>Welcome</h1> ${name }<h1>访问此页面</h1> 9 10 </body> 11 </html>
error.jsp
1 <%@ page contentType="text/html; charset=utf-8"%> 2 <!doctype html> 3 <html> 4 <head> 5 <title>error page</title> 6 </head> 7 <body> 8 <h2> ${error } </h2> 9 10 </body> 11 </html>
三:遇到的问题
1、找不到UserService,报错
可能是包扫描路径的问题,检查一下Service是否在扫描的范围内
2、jsp接收不到request.setAttribute(“”,”“);内容
查资料说是因为 JSP的版本问题,可以在Jsp 上面添加 <%@ page isELIgnored=”false” %> 或者修改web.xml ,添加version版本!
1 <?xml version="1.0" encoding="UTF-8"?> 2 3 <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 4 xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 5 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" 6 id="WebApp_ID" version="3.0" metadata-complete="true">
四:参考文章
SSM框架——详细整合教程(Spring+SpringMVC+MyBatis)
Mybatis3.x与Spring4.x整合
附:
项目源代码:https://github.com/dufyun/learn-tech-collection/tree/master/ssm