用 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'
用 Eclipse 搭建一个简单的 Maven spring mybatis 项目(包含测试用例)的更多相关文章
- 用Eclipse 创建一个 简单的 Maven JavaWeb 项目
使用Maven 创建一个简单的 javaWeb 项目: 本篇属于 创建 JavaWeb 项目的第三篇: 建议阅读本篇之前 阅读 用 Eclipse 创建一个简单的web项目 ;本篇是这这篇文章的基础 ...
- 用 eclipse 创建一个简单的 meaven spring springMvc mybatis 项目
下面是整体步骤: 1: 先创建一个Maven 项目: 选择跳过骨架: 因为要搭建的是 web 项目 所以这个地方选择 war 包; 点击完成 这样就完成 Maven项目的搭建: 接下俩 先把 Mav ...
- 使用Intellij IDEA搭建一个简单的Maven项目
IntelliJ IDEA是Java最优秀的开发工具,它功能全面,提示比较智能,开发界面炫酷,新技术支持的比较迅速. 我使用了Eclipse快10年了,IntelliJ IDEA这么好用必须要试一试. ...
- 详细解释 集成Maven Spring Mybatis项目包生成Bat文件
有时在项目必须Maven项目包生成bat文件,长官一人.本文将解释的具体使用方法maven-assembly-plugin插件实现bat文件包. 1.首先看一下项目结构 2.配置pom.xml文件,在 ...
- idea 创建的maven+spring+mybatis项目整合 报错无法创建bean
报错如下: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with n ...
- 用Eclipse 搭建一个Maven Spring SpringMVC 项目
1: 先创建一个maven web 项目: 可以参照之前的文章: 用Maven 创建一个 简单的 JavaWeb 项目 创建好之后的目录是这样的; 2: 先配置maven 修改pom.xml & ...
- 创建一个简单的maven的web程序
最近学习Hadoop,发现学习要想用hadoop作为后台运行web程序,必须应用maven,所以学习了今天学习了一下maven,然后搭建了一个简单的web程序 首先我使用的是eclipse中自带的ma ...
- 使用maven+eclipse搭建最简单的struts2的helloworld
使用maven+eclipse搭建最简单的struts2的helloworld 一.web分层结构简介 1.web[细]粒度分层结构: 按细粒度分层可以分为以下6种: 1).表现层:html/css/ ...
- mybatis学习笔记(五) -- maven+spring+mybatis从零开始搭建整合详细过程(附demo和搭建过程遇到的问题解决方法)
文章介绍结构一览 一.使用maven创建web项目 1.新建maven项目 2.修改jre版本 3.修改Project Facts,生成WebContent文件夾 4.将WebContent下的两个文 ...
随机推荐
- Linux命令行学习
"mkdir + 文件夹名字" 创建文件夹 "pwd" 显示当前工作目录的绝对路径. "touch" 创建空文件. "cat /p ...
- 201521123100 《java程序设计》第12周学习总结
1. 本周学习总结 1.1 以你喜欢的方式(思维导图或其他)归纳总结多流与文件相关内容. 2. 书面作业 将Student对象(属性:int id, String name,int age,doubl ...
- Python 浅谈注释的重要性
最近参加了一个比赛,然后看到队友编程的代码,我觉得真的是难以下咽,几乎每个字符都要咨询他,用老师的话来说,这就是山炮编程员,所以此时的我意识到写一篇关于注释程序的重要性了,因此特地的写一篇文章帮助大家 ...
- lintcode.44 最小子数组
最小子数组 描述 笔记 数据 评测 给定一个整数数组,找到一个具有最小和的子数组.返回其最小和. 注意事项 子数组最少包含一个数字 您在真实的面试中是否遇到过这个题? Yes 哪家公司问你的这个题 ...
- Spring - Spring容器概念及其初始化过程
引言 工作4年多,做了3年的java,每个项目都用Spring,但对Spring一直都是知其然而不知其所以然.鄙人深知Spring是一个高深的框架,正好近期脱离加班的苦逼状态,遂决定从Spring的官 ...
- 小甲鱼:Python学习笔记001_变量_分支_数据类型_运算符等基础
1.下载并安装Python 3.5.0 Python是一个跨平台语言,Python从3.0的版本的语法很多不兼容2版本,官网找到最新的版本并下载:http://www.python.org 2.IDL ...
- PHP 动态调整内存限制
最近公司的一个PHP项目在操作大文件的时候总是抛出这个异常 Fixing PHP Fatal Error: Allowed Memory Size Exhausted 经过一番调试后发现是达到了PHP ...
- (一)关于java泛型的学习总结(泛型方法、泛型擦除)
目录概要 一.泛型方法 二.利用泛型方法的特性实现代码的简化 三. 关于泛型的擦除 四.无界通配符和原生类型区别 五.转型和警告 泛型 一般的类中的属性或方法的参数,只能使用具体的类型:要么是基本 ...
- unity3D写一个hello world
unity3D写一个hello world 打开unity并且在assets建立一个新的文件,新的文件命名为hello world.unity.接着创建一个新的C#Sript脚本文件,命名为hello ...
- GCD之死锁
GCD相当好用,但用不好就会死锁,始终要记着这样一句秘籍: 不要在串行队列放dispatch_sync.dispatch_apply 下面看几个例子 1 2 3 4 5 6 7 8 9 10 11 1 ...