spring使用@Transactional注解的事务控制案例

项目结构图

在这里插入图片描述

web.xml

<?xml version="1.0" encoding="utf-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
                      http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
         version="3.0"
         metadata-complete="true">


  <display-name>Archetype Created Web Application</display-name>

  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:applicationContext.xml</param-value>
  </context-param>

  <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>
  
  <servlet>
    <servlet-name>springmvc</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>classpath:springmvc-servlet.xml</param-value>
    </init-param>
  </servlet>
  <servlet-mapping>
    <servlet-name>springmvc</servlet-name>
    <url-pattern>/</url-pattern>
  </servlet-mapping>

  
  <filter>
    <filter-name>characterEncodingFilter</filter-name>
    <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
    <init-param>
      <param-name>encoding</param-name>
      <param-value>utf-8</param-value>
    </init-param>
    <init-param>
      <param-name>forceEncoding</param-name>
      <param-value>true</param-value>
    </init-param>
  </filter>
  <filter-mapping>
    <filter-name>characterEncodingFilter</filter-name>
    <url-pattern>/</url-pattern>
  </filter-mapping>
  
</web-app>

springmvc-servlet.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:http="http://www.springframework.org/schema/c"
       xsi:schemaLocation="
        http://www.springframework.org/schema/beans
        https://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/mvc
        https://www.springframework.org/schema/mvc/spring-mvc.xsd
        http://www.springframework.org/schema/context
        https://www.springframework.org/schema/context/spring-context.xsd">

    <!--只扫描controller注解-->
    <context:component-scan base-package="com.mybatisStudyDay04.**.web">
        <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
    </context:component-scan>

    <!--启用MVC配置-->
    <mvc:annotation-driven/>

    <!--配置视图解析器-->
    <bean id="internalResourceViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/WEB-INF/com/orderManag"/>
        <property name="suffix" value=".jsp"/>
    </bean>

</beans>

applicationContext.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:http="http://www.springframework.org/schema/c"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xsi:schemaLocation="
        http://www.springframework.org/schema/beans
        https://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context
        https://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/tx
        http://www.springframework.org/schema/tx/spring-tx.xsd
        http://www.springframework.org/schema/aop
        http://www.springframework.org/schema/aop/spring-aop.xsd">


    <!--配置自动化扫描机制,controlle注解不扫描-->
    <context:component-scan base-package="com.mybatisStudyDay04.transaction">
        <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
    </context:component-scan>

    <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
        <property name="driverClass" value="com.mysql.jdbc.Driver"/>
        <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/order?useUnicode=true&amp;characterEncoding=UTF-8"/>
        <property name="user" value="root"/>
        <property name="password" value="root"/>
    </bean>

    <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
        <property name="dataSource" ref="dataSource"/>
        <property name="configLocation" value="classpath:mybatis-config.xml"/>
    </bean>

    <!--配置数据源事务管理器-->
    <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
        <property name="dataSource" ref="dataSource"/>
    </bean>

    <tx:annotation-driven transaction-manager="transactionManager"/>

    <bean id="mapperScannerConfigurer" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
        <property name="basePackage" value="com.mybatisStudyDay04.**.dao"/>
        <property name="annotationClass" value="org.springframework.stereotype.Repository"/>
    </bean>
</beans>

mybatis-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration
        PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
    <!-- logImple属性配置指定使用LOG4J输出日志 -->
    <settings>
        <setting name="logImpl" value="LOG4J"/>
    </settings>

    <mappers>
        <package name="com.mybatisStudyDay04.transaction.dao"/>
    </mappers>
</configuration>

log4j.properties

#全局配置
log4j.rootLogger=info, stdout
log4j.logger.org.springframework=INFO
#控制台输出配置
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern= %d{yyyy-MM-dd HH:mm:ss} <%p> %l %m%n

SysUserController.java

@Controller
@RequestMapping("/sysUserController")
public class SysUserController {

