用 Eclipse 搭建一个简单的 Maven spring mybatis 项目(包含测试用例)

 

1: 先搭建一个Maven项目:

创建好后的目录:

2: 配置pom.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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.etoak</groupId>
  <artifactId>msm02</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  
        <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
        <spring.version>4.2.5.RELEASE</spring.version>
        <mybatis.version>3.4.4</mybatis.version>
        <mybatisspring.version>1.3.1</mybatisspring.version>
        <jackson.version>2.7.0</jackson.version>
        <log4j.version>1.2.17</log4j.version>
        <slf4j.version>1.7.7</slf4j.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <!-- <scope>test</scope> -->
        </dependency>

        <!-- javaEE -->
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-api</artifactId>
            <version>7.0</version>
        </dependency>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-web-api</artifactId>
            <version>7.0</version>
        </dependency>

        <!-- servlet start -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>
        <!-- servlet end -->
        
        <!-- spring start -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</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-context</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-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-aspects</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-tx</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-orm</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-jpa</artifactId>
            <version>1.10.1.RELEASE</version>
        </dependency>
        <!-- spring end -->

        <!-- mybatis start -->
        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis</artifactId>
            <version>${mybatis.version}</version>
        </dependency>
        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis-spring</artifactId>
            <version>${mybatisspring.version}</version>
        </dependency>
        <!-- mybatis end -->

        <!-- 数据库 start -->
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid</artifactId>
            <version>1.0.29</version>
        </dependency>
        <dependency>
            <groupId>commons-dbcp</groupId>
            <artifactId>commons-dbcp</artifactId>
            <version>1.4</version>
        </dependency>
        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc14</artifactId>
            <version>10.2.0.4.0</version>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.35</version>
        </dependency>
        <!-- 数据库 end -->

        <!-- servlet start -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>3.0-alpha-1</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>
        <!-- servlet end -->

        <!-- json start (fastjson & jackjson) -->
        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-mapper-asl</artifactId>
            <version>1.9.13</version>
        </dependency>
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
            <version>1.2.31</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <!-- json end -->

        <!-- log4j start -->
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>${log4j.version}</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>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>5.2.4.Final</version>
        </dependency>
        <!-- log4j end -->

    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.6.1</version>
                <configuration>
                    <skipTests>true</skipTests>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
        <finalName>msm02</finalName>  <!-- 这里是 项目名 -->
    </build>
</project>

3:  在 resources 目录下 创建  applicationContext.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"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/mvc 
       http://www.springframework.org/schema/mvc/spring-mvc.xsd 
       http://www.springframework.org/schema/context 
       http://www.springframework.org/schema/context/spring-context.xsd 
       http://www.springframework.org/schema/aop 
       http://www.springframework.org/schema/aop/spring-aop.xsd 
       http://www.springframework.org/schema/tx 
       http://www.springframework.org/schema/tx/spring-tx.xsd
       ">
       
    <!-- 采用注释的方式配置bean -->
    <context:annotation-config />
    <!-- 自动扫描注解 -->
    <context:component-scan base-package="com.etoak.msm" />
      
     <!-- 配置log4j -->  
    <bean id="log4jInitialization" class="com.etoak.msm.common.log4j.MytMethodInvokingFactoryBean">
        <property name="targetClass" value="org.springframework.util.Log4jConfigurer" />
        <property name="targetMethod" value="initLogging" />
        <property name="arguments">
            <list>
                <value>classpath:config/properties/log4j.properties</value>
            </list>
        </property>
    </bean>   
       
    <!--导入DAO配置  -->
    <import resource="config/xml/mybatis-dao.xml"/>
    <!--导入数据库配置  -->
    <import resource="config/xml/mybatis-db.xml"/>
    <!--导入数据库事务配置  -->
    <import resource="config/xml/spring-tx.xml"/>
       
</beans>

下面是一大波 配置文件:

mybatis-dao.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"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/context 
       http://www.springframework.org/schema/context/spring-context.xsd 
       ">
  
      <!-- mapper扫描配置扫描器 -->
    <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
        <!-- 扫描com.etoak.mssm这个包以及它的子包下的所有映射接口类 -->
        <property name="basePackage" value="com.etoak.msm.emp.dao" />
        <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />  <!-- 如果报错Invalid bound statement (not found): 请参考:  https://my.oschina.net/psuyun/blog/464851 -->
    </bean>     

</beans>

