首页 > 代码库 > SSM框架搭建(四) springmvc和mybatis的配置

SSM框架搭建(四) springmvc和mybatis的配置

一:maven引入jar包,配置pox.xml

技术分享
<project    xmlns="http://maven.apache.org/POM/4.0.0"    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">    <modelVersion>4.0.0</modelVersion>    <groupId>maimai.yourMvc</groupId>    <artifactId>yourMvc</artifactId>    <packaging>war</packaging>    <version>0.0.1-SNAPSHOT</version>    <name>yourMvc Maven Webapp</name>    <url>http://maven.apache.org</url>    <properties>        <!-- spring版本号 -->        <spring.version>4.0.2.RELEASE</spring.version>        <!-- mybatis版本号 -->        <mybatis.version>3.2.6</mybatis.version>        <!-- log4j日志文件管理包版本 -->        <slf4j.version>1.7.7</slf4j.version>        <log4j.version>1.2.17</log4j.version>    </properties>    <dependencies>        <dependency>            <groupId>junit</groupId>            <artifactId>junit</artifactId>            <version>4.10</version>            <!-- 表示开发的时候引入,发布的时候不会加载此包 -->            <scope>test</scope>        </dependency>        <!-- spring核心包 -->        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-core</artifactId>            <version>${spring.version}</version>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-web</artifactId>            <version>${spring.version}</version>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-oxm</artifactId>            <version>${spring.version}</version>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-tx</artifactId>            <version>${spring.version}</version>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-jdbc</artifactId>            <version>${spring.version}</version>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-webmvc</artifactId>            <version>${spring.version}</version>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-aop</artifactId>            <version>${spring.version}</version>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-context-support</artifactId>            <version>${spring.version}</version>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-test</artifactId>            <version>${spring.version}</version>        </dependency>        <!-- mybatis核心包 -->        <dependency>            <groupId>org.mybatis</groupId>            <artifactId>mybatis</artifactId>            <version>${mybatis.version}</version>        </dependency>        <!-- mybatis/spring包 -->        <dependency>            <groupId>org.mybatis</groupId>            <artifactId>mybatis-spring</artifactId>            <version>1.2.2</version>        </dependency>        <!-- 导入java ee jar 包 -->        <dependency>            <groupId>javax</groupId>            <artifactId>javaee-api</artifactId>            <version>7.0</version>        </dependency>        <!-- 导入Mysql数据库链接jar包 -->        <dependency>            <groupId>mysql</groupId>            <artifactId>mysql-connector-java</artifactId>            <version>5.1.30</version>        </dependency>        <!-- 导入dbcp的jar包,用来在applicationContext.xml中配置数据库 -->        <dependency>            <groupId>commons-dbcp</groupId>            <artifactId>commons-dbcp</artifactId>            <version>1.2.2</version>        </dependency>        <!-- JSTL标签类 -->        <dependency>            <groupId>jstl</groupId>            <artifactId>jstl</artifactId>            <version>1.2</version>        </dependency>        <!-- 日志文件管理包 -->        <!-- log start -->        <dependency>            <groupId>log4j</groupId>            <artifactId>log4j</artifactId>            <version>${log4j.version}</version>        </dependency>        <!-- 格式化对象,方便输出日志 -->        <dependency>            <groupId>com.alibaba</groupId>            <artifactId>fastjson</artifactId>            <version>1.1.41</version>        </dependency>        <dependency>            <groupId>org.slf4j</groupId>            <artifactId>slf4j-api</artifactId>            <version>${slf4j.version}</version>        </dependency>        <dependency>            <groupId>org.slf4j</groupId>            <artifactId>slf4j-log4j12</artifactId>            <version>${slf4j.version}</version>        </dependency>        <!-- log end -->        <!-- 映入JSON -->        <dependency>            <groupId>org.codehaus.jackson</groupId>            <artifactId>jackson-mapper-asl</artifactId>            <version>1.9.13</version>        </dependency>        <!-- 上传组件包 -->        <dependency>            <groupId>commons-fileupload</groupId>            <artifactId>commons-fileupload</artifactId>            <version>1.3.1</version>        </dependency>        <dependency>            <groupId>commons-io</groupId>            <artifactId>commons-io</artifactId>            <version>2.4</version>        </dependency>        <dependency>            <groupId>commons-codec</groupId>            <artifactId>commons-codec</artifactId>            <version>1.9</version>        </dependency>        <dependency>            <groupId>org.hamcrest</groupId>            <artifactId>hamcrest-core</artifactId>            <version>1.3.RC2</version>        </dependency>        <dependency>            <groupId>org.hamcrest</groupId>            <artifactId>hamcrest-library</artifactId>            <version>1.3.RC2</version>        </dependency>        <dependency>            <groupId>commons-logging</groupId>            <artifactId>commons-logging</artifactId>            <version>1.1.3</version>        </dependency>    </dependencies>    <build>        <finalName>yourMvc</finalName>    </build></project>
View Code

 

SSM框架搭建(四) springmvc和mybatis的配置