    private static final Logger log = Logger.getLogger("SysUserController.class");

    @Autowired
    private ISysUserService sysUserServiceImpl;

    @RequestMapping(value = "/updateSysUserById",method = RequestMethod.GET)
    public void updateSysUserById(){
        log.info("SysUserController updateSysUserById begin");
        sysUserServiceImpl.updateSysUserById();
    }
}

ISysUserService.java

public interface ISysUserService {

    void updateSysUserById();

    void updateTest();
}

SysUserServiceImpl.java

@Service("sysUserServiceImpl")
public class SysUserServiceImpl implements ISysUserService {

    private static final Logger log = Logger.getLogger("SysUserServiceImpl.class");

    @Autowired
    private ISysUserDao sysUserDaoImpl;

    @Override
    @Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.READ_COMMITTED)
    public void updateSysUserById(){
        log.info("SysUserServiceImpl updateSysUserById begin");

        try{
            SysUserVO sysUserVo1 = new SysUserVO();
            sysUserVo1.setId("1");
            sysUserVo1.setUserNum("20052301");
            sysUserVo1.setUserName("小王");
            sysUserDaoImpl.updateByPrimaryKeySelective(sysUserVo1);
            int i = 1/0;
            SysUserVO sysUserVo2 = new SysUserVO();
            sysUserVo2.setId("10");
            sysUserVo2.setUserNum("20052310");
            sysUserVo2.setUserName("老9");
            sysUserDaoImpl.updateByPrimaryKeySelective(sysUserVo2);
        }catch (RuntimeException e){
            throw new RuntimeException();
        }
    }

    @Override
    @Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.READ_COMMITTED)
    public void updateTest(){
        log.info("SysUserServiceImpl updateSysUserById begin");
        try{
            SysUserVO sysUserVo1 = new SysUserVO();
            sysUserVo1.setId("1");
            sysUserVo1.setUserNum("20052301");
            sysUserVo1.setUserName("小王");
            sysUserDaoImpl.updateByPrimaryKeySelective(sysUserVo1);
            int i = 1/0;
            SysUserVO sysUserVo2 = new SysUserVO();
            sysUserVo2.setId("10");
            sysUserVo2.setUserNum("20052310");
            sysUserVo2.setUserName("老9");
            sysUserDaoImpl.updateByPrimaryKeySelective(sysUserVo2);
        }catch (RuntimeException e){
            throw new RuntimeException();
        }
    }

}

ISysUserDao.java

@Repository("sysUserDaoImpl")
public interface ISysUserDao {
    int deleteUserInfo(String[] idArray);

    int deleteByPrimaryKey(@Param("id") String id, @Param("userNum") String userNum);

    int insert(SysUserVO record);

    int insertSelective(SysUserVO record);

    SysUserVO selectByPrimaryKey(@Param("id") String id);

    List<SysUserVO> queryUserAll();

    List<SysUserVO> queryUserAllOffPage(SysUserVO sysUserVO);

    Integer queryUserAllOffPageCount(SysUserVO sysUserVO);

    int updateByPrimaryKeySelective(SysUserVO record);

    int updateByPrimaryKey(SysUserVO record);
}