mybatis-db.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"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/context 
       http://www.springframework.org/schema/context/spring-context.xsd 
       ">
  
    <!--引入配置属性文件      -->  
    <context:property-placeholder location="config/properties/oracle.properties" />
    
    <!-- 配置数据源,-->
    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
        destroy-method="close">
        <property name="driverClassName" value="${driver}" />
        <property name="url" value="${url}" />
        <property name="username" value="${uname}" />
        <property name="password" value="${password}" />
        <!-- 初始化连接大小 -->
        <property name="initialSize" value="${initialSize}"></property>
        <!-- 连接池最大数量 -->
        <property name="maxActive" value="${maxActive}"></property>
        <!-- 连接池最大空闲 -->
        <property name="maxIdle" value="${maxIdle}"></property>
        <!-- 连接池最小空闲 -->
        <property name="minIdle" value="${minIdle}"></property>
        <!-- 获取连接最大等待时间 -->
        <property name="maxWait" value="${maxWait}"></property>
    </bean>

    <!-- 配置sqlSessionFactory -->
    <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
        <property name="dataSource" ref="dataSource" /><!-- 实例化sqlSessionFactory时需要使用上述配置好的数据源以及SQL映射文件 -->
        <property name="mapperLocations" value="classpath*:mybatis/mappers/**/*.xml" /><!-- spring和MyBatis完美整合,不需要mybatis的配置映射文件 -->
    </bean>

    <!-- 定义SqlSessionTemplate -->
    <bean id="sqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate">
        <constructor-arg index="0" ref="sqlSessionFactory"></constructor-arg>
    </bean>

    <!-- SqlSession:用于执行持久化操作的对象,类似于jdbc中的Connection。  -->
    <!-- SqlSessionFactory:创建SqlSession实例的工厂 -->
    <!-- SqlSessionFactoryBuilder:build方法创建SqlSessionFactory实例。 -->
    <!-- SqlSessionTemplate:MyBatis提供的持久层访问模板化的工具,线程安全,可通过构造参数或依赖注入SqlSessionFactory实例。 -->
    
</beans>

spring-tx.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"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.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/aop 
       http://www.springframework.org/schema/aop/spring-aop.xsd 
       http://www.springframework.org/schema/tx 
       http://www.springframework.org/schema/tx/spring-tx.xsd
       ">
       
    <!-- (事务管理)transaction manager, use JtaTransactionManager for global tx -->
    <bean id="transactionManager"
        class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
        <property name="dataSource" ref="dataSource" />
    </bean>
       
</beans>

 

log4j.properties

log4j.rootLogger=DEBUG,Console,Stdout  

#[Level]  DEBUG
log4j.logger.java.sql.ResultSet=INFO  
log4j.logger.org.apache=INFO  
log4j.logger.java.sql.Connection=DEBUG  
log4j.logger.java.sql.Statement=DEBUG  
log4j.logger.java.sql.PreparedStatement=DEBUG 

#Console  
log4j.appender.Console=org.apache.log4j.ConsoleAppender  
log4j.appender.Console.layout=org.apache.log4j.PatternLayout  
log4j.appender.Console.layout.ConversionPattern=%d [%t] %-5p [%c] - %m%n  

#stdout  \u6807\u51C6\u8F93\u51FA  
log4j.appender.Stdout = org.apache.log4j.DailyRollingFileAppender    
log4j.appender.Stdout.File = E://logs/log.log    
log4j.appender.Stdout.Append = true    
log4j.appender.Stdout.Threshold = DEBUG     
log4j.appender.Stdout.layout = org.apache.log4j.PatternLayout    
log4j.appender.Stdout.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss}  [ %t:%r ] - [ %p ]  %m%n    

oracle.properties

driver=oracle.jdbc.driver.OracleDriver
url=jdbc:oracle:thin:@127.0.0.1:1521:orcl
uname=scott
password=tiger
initialSize=0
maxActive=20 
maxIdle=20
minIdle=1 
maxWait=60000

再来看一下 项目结构:  【注意红色圆圈内是有两层】

来  再把java 文件的代码 贴上;

先贴 common 目录:

common 下面的 log4j  目录:

MytMethodInvokingFactoryBean.java  主要功能就是 服务日志的

package com.etoak.msm.common.log4j;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.config.MethodInvokingFactoryBean;

public class MytMethodInvokingFactoryBean extends MethodInvokingFactoryBean implements InitializingBean {
    @Override
    public void afterPropertiesSet() throws Exception {
        super.afterPropertiesSet();
        Object[] args = getArguments();
        for (int i = 0; i < args.length; i++) {
            Object obj = args[i];
            if (obj instanceof String) {
                String arg =obj.toString();
                if(arg.startsWith("classpath:")||arg.startsWith("classpath*:")){
                    arg=arg.split(":")[1];
                    arg=this.getClass().getClassLoader().getResource(arg).getPath();
                    args[i]=arg;
                }
            }
        }
        setArguments(args);
    }
}

再来 emp 目录

dao 目录:

package com.etoak.msm.emp.dao;

import java.util.List;

import com.etoak.msm.emp.entity.Emp;

public interface EmpDao {

    public int addEmp(Emp emp);
    public List<Emp> getEmps(Emp emp);
    public Emp getEmpByEmpno(int empno);
    
}

entity  实体类目录

package com.etoak.msm.emp.entity;

import java.util.Date;

public class Emp {

    private int empno ;
    private String ename ;
    private String  job ;
    private int mgr ;
    private Date hiredate ;
    private int sal ;
    private int comm ;
    private int deptno ;
    
    
    public int getEmpno() {
        return empno;
    }
    public void setEmpno(int empno) {
        this.empno = empno;
    }
    public String getEname() {
        return ename;
    }
    public void setEname(String ename) {
        this.ename = ename;
    }
    public String getJob() {
        return job;
    }
    public void setJob(String job) {
        this.job = job;
    }
    public int getMgr() {
        return mgr;
    }
    public void setMgr(int mgr) {
        this.mgr = mgr;
    }
    public Date getHiredate() {
        return hiredate;
    }
    public void setHiredate(Date hiredate) {
        this.hiredate = hiredate;
    }
    public int getSal() {
        return sal;
    }
    public void setSal(int sal) {
        this.sal = sal;
    }
    public int getComm() {
        return comm;
    }
    public void setComm(int comm) {
        this.comm = comm;
    }
    public int getDeptno() {
        return deptno;
    }
    public void setDeptno(int deptno) {
        this.deptno = deptno;
    }
    
