springmvc mybatis maven 整合 事例

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了springmvc mybatis maven 整合 事例相关的知识,希望对你有一定的参考价值。

最近做了个maven管理的springmvc+spring+mybatis,还用到了阿里巴巴的 fastjson和druid连接池,配置文件如下

pom.xml文件

[htmlview plain copy 技术分享技术分享

  1. <?xml version="1.0" encoding="UTF-8"?>  

  2. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  

  3.     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">  

  4.     <modelVersion>4.0.0</modelVersion>  

  5.     <groupId>com.dahafo.demo</groupId>  

  6.     <name>um</name>  

  7.     <packaging>war</packaging>  

  8.     <version>1.0.0-BUILD-SNAPSHOT</version>  

  9.     <properties>  

  10.         <java-version>1.7</java-version>  

  11.         <org.springframework-version>3.2.3.RELEASE</org.springframework-version>  

  12.         <org.aspectj-version>1.6.10</org.aspectj-version>  

  13.         <org.slf4j-version>1.6.6</org.slf4j-version>  

  14.     </properties>  

  15.     <dependencies>  

  16.         <!-- Spring -->  

  17.         <dependency>  

  18.             <groupId>org.springframework</groupId>  

  19.             <artifactId>spring-context</artifactId>  

  20.             <version>${org.springframework-version}</version>  

  21.             <exclusions>  

  22.                 <!-- Exclude Commons Logging in favor of SLF4j -->  

  23.                 <exclusion>  

  24.                     <groupId>commons-logging</groupId>  

  25.                     <artifactId>commons-logging</artifactId>  

  26.                  </exclusion>  

  27.             </exclusions>  

  28.         </dependency>  

  29.         <dependency>  

  30.             <groupId>org.springframework</groupId>  

  31.             <artifactId>spring-webmvc</artifactId>  

  32.             <version>${org.springframework-version}</version>  

  33.         </dependency>  

  34.         <dependency>  

  35.             <groupId>org.springframework</groupId>  

  36.             <artifactId>spring-jdbc</artifactId>  

  37.             <version>${org.springframework-version}</version>  

  38.         </dependency>  

  39.                   

  40.         <!-- AspectJ -->  

  41.         <dependency>  

  42.             <groupId>org.aspectj</groupId>  

  43.             <artifactId>aspectjrt</artifactId>  

  44.             <version>${org.aspectj-version}</version>  

  45.         </dependency>   

  46.           

  47.         <!-- Logging -->  

  48.         <dependency>  

  49.             <groupId>org.slf4j</groupId>  

  50.             <artifactId>slf4j-api</artifactId>  

  51.             <version>${org.slf4j-version}</version>  

  52.         </dependency>  

  53.         <dependency>  

  54.             <groupId>org.slf4j</groupId>  

  55.             <artifactId>jcl-over-slf4j</artifactId>  

  56.             <version>${org.slf4j-version}</version>  

  57.             <scope>runtime</scope>  

  58.         </dependency>  

  59.         <dependency>  

  60.             <groupId>org.slf4j</groupId>  

  61.             <artifactId>slf4j-log4j12</artifactId>  

  62.             <version>${org.slf4j-version}</version>  

  63.             <scope>runtime</scope>  

  64.         </dependency>  

  65.         <dependency>  

  66.             <groupId>log4j</groupId>  

  67.             <artifactId>log4j</artifactId>  

  68.             <version>1.2.15</version>  

  69.             <exclusions>  

  70.                 <exclusion>  

  71.                     <groupId>javax.mail</groupId>  

  72.                     <artifactId>mail</artifactId>  

  73.                 </exclusion>  

  74.                 <exclusion>  

  75.                     <groupId>javax.jms</groupId>  

  76.                     <artifactId>jms</artifactId>  

  77.                 </exclusion>  

  78.                 <exclusion>  

  79.                     <groupId>com.sun.jdmk</groupId>  

  80.                     <artifactId>jmxtools</artifactId>  

  81.                 </exclusion>  

  82.                 <exclusion>  

  83.                     <groupId>com.sun.jmx</groupId>  

  84.                     <artifactId>jmxri</artifactId>  

  85.                 </exclusion>  

  86.             </exclusions>  

  87.             以上是关于springmvc mybatis maven 整合 事例的主要内容,如果未能解决你的问题,请参考以下文章

    maven+springMVC+mybatis 搭建过程

    Maven构建 SpringMVC+Spring+MyBatis 环境整合

    springmvc学习总结 -- maven+springmvc+spring+mybatis+mysql详细搭建整合过程讲解

    使用intellij idea搭建MAVEN+springmvc+mybatis框架

    Maven搭建SpringMVC+Mybatis项目详解

    Maven搭建SpringMVC+Mybatis项目详解