ISysUserDao.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mybatisStudyDay04.transaction.dao.ISysUserDao">
    <resultMap id="BaseResultMap" type="com.mybatisStudyDay04.transaction.vo.SysUserVO">
        <id column="ID" jdbcType="VARCHAR" property="id" />
        <result column="USER_NUM" jdbcType="VARCHAR" property="userNum" />
        <result column="USER_NAME" jdbcType="VARCHAR" property="userName" />
        <result column="PASSWORD" jdbcType="VARCHAR" property="password" />
        <result column="USER_MOTTO" jdbcType="VARCHAR" property="userMotto" />
        <result column="TELEPHONE" jdbcType="VARCHAR" property="telephone" />
        <result column="ADDRESS" jdbcType="VARCHAR" property="address" />
        <result column="EMAIL" jdbcType="VARCHAR" property="eMail" />
        <result column="ICON_NUM" jdbcType="VARCHAR" property="iconNum" />
        <result column="USER_SEX" jdbcType="CHAR" property="userSex" />
        <result column="LAST_SIGIN_TIME" jdbcType="DATE" property="lastSiginTime" />
        <result column="LOGIN_NUMBERS" jdbcType="INTEGER" property="loginNumbers" />
        <result column="CREATE_NAME" jdbcType="VARCHAR" property="createName" />
        <result column="CREATE_NUM" jdbcType="VARCHAR" property="createNum" />
        <result column="UPDATE_NAME" jdbcType="VARCHAR" property="updateName" />
        <result column="UPDATE_NUM" jdbcType="VARCHAR" property="updateNum" />
        <result column="CREAT_TIME" jdbcType="DATE" property="creatTime" />
        <result column="UPDATE_TIME" jdbcType="DATE" property="updateTime" />
        <result column="STATE" jdbcType="CHAR" property="state" />
    </resultMap>
    <sql id="Base_Column_List">
    ID, USER_NUM, USER_NAME, PASSWORD, USER_MOTTO, TELEPHONE, ADDRESS, EMAIL, ICON_NUM,
    USER_SEX, LAST_SIGIN_TIME, LOGIN_NUMBERS, CREATE_NAME, CREATE_NUM, UPDATE_NAME, UPDATE_NUM,
    CREAT_TIME, UPDATE_TIME, STATE
    </sql>

    <select id="queryUserAll" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from sys_user
    </select>

    <select id="queryUserAllOffPage" resultMap="BaseResultMap">
        select
        ID, USER_NUM, USER_NAME, PASSWORD, USER_MOTTO, TELEPHONE, ADDRESS, EMAIL, ICON_NUM,
        USER_SEX, LAST_SIGIN_TIME, LOGIN_NUMBERS, CREATE_NAME, CREATE_NUM, UPDATE_NAME, UPDATE_NUM,
        CREAT_TIME, UPDATE_TIME, STATE
        from sys_user
        <where>
            <if test="userNum != null and userNum != ''"> and USER_NUM = #{userNum} </if>
            <if test="userName != null and userName != ''"> and USER_NAME like concat(concat('%',#{userName}),'%')</if>
            <if test="userSex != null and userSex != ''"> and USER_SEX = #{userSex} </if>
        </where>
        limit #{startIndex},#{queryCount}
    </select>

    <select id="queryUserAllOffPageCount" resultType="int">
        select count(id) from sys_user
        <where>
            <if test="userNum != null and userNum != ''"> and USER_NUM = #{userNum} </if>
            <if test="userName != null and userName != ''"> and USER_NAME like concat(concat('%',#{userName}),'%')</if>
            <if test="userSex != null and userSex != ''"> and USER_SEX = #{userSex} </if>
        </where>
    </select>

    <select id="selectByPrimaryKey" parameterType="map" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from sys_user where ID = #{id,jdbcType=VARCHAR}
    </select>

    <delete id="deleteByPrimaryKey" parameterType="map">
    delete from sys_user
    where ID = #{id,jdbcType=VARCHAR}
      and USER_NUM = #{userNum,jdbcType=VARCHAR}
  </delete>

    <delete id="deleteUserInfo" parameterType="java.lang.String">
        delete from sys_user where id in
        <foreach collection="array" item="id" open="(" close=")" separator="," index="i">
            #{id}
        </foreach>
    </delete>

    <insert id="insert" parameterType="com.mybatisStudyDay04.transaction.vo.SysUserVO">
    insert into sys_user (ID, USER_NUM, USER_NAME,
      PASSWORD, USER_MOTTO, TELEPHONE,
      ADDRESS, EMAIL, ICON_NUM,
      USER_SEX, LAST_SIGIN_TIME, LOGIN_NUMBERS,
      CREATE_NAME, CREATE_NUM, UPDATE_NAME,
      UPDATE_NUM, CREAT_TIME, UPDATE_TIME,
      STATE)
    values (#{id,jdbcType=VARCHAR}, #{userNum,jdbcType=VARCHAR}, #{userName,jdbcType=VARCHAR},
      #{password,jdbcType=VARCHAR}, #{userMotto,jdbcType=VARCHAR}, #{telephone,jdbcType=VARCHAR},
      #{address,jdbcType=VARCHAR}, #{eMail,jdbcType=VARCHAR}, #{iconNum,jdbcType=VARCHAR},
      #{userSex,jdbcType=CHAR}, #{lastSiginTime,jdbcType=DATE}, #{loginNumbers,jdbcType=INTEGER},
      #{createName,jdbcType=VARCHAR}, #{createNum,jdbcType=VARCHAR}, #{updateName,jdbcType=VARCHAR},
      #{updateNum,jdbcType=VARCHAR}, #{creatTime,jdbcType=DATE}, #{updateTime,jdbcType=DATE},
      #{state,jdbcType=CHAR})
  </insert>
    <insert id="insertSelective" parameterType="com.mybatisStudyDay04.transaction.vo.SysUserVO">
        insert into sys_user
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                ID,
            </if>
            <if test="userNum != null">
                USER_NUM,
            </if>
            <if test="userName != null">
                USER_NAME,
            </if>
            <if test="password != null">
                PASSWORD,
            </if>
            <if test="userMotto != null">
                USER_MOTTO,
            </if>
            <if test="telephone != null">
                TELEPHONE,
            </if>
            <if test="address != null">
                ADDRESS,
            </if>
            <if test="eMail != null">
                EMAIL,
            </if>
            <if test="iconNum != null">
                ICON_NUM,
            </if>
            <if test="userSex != null">
                USER_SEX,
            </if>
            <if test="lastSiginTime != null">
                LAST_SIGIN_TIME,
            </if>
            <if test="loginNumbers != null">
                LOGIN_NUMBERS,
            </if>
            <if test="createName != null">
                CREATE_NAME,
            </if>
            <if test="createNum != null">
                CREATE_NUM,
            </if>
            <if test="updateName != null">
                UPDATE_NAME,
            </if>
            <if test="updateNum != null">
                UPDATE_NUM,
            </if>
            <if test="creatTime != null">
                CREAT_TIME,
            </if>
            <if test="updateTime != null">
                UPDATE_TIME,
            </if>
            <if test="state != null">
                STATE,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">
                #{id,jdbcType=VARCHAR},
            </if>
            <if test="userNum != null">
                #{userNum,jdbcType=VARCHAR},
            </if>
            <if test="userName != null">
                #{userName,jdbcType=VARCHAR},
            </if>
            <if test="password != null">
                #{password,jdbcType=VARCHAR},
            </if>
            <if test="userMotto != null">
                #{userMotto,jdbcType=VARCHAR},
            </if>
            <if test="telephone != null">
                #{telephone,jdbcType=VARCHAR},
            </if>
            <if test="address != null">
                #{address,jdbcType=VARCHAR},
            </if>
            <if test="eMail != null">
                #{eMail,jdbcType=VARCHAR},
            </if>
            <if test="iconNum != null">
                #{iconNum,jdbcType=VARCHAR},
            </if>
            <if test="userSex != null">
                #{userSex,jdbcType=CHAR},
            </if>
            <if test="lastSiginTime != null">
                #{lastSiginTime,jdbcType=DATE},
            </if>
            <if test="loginNumbers != null">
                #{loginNumbers,jdbcType=INTEGER},
            </if>
            <if test="createName != null">
                #{createName,jdbcType=VARCHAR},
            </if>
            <if test="createNum != null">
                #{createNum,jdbcType=VARCHAR},
            </if>
            <if test="updateName != null">
                #{updateName,jdbcType=VARCHAR},
            </if>
            <if test="updateNum != null">
                #{updateNum,jdbcType=VARCHAR},
            </if>
            <if test="creatTime != null">
                #{creatTime,jdbcType=DATE},
            </if>
            <if test="updateTime != null">
                #{updateTime,jdbcType=DATE},
            </if>
            <if test="state != null">
                #{state,jdbcType=CHAR},
            </if>
        </trim>
    </insert>
    <update id="updateByPrimaryKeySelective" parameterType="com.mybatisStudyDay04.transaction.vo.SysUserVO">
        update sys_user
        <set>
            <if test="userName != null">
                USER_NAME = #{userName,jdbcType=VARCHAR},
            </if>
            <if test="password != null">
                PASSWORD = #{password,jdbcType=VARCHAR},
            </if>
            <if test="userMotto != null">
                USER_MOTTO = #{userMotto,jdbcType=VARCHAR},
            </if>
            <if test="telephone != null">
                TELEPHONE = #{telephone,jdbcType=VARCHAR},
            </if>
            <if test="address != null">
                ADDRESS = #{address,jdbcType=VARCHAR},
            </if>
            <if test="eMail != null">
                EMAIL = #{eMail,jdbcType=VARCHAR},
            </if>
            <if test="iconNum != null">
                ICON_NUM = #{iconNum,jdbcType=VARCHAR},
            </if>
            <if test="userSex != null">
                USER_SEX = #{userSex,jdbcType=CHAR},
            </if>
            <if test="lastSiginTime != null">
                LAST_SIGIN_TIME = #{lastSiginTime,jdbcType=DATE},
            </if>
            <if test="loginNumbers != null">
                LOGIN_NUMBERS = #{loginNumbers,jdbcType=INTEGER},
            </if>
            <if test="createName != null">
                CREATE_NAME = #{createName,jdbcType=VARCHAR},
            </if>
            <if test="createNum != null">
                CREATE_NUM = #{createNum,jdbcType=VARCHAR},
            </if>
            <if test="updateName != null">
                UPDATE_NAME = #{updateName,jdbcType=VARCHAR},
            </if>
            <if test="updateNum != null">
                UPDATE_NUM = #{updateNum,jdbcType=VARCHAR},
            </if>
            <if test="creatTime != null">
                CREAT_TIME = #{creatTime,jdbcType=DATE},
            </if>
            <if test="updateTime != null">
                UPDATE_TIME = #{updateTime,jdbcType=DATE},
            </if>
            <if test="state != null">
                STATE = #{state,jdbcType=CHAR},
            </if>
        </set>
        where ID = #{id,jdbcType=VARCHAR}
        and USER_NUM = #{userNum,jdbcType=VARCHAR}
    </update>
    <update id="updateByPrimaryKey" parameterType="com.mybatisStudyDay04.transaction.vo.SysUserVO">
    update sys_user
    set USER_NAME = #{userName,jdbcType=VARCHAR},
      PASSWORD = #{password,jdbcType=VARCHAR},
      USER_MOTTO = #{userMotto,jdbcType=VARCHAR},
      TELEPHONE = #{telephone,jdbcType=VARCHAR},
      ADDRESS = #{address,jdbcType=VARCHAR},
      EMAIL = #{eMail,jdbcType=VARCHAR},
      ICON_NUM = #{iconNum,jdbcType=VARCHAR},
      USER_SEX = #{userSex,jdbcType=CHAR},
      LAST_SIGIN_TIME = #{lastSiginTime,jdbcType=DATE},
      LOGIN_NUMBERS = #{loginNumbers,jdbcType=INTEGER},
      CREATE_NAME = #{createName,jdbcType=VARCHAR},
      CREATE_NUM = #{createNum,jdbcType=VARCHAR},
      UPDATE_NAME = #{updateName,jdbcType=VARCHAR},
      UPDATE_NUM = #{updateNum,jdbcType=VARCHAR},
      CREAT_TIME = #{creatTime,jdbcType=DATE},
      UPDATE_TIME = #{updateTime,jdbcType=DATE},
      STATE = #{state,jdbcType=CHAR}
    where ID = #{id,jdbcType=VARCHAR}
      and USER_NUM = #{userNum,jdbcType=VARCHAR}
  </update>
</mapper>

index.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
    <a href="<%=request.getContextPath()%>/sysUserController/updateSysUserById">点击</a>
</body>
</html>

pom.xml

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

<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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>org.suda</groupId>
  <artifactId>mybatisStudy_Transaction01</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>war</packaging>

  <name>mybatisStudy_Transaction01 Maven Webapp</name>
  <!-- FIXME change it to the project's website -->
  <url>http://www.example.com</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.7</maven.compiler.source>
    <maven.compiler.target>1.7</maven.compiler.target>
    <!--版本锁定-->
    <spring.version>5.2.5.RELEASE</spring.version>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-context</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-test</artifactId>
      <version>${spring.version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-aspects</artifactId>
      <version>${spring.version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-beans</artifactId>
      <version>${spring.version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-core</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-messaging</artifactId>
      <version>${spring.version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-orm</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-expression</artifactId>
      <version>${spring.version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-instrument</artifactId>
      <version>${spring.version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-jms</artifactId>
      <version>${spring.version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-websocket</artifactId>
      <version>${spring.version}</version>
    </dependency>
    <dependency>
      <groupId>cglib</groupId>
      <artifactId>cglib</artifactId>
      <version>3.2.5</version>
    </dependency>


    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <version>4.0.1</version>
    </dependency>
    <dependency>
      <groupId>javax.servlet.jsp</groupId>
      <artifactId>jsp-api</artifactId>
      <version>2.0</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>javax.servlet.jsp.jstl</groupId>
      <artifactId>jstl-api</artifactId>
      <version>1.2</version>
      <exclusions>
        <exclusion>
          <artifactId>jsp-api</artifactId>
          <groupId>javax.servlet.jsp</groupId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>javax.servlet.jsp.jstl</groupId>
      <artifactId>jstl-api</artifactId>
      <version>1.2</version>
      <exclusions>
        <exclusion>
          <artifactId>jsp-api</artifactId>
          <groupId>javax.servlet.jsp</groupId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.mybatis</groupId>
      <artifactId>mybatis-spring</artifactId>
      <version>1.3.1</version>
    </dependency>

<!--    <dependency>-->
<!--      <groupId>org.aspectj</groupId>-->
<!--      <artifactId>aspectjweaver</artifactId>-->
<!--      <version>1.9.2</version>-->
<!--    </dependency>-->

    <dependency>
      <groupId>org.mybatis</groupId>
      <artifactId>mybatis</artifactId>
      <version>3.4.0</version>
    </dependency>
    <dependency>
      <groupId>org.mybatis.generator</groupId>
      <artifactId>mybatis-generator-core</artifactId>
      <version>1.4.0</version>
    </dependency>
    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <version>5.1.28</version>
    </dependency>

    <dependency>
      <groupId>com.mchange</groupId>
      <artifactId>c3p0</artifactId>
      <version>0.9.5</version>
    </dependency>
    <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
      <version>1.2.17</version>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.11</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <finalName>mybatisStudy_Transaction01</finalName>
    <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
      <plugins>
        <plugin>
          <artifactId>maven-clean-plugin</artifactId>
          <version>3.1.0</version>
        </plugin>
        <!-- see http://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_war_packaging -->
        <plugin>
          <artifactId>maven-resources-plugin</artifactId>
          <version>3.0.2</version>
        </plugin>
        <plugin>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.8.0</version>
        </plugin>
        <plugin>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.22.1</version>
        </plugin>
        <plugin>
          <artifactId>maven-war-plugin</artifactId>
          <version>3.2.2</version>
        </plugin>
        <plugin>
          <artifactId>maven-install-plugin</artifactId>
          <version>2.5.2</version>
        </plugin>
        <plugin>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>2.8.2</version>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
</project>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值