    @Override
    public String toString() {
        return "Emp [empno=" + empno + ", ename=" + ename + ", job=" + job + ", mgr=" + mgr + ", hiredate=" + hiredate
                + ", sal=" + sal + ", comm=" + comm + ", deptno=" + deptno + "]";
    }
    
    
}

服务目录:

先来接口:

package com.etoak.msm.emp.service;

import java.util.List;

import com.etoak.msm.emp.entity.Emp;

public interface EmpService {

    public int addEmp(Emp emp);
    
    public Emp getEmpByEmpno(int empno);
    
    public List<Emp> getEmps(Emp emp);
}

再来实现类:

package com.etoak.msm.emp.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.etoak.msm.emp.dao.EmpDao;
import com.etoak.msm.emp.entity.Emp;
import com.etoak.msm.emp.service.EmpService;

@Service
public class EmpServeiceImpl implements EmpService {

    @Autowired
    private EmpDao empDao ;
    
    public int addEmp(Emp emp) {
        return empDao.addEmp(emp);
    }

    public Emp getEmpByEmpno(int empno) {
        return empDao.getEmpByEmpno(empno);
    }

    public List<Emp> getEmps(Emp emp) {
        return empDao.getEmps(emp);
    }

}

最后 测试类:

package com.etoak.msm.emp.test;

import java.util.Date;
import java.util.List;

import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.etoak.msm.emp.entity.Emp;
import com.etoak.msm.emp.service.EmpService;


@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:applicationContext.xml" })//  如果报错:程序包org.junit不存在  参考: http://www.cnblogs.com/LiuChunfu/p/5598367.html
public class TestCase {
    
    @Autowired
    private EmpService empService;

    @org.junit.Test
    public void getOne() {

        Emp emp = empService.getEmpByEmpno(7369);
        System.out.println(emp);
    }
    
    @org.junit.Test
    public void getAll() {
        Emp emp = new Emp();
        //emp.setEmpno(7369);
        List<Emp> list = empService.getEmps(emp);
        for(Emp e : list){
            System.out.println(e);
        }    
    }
    
    @org.junit.Test
    public void addOne(){
           Emp emp = new Emp();
       //    emp.setEmpno(7300);
           emp.setComm(0);
           emp.setDeptno(10);
           emp.setEname("张三");
           emp.setJob("CEO");
           emp.setMgr(0);
           emp.setSal(1);
           emp.setHiredate(new Date());
           int i = empService.addEmp(emp);
           System.out.println(i);
    }
    
}

好了 以上就是 整个目录结构了

先 maven clearn maven install 一下 :

然后 运行 测试用例:

运行结果 如下:

控制台:

log4j:WARN No appenders could be found for logger (org.springframework.test.context.junit4.SpringJUnit4ClassRunner).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
2017-06-12 09:02:35,823 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Finished creating instance of bean 'log4jInitialization'
  2017-06-12 09:02:35,839 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating shared instance of singleton bean 'empDao'
  2017-06-12 09:02:35,839 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating instance of bean 'empDao'
  2017-06-12 09:02:35,839 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Eagerly caching bean 'empDao' to allow for resolving potential circular references
  2017-06-12 09:02:35,839 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating shared instance of singleton bean 'sqlSessionFactory'
  2017-06-12 09:02:35,839 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating instance of bean 'sqlSessionFactory'
  2017-06-12 09:02:35,839 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Eagerly caching bean 'sqlSessionFactory' to allow for resolving potential circular references
  2017-06-12 09:02:35,855 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating shared instance of singleton bean 'dataSource'
  2017-06-12 09:02:35,855 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating instance of bean 'dataSource'
  2017-06-12 09:02:35,933 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Eagerly caching bean 'dataSource' to allow for resolving potential circular references
  2017-06-12 09:02:35,933 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Finished creating instance of bean 'dataSource'
  2017-06-12 09:02:35,933 [main] DEBUG [org.springframework.core.io.support.PathMatchingResourcePatternResolver] - Resolved classpath location [mybatis/mappers/] to resources [URL [file:/D:/myself/spring/structure/mavenjavaSpringMybatis/msm02/target/classes/mybatis/mappers/]]
  2017-06-12 09:02:35,948 [main] DEBUG [org.springframework.core.io.support.PathMatchingResourcePatternResolver] - Looking for matching resources in directory tree [D:\myself\spring\structure\mavenjavaSpringMybatis\msm02\target\classes\mybatis\mappers]
  2017-06-12 09:02:35,948 [main] DEBUG [org.springframework.core.io.support.PathMatchingResourcePatternResolver] - Searching directory [D:\myself\spring\structure\mavenjavaSpringMybatis\msm02\target\classes\mybatis\mappers] for files matching pattern [D:/myself/spring/structure/mavenjavaSpringMybatis/msm02/target/classes/mybatis/mappers/**/*.xml]
  2017-06-12 09:02:35,948 [main] DEBUG [org.springframework.core.io.support.PathMatchingResourcePatternResolver] - Searching directory [D:\myself\spring\structure\mavenjavaSpringMybatis\msm02\target\classes\mybatis\mappers\emp] for files matching pattern [D:/myself/spring/structure/mavenjavaSpringMybatis/msm02/target/classes/mybatis/mappers/**/*.xml]
  2017-06-12 09:02:35,948 [main] DEBUG [org.springframework.core.io.support.PathMatchingResourcePatternResolver] - Resolved location pattern [classpath*:mybatis/mappers/**/*.xml] to resources [file [D:\myself\spring\structure\mavenjavaSpringMybatis\msm02\target\classes\mybatis\mappers\emp\EmpDao.xml]]
  2017-06-12 09:02:35,948 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Invoking afterPropertiesSet() on bean with name 'sqlSessionFactory'
  2017-06-12 09:02:35,948 [main] DEBUG [org.mybatis.spring.SqlSessionFactoryBean] - Property 'configuration' or 'configLocation' not specified, using default MyBatis Configuration
  2017-06-12 09:02:36,089 [main] DEBUG [org.mybatis.spring.SqlSessionFactoryBean] - Parsed mapper file: 'file [D:\myself\spring\structure\mavenjavaSpringMybatis\msm02\target\classes\mybatis\mappers\emp\EmpDao.xml]'
  2017-06-12 09:02:36,102 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Finished creating instance of bean 'sqlSessionFactory'
  2017-06-12 09:02:36,103 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Invoking afterPropertiesSet() on bean with name 'empDao'
  2017-06-12 09:02:36,103 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Finished creating instance of bean 'empDao'
  2017-06-12 09:02:36,103 [main] DEBUG [org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor] - Autowiring by type from bean name 'empServeiceImpl' to bean named 'empDao'
  2017-06-12 09:02:36,103 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Finished creating instance of bean 'empServeiceImpl'
  2017-06-12 09:02:36,103 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'log4jInitialization'
  2017-06-12 09:02:36,103 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'org.mybatis.spring.mapper.MapperScannerConfigurer#0'
  2017-06-12 09:02:36,103 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'org.springframework.context.support.PropertySourcesPlaceholderConfigurer#0'
  2017-06-12 09:02:36,103 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'dataSource'
  2017-06-12 09:02:36,103 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'sqlSessionFactory'
  2017-06-12 09:02:36,103 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating shared instance of singleton bean 'sqlSessionTemplate'
  2017-06-12 09:02:36,103 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating instance of bean 'sqlSessionTemplate'
  2017-06-12 09:02:36,103 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'sqlSessionFactory'
  2017-06-12 09:02:36,103 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Eagerly caching bean 'sqlSessionTemplate' to allow for resolving potential circular references
  2017-06-12 09:02:36,103 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Finished creating instance of bean 'sqlSessionTemplate'
  2017-06-12 09:02:36,103 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating shared instance of singleton bean 'transactionManager'
  2017-06-12 09:02:36,103 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating instance of bean 'transactionManager'
  2017-06-12 09:02:36,119 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Eagerly caching bean 'transactionManager' to allow for resolving potential circular references
  2017-06-12 09:02:36,119 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'dataSource'
  2017-06-12 09:02:36,119 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Invoking afterPropertiesSet() on bean with name 'transactionManager'
  2017-06-12 09:02:36,119 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Finished creating instance of bean 'transactionManager'
  2017-06-12 09:02:36,119 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor'
  2017-06-12 09:02:36,119 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor'
  2017-06-12 09:02:36,119 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'empDao'
  2017-06-12 09:02:36,119 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'org.springframework.context.event.internalEventListenerFactory'
  2017-06-12 09:02:36,135 [main] DEBUG [org.springframework.context.support.GenericApplicationContext] - Unable to locate LifecycleProcessor with name 'lifecycleProcessor': using default [org.springframework.context.support.DefaultLifecycleProcessor@5ddeb7cb]
  2017-06-12 09:02:36,135 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'lifecycleProcessor'
  2017-06-12 09:02:36,135 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'sqlSessionFactory'
  2017-06-12 09:02:36,135 [main] DEBUG [org.springframework.core.env.PropertySourcesPropertyResolver] - Searching for key 'spring.liveBeansView.mbeanDomain' in [systemProperties]
  2017-06-12 09:02:36,135 [main] DEBUG [org.springframework.core.env.PropertySourcesPropertyResolver] - Searching for key 'spring.liveBeansView.mbeanDomain' in [systemEnvironment]
  2017-06-12 09:02:36,135 [main] DEBUG [org.springframework.core.env.PropertySourcesPropertyResolver] - Could not find key 'spring.liveBeansView.mbeanDomain' in any property source. Returning [null]
  2017-06-12 09:02:36,135 [main] DEBUG [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate] - Storing ApplicationContext in cache under key [[MergedContextConfiguration@735b5592 testClass = TestCase, locations = '{classpath:applicationContext.xml}', classes = '{}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{}', contextLoader = 'org.springframework.test.context.support.DelegatingSmartContextLoader', parent = [null]]]
  2017-06-12 09:02:36,135 [main] DEBUG [org.springframework.test.context.cache] - Spring test ApplicationContext cache statistics: [DefaultContextCache@1972e513 size = 1, parentContextCount = 0, hitCount = 0, missCount = 1]
  2017-06-12 09:02:36,135 [main] DEBUG [org.springframework.beans.factory.annotation.InjectionMetadata] - Processing injected element of bean 'com.etoak.msm.emp.test.TestCase': AutowiredFieldElement for private com.etoak.msm.emp.service.EmpService com.etoak.msm.emp.test.TestCase.empService
  2017-06-12 09:02:36,135 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'empServeiceImpl'
  2017-06-12 09:02:36,135 [main] DEBUG [org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor] - Autowiring by type from bean name 'com.etoak.msm.emp.test.TestCase' to bean named 'empServeiceImpl'
  2017-06-12 09:02:36,135 [main] DEBUG [org.springframework.test.context.support.AbstractDirtiesContextTestExecutionListener] - Before test method: context [DefaultTestContext@62ee68d8 testClass = TestCase, testInstance = com.etoak.msm.emp.test.TestCase@68be2bc2, testMethod = addOne@TestCase, testException = [null], mergedContextConfiguration = [MergedContextConfiguration@735b5592 testClass = TestCase, locations = '{classpath:applicationContext.xml}', classes = '{}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{}', contextLoader = 'org.springframework.test.context.support.DelegatingSmartContextLoader', parent = [null]]], class annotated with @DirtiesContext [false] with mode [null], method annotated with @DirtiesContext [false] with mode [null].
  2017-06-12 09:02:36,150 [main] DEBUG [org.mybatis.spring.SqlSessionUtils] - Creating a new SqlSession
  2017-06-12 09:02:36,166 [main] DEBUG [org.mybatis.spring.SqlSessionUtils] - SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@5fb759d6] was not registered for synchronization because synchronization is not active
  2017-06-12 09:02:36,166 [main] DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] - Fetching JDBC Connection from DataSource
  2017-06-12 09:02:36,369 [main] DEBUG [org.mybatis.spring.transaction.SpringManagedTransaction] - JDBC Connection [jdbc:oracle:thin:@127.0.0.1:1521:orcl, UserName=SCOTT, Oracle JDBC driver] will not be managed by Spring
  2017-06-12 09:02:36,369 [main] DEBUG [com.etoak.msm.emp.dao.EmpDao.addEmp!selectKey] - ==>  Preparing: SELECT seqEmp.Nextval as EMPNO from DUAL 
  2017-06-12 09:02:36,432 [main] DEBUG [com.etoak.msm.emp.dao.EmpDao.addEmp!selectKey] - ==> Parameters: 
  2017-06-12 09:02:36,494 [main] DEBUG [com.etoak.msm.emp.dao.EmpDao.addEmp!selectKey] - <==      Total: 1
  2017-06-12 09:02:36,494 [main] DEBUG [com.etoak.msm.emp.dao.EmpDao.addEmp] - ==>  Preparing: insert into emp values(?,?,?,?,?,?,?,?) 
  2017-06-12 09:02:36,494 [main] DEBUG [com.etoak.msm.emp.dao.EmpDao.addEmp] - ==> Parameters: 1005(Integer), 张三(String), CEO(String), 0(Integer), 2017-06-12(Date), 1(Integer), 0(Integer), 10(Integer)
  2017-06-12 09:02:36,510 [main] DEBUG [com.etoak.msm.emp.dao.EmpDao.addEmp] - <==    Updates: 1
  2017-06-12 09:02:36,510 [main] DEBUG [org.mybatis.spring.SqlSessionUtils] - Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@5fb759d6]
  2017-06-12 09:02:36,510 [main] DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] - Returning JDBC Connection to DataSource
  1
2017-06-12 09:02:36,510 [main] DEBUG [org.springframework.test.context.support.AbstractDirtiesContextTestExecutionListener] - After test method: context [DefaultTestContext@62ee68d8 testClass = TestCase, testInstance = com.etoak.msm.emp.test.TestCase@68be2bc2, testMethod = addOne@TestCase, testException = [null], mergedContextConfiguration = [MergedContextConfiguration@735b5592 testClass = TestCase, locations = '{classpath:applicationContext.xml}', classes = '{}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{}', contextLoader = 'org.springframework.test.context.support.DelegatingSmartContextLoader', parent = [null]]], class annotated with @DirtiesContext [false] with mode [null], method annotated with @DirtiesContext [false] with mode [null].
  2017-06-12 09:02:36,510 [main] DEBUG [org.springframework.test.annotation.ProfileValueUtils] - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.etoak.msm.emp.test.TestCase]
  2017-06-12 09:02:36,510 [main] DEBUG [org.springframework.test.annotation.ProfileValueUtils] - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.etoak.msm.emp.test.TestCase]
  2017-06-12 09:02:36,510 [main] DEBUG [org.springframework.test.context.support.DependencyInjectionTestExecutionListener] - Performing dependency injection for test context [[DefaultTestContext@62ee68d8 testClass = TestCase, testInstance = com.etoak.msm.emp.test.TestCase@6c4980d3, testMethod = [null], testException = [null], mergedContextConfiguration = [MergedContextConfiguration@735b5592 testClass = TestCase, locations = '{classpath:applicationContext.xml}', classes = '{}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{}', contextLoader = 'org.springframework.test.context.support.DelegatingSmartContextLoader', parent = [null]]]].
  2017-06-12 09:02:36,510 [main] DEBUG [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate] - Retrieved ApplicationContext from cache with key [[MergedContextConfiguration@735b5592 testClass = TestCase, locations = '{classpath:applicationContext.xml}', classes = '{}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{}', contextLoader = 'org.springframework.test.context.support.DelegatingSmartContextLoader', parent = [null]]]
  2017-06-12 09:02:36,510 [main] DEBUG [org.springframework.test.context.cache] - Spring test ApplicationContext cache statistics: [DefaultContextCache@1972e513 size = 1, parentContextCount = 0, hitCount = 1, missCount = 1]
  2017-06-12 09:02:36,510 [main] DEBUG [org.springframework.beans.factory.annotation.InjectionMetadata] - Processing injected element of bean 'com.etoak.msm.emp.test.TestCase': AutowiredFieldElement for private com.etoak.msm.emp.service.EmpService com.etoak.msm.emp.test.TestCase.empService
  2017-06-12 09:02:36,510 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'empServeiceImpl'
  2017-06-12 09:02:36,510 [main] DEBUG [org.springframework.test.context.support.AbstractDirtiesContextTestExecutionListener] - Before test method: context [DefaultTestContext@62ee68d8 testClass = TestCase, testInstance = com.etoak.msm.emp.test.TestCase@6c4980d3, testMethod = getAll@TestCase, testException = [null], mergedContextConfiguration = [MergedContextConfiguration@735b5592 testClass = TestCase, locations = '{classpath:applicationContext.xml}', classes = '{}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{}', contextLoader = 'org.springframework.test.context.support.DelegatingSmartContextLoader', parent = [null]]], class annotated with @DirtiesContext [false] with mode [null], method annotated with @DirtiesContext [false] with mode [null].
  2017-06-12 09:02:36,510 [main] DEBUG [org.mybatis.spring.SqlSessionUtils] - Creating a new SqlSession
  2017-06-12 09:02:36,510 [main] DEBUG [org.mybatis.spring.SqlSessionUtils] - SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@327bcebd] was not registered for synchronization because synchronization is not active
  2017-06-12 09:02:36,541 [main] DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] - Fetching JDBC Connection from DataSource
  2017-06-12 09:02:36,541 [main] DEBUG [org.mybatis.spring.transaction.SpringManagedTransaction] - JDBC Connection [jdbc:oracle:thin:@127.0.0.1:1521:orcl, UserName=SCOTT, Oracle JDBC driver] will not be managed by Spring
  2017-06-12 09:02:36,541 [main] DEBUG [com.etoak.msm.emp.dao.EmpDao.getEmps] - ==>  Preparing: SELECT * from emp where 1 = 1 
  2017-06-12 09:02:36,541 [main] DEBUG [com.etoak.msm.emp.dao.EmpDao.getEmps] - ==> Parameters: 
  2017-06-12 09:02:36,557 [main] DEBUG [com.etoak.msm.emp.dao.EmpDao.getEmps] - <==      Total: 19
  2017-06-12 09:02:36,557 [main] DEBUG [org.mybatis.spring.SqlSessionUtils] - Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@327bcebd]
  2017-06-12 09:02:36,557 [main] DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] - Returning JDBC Connection to DataSource
  Emp [empno=1005, ename=张三, job=CEO, mgr=0, hiredate=Mon Jun 12 00:00:00 CST 2017, sal=1, comm=0, deptno=10]
Emp [empno=7935, ename=MILLER, job=CLERK, mgr=7782, hiredate=null, sal=0, comm=0, deptno=0]
Emp [empno=7369, ename=SMITH, job=CLERK, mgr=7902, hiredate=Wed Dec 17 00:00:00 CST 1980, sal=800, comm=0, deptno=20]
Emp [empno=7499, ename=ALLEN, job=SALESMAN, mgr=7698, hiredate=Fri Feb 20 00:00:00 CST 1981, sal=1600, comm=300, deptno=30]
Emp [empno=7521, ename=WARD, job=SALESMAN, mgr=7698, hiredate=Sun Feb 22 00:00:00 CST 1981, sal=1250, comm=500, deptno=30]
Emp [empno=7566, ename=JONES, job=MANAGER, mgr=7839, hiredate=Thu Apr 02 00:00:00 CST 1981, sal=2975, comm=0, deptno=20]
Emp [empno=7654, ename=MARTIN, job=SALESMAN, mgr=7698, hiredate=Mon Sep 28 00:00:00 CST 1981, sal=1250, comm=1400, deptno=30]
Emp [empno=7698, ename=BLAKE, job=MANAGER, mgr=7839, hiredate=Fri May 01 00:00:00 CST 1981, sal=2850, comm=0, deptno=30]
Emp [empno=7782, ename=CLARK, job=MANAGER, mgr=7839, hiredate=Tue Jun 09 00:00:00 CST 1981, sal=2450, comm=0, deptno=10]
Emp [empno=7788, ename=SCOTT, job=ANALYST, mgr=7566, hiredate=Sun Apr 19 00:00:00 CDT 1987, sal=3000, comm=0, deptno=20]
Emp [empno=7839, ename=KING, job=PRESIDENT, mgr=0, hiredate=Tue Nov 17 00:00:00 CST 1981, sal=5000, comm=0, deptno=10]
Emp [empno=7844, ename=TURNER, job=SALESMAN, mgr=7698, hiredate=Tue Sep 08 00:00:00 CST 1981, sal=1500, comm=0, deptno=30]
Emp [empno=7876, ename=ADAMS, job=CLERK, mgr=7788, hiredate=Sat May 23 00:00:00 CDT 1987, sal=1100, comm=0, deptno=20]
Emp [empno=7900, ename=JAMES, job=CLERK, mgr=7698, hiredate=Thu Dec 03 00:00:00 CST 1981, sal=950, comm=0, deptno=30]
Emp [empno=7902, ename=FORD, job=ANALYST, mgr=7566, hiredate=Thu Dec 03 00:00:00 CST 1981, sal=3000, comm=0, deptno=20]
Emp [empno=7934, ename=MILLER, job=CLERK, mgr=7782, hiredate=Sat Jan 23 00:00:00 CST 1982, sal=1300, comm=0, deptno=10]
Emp [empno=7300, ename=张三, job=CEO, mgr=0, hiredate=Sun Jun 11 00:00:00 CST 2017, sal=1, comm=0, deptno=10]
Emp [empno=1003, ename=张三, job=CEO, mgr=0, hiredate=Sun Jun 11 00:00:00 CST 2017, sal=1, comm=0, deptno=10]
Emp [empno=1004, ename=张三, job=CEO, mgr=0, hiredate=Sun Jun 11 00:00:00 CST 2017, sal=1, comm=0, deptno=10]
2017-06-12 09:02:36,557 [main] DEBUG [org.springframework.test.context.support.AbstractDirtiesContextTestExecutionListener] - After test method: context [DefaultTestContext@62ee68d8 testClass = TestCase, testInstance = com.etoak.msm.emp.test.TestCase@6c4980d3, testMethod = getAll@TestCase, testException = [null], mergedContextConfiguration = [MergedContextConfiguration@735b5592 testClass = TestCase, locations = '{classpath:applicationContext.xml}', classes = '{}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{}', contextLoader = 'org.springframework.test.context.support.DelegatingSmartContextLoader', parent = [null]]], class annotated with @DirtiesContext [false] with mode [null], method annotated with @DirtiesContext [false] with mode [null].
  2017-06-12 09:02:36,557 [main] DEBUG [org.springframework.test.annotation.ProfileValueUtils] - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.etoak.msm.emp.test.TestCase]
  2017-06-12 09:02:36,557 [main] DEBUG [org.springframework.test.annotation.ProfileValueUtils] - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.etoak.msm.emp.test.TestCase]
  2017-06-12 09:02:36,557 [main] DEBUG [org.springframework.test.context.support.DependencyInjectionTestExecutionListener] - Performing dependency injection for test context [[DefaultTestContext@62ee68d8 testClass = TestCase, testInstance = com.etoak.msm.emp.test.TestCase@1458ed9c, testMethod = [null], testException = [null], mergedContextConfiguration = [MergedContextConfiguration@735b5592 testClass = TestCase, locations = '{classpath:applicationContext.xml}', classes = '{}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{}', contextLoader = 'org.springframework.test.context.support.DelegatingSmartContextLoader', parent = [null]]]].
  2017-06-12 09:02:36,557 [main] DEBUG [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate] - Retrieved ApplicationContext from cache with key [[MergedContextConfiguration@735b5592 testClass = TestCase, locations = '{classpath:applicationContext.xml}', classes = '{}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{}', contextLoader = 'org.springframework.test.context.support.DelegatingSmartContextLoader', parent = [null]]]
  2017-06-12 09:02:36,557 [main] DEBUG [org.springframework.test.context.cache] - Spring test ApplicationContext cache statistics: [DefaultContextCache@1972e513 size = 1, parentContextCount = 0, hitCount = 2, missCount = 1]
  2017-06-12 09:02:36,557 [main] DEBUG [org.springframework.beans.factory.annotation.InjectionMetadata] - Processing injected element of bean 'com.etoak.msm.emp.test.TestCase': AutowiredFieldElement for private com.etoak.msm.emp.service.EmpService com.etoak.msm.emp.test.TestCase.empService
  2017-06-12 09:02:36,557 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'empServeiceImpl'
  2017-06-12 09:02:36,557 [main] DEBUG [org.springframework.test.context.support.AbstractDirtiesContextTestExecutionListener] - Before test method: context [DefaultTestContext@62ee68d8 testClass = TestCase, testInstance = com.etoak.msm.emp.test.TestCase@1458ed9c, testMethod = getOne@TestCase, testException = [null], mergedContextConfiguration = [MergedContextConfiguration@735b5592 testClass = TestCase, locations = '{classpath:applicationContext.xml}', classes = '{}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{}', contextLoader = 'org.springframework.test.context.support.DelegatingSmartContextLoader', parent = [null]]], class annotated with @DirtiesContext [false] with mode [null], method annotated with @DirtiesContext [false] with mode [null].
  2017-06-12 09:02:36,557 [main] DEBUG [org.mybatis.spring.SqlSessionUtils] - Creating a new SqlSession
  2017-06-12 09:02:36,557 [main] DEBUG [org.mybatis.spring.SqlSessionUtils] - SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@10a9d961] was not registered for synchronization because synchronization is not active
  2017-06-12 09:02:36,557 [main] DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] - Fetching JDBC Connection from DataSource
  2017-06-12 09:02:36,557 [main] DEBUG [org.mybatis.spring.transaction.SpringManagedTransaction] - JDBC Connection [jdbc:oracle:thin:@127.0.0.1:1521:orcl, UserName=SCOTT, Oracle JDBC driver] will not be managed by Spring
  2017-06-12 09:02:36,557 [main] DEBUG [com.etoak.msm.emp.dao.EmpDao.getEmpByEmpno] - ==>  Preparing: SELECT * from emp where empno = ? 
  2017-06-12 09:02:36,557 [main] DEBUG [com.etoak.msm.emp.dao.EmpDao.getEmpByEmpno] - ==> Parameters: 7369(Integer)
  2017-06-12 09:02:36,557 [main] DEBUG [com.etoak.msm.emp.dao.EmpDao.getEmpByEmpno] - <==      Total: 1
  2017-06-12 09:02:36,557 [main] DEBUG [org.mybatis.spring.SqlSessionUtils] - Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@10a9d961]
  2017-06-12 09:02:36,557 [main] DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] - Returning JDBC Connection to DataSource
  Emp [empno=7369, ename=SMITH, job=CLERK, mgr=7902, hiredate=Wed Dec 17 00:00:00 CST 1980, sal=800, comm=0, deptno=20]
2017-06-12 09:02:36,557 [main] DEBUG [org.springframework.test.context.support.AbstractDirtiesContextTestExecutionListener] - After test method: context [DefaultTestContext@62ee68d8 testClass = TestCase, testInstance = com.etoak.msm.emp.test.TestCase@1458ed9c, testMethod = getOne@TestCase, testException = [null], mergedContextConfiguration = [MergedContextConfiguration@735b5592 testClass = TestCase, locations = '{classpath:applicationContext.xml}', classes = '{}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{}', contextLoader = 'org.springframework.test.context.support.DelegatingSmartContextLoader', parent = [null]]], class annotated with @DirtiesContext [false] with mode [null], method annotated with @DirtiesContext [false] with mode [null].
  2017-06-12 09:02:36,557 [main] DEBUG [org.springframework.test.context.support.AbstractDirtiesContextTestExecutionListener] - After test class: context [DefaultTestContext@62ee68d8 testClass = TestCase, testInstance = [null], testMethod = [null], testException = [null], mergedContextConfiguration = [MergedContextConfiguration@735b5592 testClass = TestCase, locations = '{classpath:applicationContext.xml}', classes = '{}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{}', contextLoader = 'org.springframework.test.context.support.DelegatingSmartContextLoader', parent = [null]]], class annotated with @DirtiesContext [false] with mode [null].
  2017-06-12 09:02:36,557 [Thread-1] INFO  [org.springframework.context.support.GenericApplicationContext] - Closing org.springframework.context.support.GenericApplicationContext@604ed9f0: startup date [Mon Jun 12 09:02:35 CST 2017]; root of context hierarchy
  2017-06-12 09:02:36,557 [Thread-1] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'sqlSessionFactory'
  2017-06-12 09:02:36,557 [Thread-1] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'lifecycleProcessor'
  2017-06-12 09:02:36,557 [Thread-1] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@2890c451: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,org.springframework.context.event.internalEventListenerProcessor,org.springframework.context.event.internalEventListenerFactory,empServeiceImpl,log4jInitialization,org.mybatis.spring.mapper.MapperScannerConfigurer#0,org.springframework.context.support.PropertySourcesPlaceholderConfigurer#0,dataSource,sqlSessionFactory,sqlSessionTemplate,transactionManager,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor,org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor,empDao]; root of factory hierarchy
  2017-06-12 09:02:36,572 [Thread-1] DEBUG [org.springframework.beans.factory.support.DisposableBeanAdapter] - Invoking destroy() on bean with name 'sqlSessionTemplate'
  2017-06-12 09:02:36,572 [Thread-1] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Retrieved dependent beans for bean 'empServeiceImpl': [com.etoak.msm.emp.test.TestCase]
  2017-06-12 09:02:36,572 [Thread-1] DEBUG [org.springframework.beans.factory.support.DisposableBeanAdapter] - Invoking destroy method 'close' on bean with name 'dataSource'
  

 

posted @ 2017-06-12 09:28  三目鸟  阅读(2158)  评论(0编辑  收藏  举报