1: 先搭建一个Maven项目:

创建好后的目录:

2: 配置pom.xml文件:

  1. <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">
  2. <modelVersion>4.0.0</modelVersion>
  3. <groupId>com.etoak</groupId>
  4. <artifactId>msm02</artifactId>
  5. <version>0.0.1-SNAPSHOT</version>
  6.  
  7. <properties>
  8. <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  9. <maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
  10. <spring.version>4.2.5.RELEASE</spring.version>
  11. <mybatis.version>3.4.4</mybatis.version>
  12. <mybatisspring.version>1.3.1</mybatisspring.version>
  13. <jackson.version>2.7.0</jackson.version>
  14. <log4j.version>1.2.17</log4j.version>
  15. <slf4j.version>1.7.7</slf4j.version>
  16. </properties>
  17.  
  18. <dependencies>
  19. <dependency>
  20. <groupId>junit</groupId>
  21. <artifactId>junit</artifactId>
  22. <version>4.12</version>
  23. <!-- <scope>test</scope> -->
  24. </dependency>
  25.  
  26. <!-- javaEE -->
  27. <dependency>
  28. <groupId>javax</groupId>
  29. <artifactId>javaee-api</artifactId>
  30. <version>7.0</version>
  31. </dependency>
  32. <dependency>
  33. <groupId>javax</groupId>
  34. <artifactId>javaee-web-api</artifactId>
  35. <version>7.0</version>
  36. </dependency>
  37.  
  38. <!-- servlet start -->
  39. <dependency>
  40. <groupId>javax.servlet</groupId>
  41. <artifactId>javax.servlet-api</artifactId>
  42. <version>3.1.0</version>
  43. </dependency>
  44. <dependency>
  45. <groupId>javax.servlet</groupId>
  46. <artifactId>jstl</artifactId>
  47. <version>1.2</version>
  48. </dependency>
  49. <!-- servlet end -->
  50.  
  51. <!-- spring start -->
  52. <dependency>
  53. <groupId>org.springframework</groupId>
  54. <artifactId>spring-core</artifactId>
  55. <version>${spring.version}</version>
  56. </dependency>
  57. <dependency>
  58. <groupId>org.springframework</groupId>
  59. <artifactId>spring-beans</artifactId>
  60. <version>${spring.version}</version>
  61. </dependency>
  62. <dependency>
  63. <groupId>org.springframework</groupId>
  64. <artifactId>spring-context</artifactId>
  65. <version>${spring.version}</version>
  66. </dependency>
  67. <dependency>
  68. <groupId>org.springframework</groupId>
  69. <artifactId>spring-web</artifactId>
  70. <version>${spring.version}</version>
  71. </dependency>
  72. <dependency>
  73. <groupId>org.springframework</groupId>
  74. <artifactId>spring-webmvc</artifactId>
  75. <version>${spring.version}</version>
  76. </dependency>
  77. <dependency>
  78. <groupId>org.springframework</groupId>
  79. <artifactId>spring-aop</artifactId>
  80. <version>${spring.version}</version>
  81. </dependency>
  82. <dependency>
  83. <groupId>org.springframework</groupId>
  84. <artifactId>spring-aspects</artifactId>
  85. <version>${spring.version}</version>
  86. </dependency>
  87. <dependency>
  88. <groupId>org.springframework</groupId>
  89. <artifactId>spring-jdbc</artifactId>
  90. <version>${spring.version}</version>
  91. </dependency>
  92. <dependency>
  93. <groupId>org.springframework</groupId>
  94. <artifactId>spring-tx</artifactId>
  95. <version>${spring.version}</version>
  96. </dependency>
  97. <dependency>
  98. <groupId>org.springframework</groupId>
  99. <artifactId>spring-context-support</artifactId>
  100. <version>${spring.version}</version>
  101. </dependency>
  102. <dependency>
  103. <groupId>org.springframework</groupId>
  104. <artifactId>spring-orm</artifactId>
  105. <version>${spring.version}</version>
  106. </dependency>
  107. <dependency>
  108. <groupId>org.springframework</groupId>
  109. <artifactId>spring-test</artifactId>
  110. <version>${spring.version}</version>
  111. </dependency>
  112. <dependency>
  113. <groupId>org.springframework.data</groupId>
  114. <artifactId>spring-data-jpa</artifactId>
  115. <version>1.10.1.RELEASE</version>
  116. </dependency>
  117. <!-- spring end -->
  118.  
  119. <!-- mybatis start -->
  120. <dependency>
  121. <groupId>org.mybatis</groupId>
  122. <artifactId>mybatis</artifactId>
  123. <version>${mybatis.version}</version>
  124. </dependency>
  125. <dependency>
  126. <groupId>org.mybatis</groupId>
  127. <artifactId>mybatis-spring</artifactId>
  128. <version>${mybatisspring.version}</version>
  129. </dependency>
  130. <!-- mybatis end -->
  131.  
  132. <!-- 数据库 start -->
  133. <dependency>
  134. <groupId>com.alibaba</groupId>
  135. <artifactId>druid</artifactId>
  136. <version>1.0.29</version>
  137. </dependency>
  138. <dependency>
  139. <groupId>commons-dbcp</groupId>
  140. <artifactId>commons-dbcp</artifactId>
  141. <version>1.4</version>
  142. </dependency>
  143. <dependency>
  144. <groupId>com.oracle</groupId>
  145. <artifactId>ojdbc14</artifactId>
  146. <version>10.2.0.4.0</version>
  147. </dependency>
  148. <dependency>
  149. <groupId>mysql</groupId>
  150. <artifactId>mysql-connector-java</artifactId>
  151. <version>5.1.35</version>
  152. </dependency>
  153. <!-- 数据库 end -->
  154.  
  155. <!-- servlet start -->
  156. <dependency>
  157. <groupId>javax.servlet</groupId>
  158. <artifactId>servlet-api</artifactId>
  159. <version>3.0-alpha-1</version>
  160. </dependency>
  161. <dependency>
  162. <groupId>javax.servlet</groupId>
  163. <artifactId>jstl</artifactId>
  164. <version>1.2</version>
  165. </dependency>
  166. <!-- servlet end -->
  167.  
  168. <!-- json start (fastjson & jackjson) -->
  169. <dependency>
  170. <groupId>org.codehaus.jackson</groupId>
  171. <artifactId>jackson-mapper-asl</artifactId>
  172. <version>1.9.13</version>
  173. </dependency>
  174. <dependency>
  175. <groupId>com.alibaba</groupId>
  176. <artifactId>fastjson</artifactId>
  177. <version>1.2.31</version>
  178. </dependency>
  179. <dependency>
  180. <groupId>com.fasterxml.jackson.core</groupId>
  181. <artifactId>jackson-annotations</artifactId>
  182. <version>${jackson.version}</version>
  183. </dependency>
  184. <dependency>
  185. <groupId>com.fasterxml.jackson.core</groupId>
  186. <artifactId>jackson-core</artifactId>
  187. <version>${jackson.version}</version>
  188. </dependency>
  189. <dependency>
  190. <groupId>com.fasterxml.jackson.core</groupId>
  191. <artifactId>jackson-databind</artifactId>
  192. <version>${jackson.version}</version>
  193. </dependency>
  194. <!-- json end -->
  195.  
  196. <!-- log4j start -->
  197. <dependency>
  198. <groupId>log4j</groupId>
  199. <artifactId>log4j</artifactId>
  200. <version>${log4j.version}</version>
  201. </dependency>
  202. <dependency>
  203. <groupId>org.slf4j</groupId>
  204. <artifactId>slf4j-api</artifactId>
  205. <version>${slf4j.version}</version>
  206. </dependency>
  207. <dependency>
  208. <groupId>org.slf4j</groupId>
  209. <artifactId>slf4j-log4j12</artifactId>
  210. <version>${slf4j.version}</version>
  211. </dependency>
  212. <dependency>
  213. <groupId>org.hibernate</groupId>
  214. <artifactId>hibernate-validator</artifactId>
  215. <version>5.2.4.Final</version>
  216. </dependency>
  217. <!-- log4j end -->
  218.  
  219. </dependencies>
  220. <build>
  221. <plugins>
  222. <plugin>
  223. <groupId>org.apache.maven.plugins</groupId>
  224. <artifactId>maven-compiler-plugin</artifactId>
  225. <version>3.6.1</version>
  226. <configuration>
  227. <skipTests>true</skipTests>
  228. <source>1.8</source>
  229. <target>1.8</target>
  230. </configuration>
  231. </plugin>
  232. </plugins>
  233. <finalName>msm02</finalName> <!-- 这里是 项目名 -->
  234. </build>
  235. </project>

3:  在 resources 目录下 创建  applicationContext.xml

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
  4. xsi:schemaLocation="http://www.springframework.org/schema/beans
  5. http://www.springframework.org/schema/beans/spring-beans.xsd
  6. http://www.springframework.org/schema/mvc
  7. http://www.springframework.org/schema/mvc/spring-mvc.xsd
  8. http://www.springframework.org/schema/context
  9. http://www.springframework.org/schema/context/spring-context.xsd
  10. http://www.springframework.org/schema/aop
  11. http://www.springframework.org/schema/aop/spring-aop.xsd
  12. http://www.springframework.org/schema/tx
  13. http://www.springframework.org/schema/tx/spring-tx.xsd
  14. ">
  15.  
  16. <!-- 采用注释的方式配置bean -->
  17. <context:annotation-config />
  18. <!-- 自动扫描注解 -->
  19. <context:component-scan base-package="com.etoak.msm" />
  20.  
  21. <!-- 配置log4j -->
  22. <bean id="log4jInitialization" class="com.etoak.msm.common.log4j.MytMethodInvokingFactoryBean">
  23. <property name="targetClass" value="org.springframework.util.Log4jConfigurer" />
  24. <property name="targetMethod" value="initLogging" />
  25. <property name="arguments">
  26. <list>
  27. <value>classpath:config/properties/log4j.properties</value>
  28. </list>
  29. </property>
  30. </bean>
  31.  
  32. <!--导入DAO配置 -->
  33. <import resource="config/xml/mybatis-dao.xml"/>
  34. <!--导入数据库配置 -->
  35. <import resource="config/xml/mybatis-db.xml"/>
  36. <!--导入数据库事务配置 -->
  37. <import resource="config/xml/spring-tx.xml"/>
  38.  
  39. </beans>

下面是一大波 配置文件:

mybatis-dao.xml

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
  4. xsi:schemaLocation="http://www.springframework.org/schema/beans
  5. http://www.springframework.org/schema/beans/spring-beans.xsd
  6. http://www.springframework.org/schema/context
  7. http://www.springframework.org/schema/context/spring-context.xsd
  8. ">
  9.  
  10. <!-- mapper扫描配置扫描器 -->
  11. <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
  12. <!-- 扫描com.etoak.mssm这个包以及它的子包下的所有映射接口类 -->
  13. <property name="basePackage" value="com.etoak.msm.emp.dao" />
  14. <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" /> <!-- 如果报错Invalid bound statement (not found): 请参考: https://my.oschina.net/psuyun/blog/464851 -->
  15. </bean>
  16.  
  17. </beans>

mybatis-db.xml

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
  4. xsi:schemaLocation="http://www.springframework.org/schema/beans
  5. http://www.springframework.org/schema/beans/spring-beans.xsd
  6. http://www.springframework.org/schema/context
  7. http://www.springframework.org/schema/context/spring-context.xsd
  8. ">
  9.  
  10. <!--引入配置属性文件 -->
  11. <context:property-placeholder location="config/properties/oracle.properties" />
  12.  
  13. <!-- 配置数据源,-->
  14. <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
  15. destroy-method="close">
  16. <property name="driverClassName" value="${driver}" />
  17. <property name="url" value="${url}" />
  18. <property name="username" value="${uname}" />
  19. <property name="password" value="${password}" />
  20. <!-- 初始化连接大小 -->
  21. <property name="initialSize" value="${initialSize}"></property>
  22. <!-- 连接池最大数量 -->
  23. <property name="maxActive" value="${maxActive}"></property>
  24. <!-- 连接池最大空闲 -->
  25. <property name="maxIdle" value="${maxIdle}"></property>
  26. <!-- 连接池最小空闲 -->
  27. <property name="minIdle" value="${minIdle}"></property>
  28. <!-- 获取连接最大等待时间 -->
  29. <property name="maxWait" value="${maxWait}"></property>
  30. </bean>
  31.  
  32. <!-- 配置sqlSessionFactory -->
  33. <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
  34. <property name="dataSource" ref="dataSource" /><!-- 实例化sqlSessionFactory时需要使用上述配置好的数据源以及SQL映射文件 -->
  35. <property name="mapperLocations" value="classpath*:mybatis/mappers/**/*.xml" /><!-- spring和MyBatis完美整合,不需要mybatis的配置映射文件 -->
  36. </bean>
  37.  
  38. <!-- 定义SqlSessionTemplate -->
  39. <bean id="sqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate">
  40. <constructor-arg index="0" ref="sqlSessionFactory"></constructor-arg>
  41. </bean>
  42.  
  43. <!-- SqlSession:用于执行持久化操作的对象,类似于jdbc中的Connection。 -->
  44. <!-- SqlSessionFactory:创建SqlSession实例的工厂 -->
  45. <!-- SqlSessionFactoryBuilder:build方法创建SqlSessionFactory实例。 -->
  46. <!-- SqlSessionTemplate:MyBatis提供的持久层访问模板化的工具,线程安全,可通过构造参数或依赖注入SqlSessionFactory实例。 -->
  47.  
  48. </beans>

spring-tx.xml

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
  4. xsi:schemaLocation="http://www.springframework.org/schema/beans
  5. http://www.springframework.org/schema/beans/spring-beans.xsd
  6. http://www.springframework.org/schema/context
  7. http://www.springframework.org/schema/context/spring-context.xsd
  8. http://www.springframework.org/schema/aop
  9. http://www.springframework.org/schema/aop/spring-aop.xsd
  10. http://www.springframework.org/schema/tx
  11. http://www.springframework.org/schema/tx/spring-tx.xsd
  12. ">
  13.  
  14. <!-- (事务管理)transaction manager, use JtaTransactionManager for global tx -->
  15. <bean id="transactionManager"
  16. class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
  17. <property name="dataSource" ref="dataSource" />
  18. </bean>
  19.  
  20. </beans>

log4j.properties

  1. log4j.rootLogger=DEBUG,Console,Stdout
  2.  
  3. #[Level] DEBUG
  4. log4j.logger.java.sql.ResultSet=INFO
  5. log4j.logger.org.apache=INFO
  6. log4j.logger.java.sql.Connection=DEBUG
  7. log4j.logger.java.sql.Statement=DEBUG
  8. log4j.logger.java.sql.PreparedStatement=DEBUG
  9.  
  10. #Console
  11. log4j.appender.Console=org.apache.log4j.ConsoleAppender
  12. log4j.appender.Console.layout=org.apache.log4j.PatternLayout
  13. log4j.appender.Console.layout.ConversionPattern=%d [%t] %-5p [%c] - %m%n
  14.  
  15. #stdout \u6807\u51C6\u8F93\u51FA
  16. log4j.appender.Stdout = org.apache.log4j.DailyRollingFileAppender
  17. log4j.appender.Stdout.File = E://logs/log.log
  18. log4j.appender.Stdout.Append = true
  19. log4j.appender.Stdout.Threshold = DEBUG
  20. log4j.appender.Stdout.layout = org.apache.log4j.PatternLayout
  21. log4j.appender.Stdout.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n

oracle.properties

  1. driver=oracle.jdbc.driver.OracleDriver
  2. url=jdbc:oracle:thin:@127.0.0.1:1521:orcl
  3. uname=scott
  4. password=tiger
  5. initialSize=0
  6. maxActive=20
  7. maxIdle=20
  8. minIdle=1
  9. maxWait=60000

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

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

先贴 common 目录:

common 下面的 log4j  目录:

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

  1. package com.etoak.msm.common.log4j;
  2.  
  3. import org.springframework.beans.factory.InitializingBean;
  4. import org.springframework.beans.factory.config.MethodInvokingFactoryBean;
  5.  
  6. public class MytMethodInvokingFactoryBean extends MethodInvokingFactoryBean implements InitializingBean {
  7. @Override
  8. public void afterPropertiesSet() throws Exception {
  9. super.afterPropertiesSet();
  10. Object[] args = getArguments();
  11. for (int i = 0; i < args.length; i++) {
  12. Object obj = args[i];
  13. if (obj instanceof String) {
  14. String arg =obj.toString();
  15. if(arg.startsWith("classpath:")||arg.startsWith("classpath*:")){
  16. arg=arg.split(":")[1];
  17. arg=this.getClass().getClassLoader().getResource(arg).getPath();
  18. args[i]=arg;
  19. }
  20. }
  21. }
  22. setArguments(args);
  23. }
  24. }

再来 emp 目录

dao 目录:

  1. package com.etoak.msm.emp.dao;
  2.  
  3. import java.util.List;
  4.  
  5. import com.etoak.msm.emp.entity.Emp;
  6.  
  7. public interface EmpDao {
  8.  
  9. public int addEmp(Emp emp);
  10. public List<Emp> getEmps(Emp emp);
  11. public Emp getEmpByEmpno(int empno);
  12.  
  13. }

entity  实体类目录

  1. package com.etoak.msm.emp.entity;
  2.  
  3. import java.util.Date;
  4.  
  5. public class Emp {
  6.  
  7. private int empno ;
  8. private String ename ;
  9. private String job ;
  10. private int mgr ;
  11. private Date hiredate ;
  12. private int sal ;
  13. private int comm ;
  14. private int deptno ;
  15.  
  16. public int getEmpno() {
  17. return empno;
  18. }
  19. public void setEmpno(int empno) {
  20. this.empno = empno;
  21. }
  22. public String getEname() {
  23. return ename;
  24. }
  25. public void setEname(String ename) {
  26. this.ename = ename;
  27. }
  28. public String getJob() {
  29. return job;
  30. }
  31. public void setJob(String job) {
  32. this.job = job;
  33. }
  34. public int getMgr() {
  35. return mgr;
  36. }
  37. public void setMgr(int mgr) {
  38. this.mgr = mgr;
  39. }
  40. public Date getHiredate() {
  41. return hiredate;
  42. }
  43. public void setHiredate(Date hiredate) {
  44. this.hiredate = hiredate;
  45. }
  46. public int getSal() {
  47. return sal;
  48. }
  49. public void setSal(int sal) {
  50. this.sal = sal;
  51. }
  52. public int getComm() {
  53. return comm;
  54. }
  55. public void setComm(int comm) {
  56. this.comm = comm;
  57. }
  58. public int getDeptno() {
  59. return deptno;
  60. }
  61. public void setDeptno(int deptno) {
  62. this.deptno = deptno;
  63. }
  64.  
  65. @Override
  66. public String toString() {
  67. return "Emp [empno=" + empno + ", ename=" + ename + ", job=" + job + ", mgr=" + mgr + ", hiredate=" + hiredate
  68. + ", sal=" + sal + ", comm=" + comm + ", deptno=" + deptno + "]";
  69. }
  70.  
  71. }

服务目录:

先来接口:

  1. package com.etoak.msm.emp.service;
  2.  
  3. import java.util.List;
  4.  
  5. import com.etoak.msm.emp.entity.Emp;
  6.  
  7. public interface EmpService {
  8.  
  9. public int addEmp(Emp emp);
  10.  
  11. public Emp getEmpByEmpno(int empno);
  12.  
  13. public List<Emp> getEmps(Emp emp);
  14. }

再来实现类:

  1. package com.etoak.msm.emp.service.impl;
  2.  
  3. import java.util.List;
  4.  
  5. import org.springframework.beans.factory.annotation.Autowired;
  6. import org.springframework.stereotype.Service;
  7.  
  8. import com.etoak.msm.emp.dao.EmpDao;
  9. import com.etoak.msm.emp.entity.Emp;
  10. import com.etoak.msm.emp.service.EmpService;
  11.  
  12. @Service
  13. public class EmpServeiceImpl implements EmpService {
  14.  
  15. @Autowired
  16. private EmpDao empDao ;
  17.  
  18. public int addEmp(Emp emp) {
  19. return empDao.addEmp(emp);
  20. }
  21.  
  22. public Emp getEmpByEmpno(int empno) {
  23. return empDao.getEmpByEmpno(empno);
  24. }
  25.  
  26. public List<Emp> getEmps(Emp emp) {
  27. return empDao.getEmps(emp);
  28. }
  29.  
  30. }

最后 测试类:

  1. package com.etoak.msm.emp.test;
  2.  
  3. import java.util.Date;
  4. import java.util.List;
  5.  
  6. import org.junit.runner.RunWith;
  7. import org.springframework.beans.factory.annotation.Autowired;
  8. import org.springframework.test.context.ContextConfiguration;
  9. import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
  10.  
  11. import com.etoak.msm.emp.entity.Emp;
  12. import com.etoak.msm.emp.service.EmpService;
  13.  
  14. @RunWith(SpringJUnit4ClassRunner.class)
  15. @ContextConfiguration(locations = { "classpath:applicationContext.xml" })// 如果报错:程序包org.junit不存在 参考: http://www.cnblogs.com/LiuChunfu/p/5598367.html
  16. public class TestCase {
  17.  
  18. @Autowired
  19. private EmpService empService;
  20.  
  21. @org.junit.Test
  22. public void getOne() {
  23.  
  24. Emp emp = empService.getEmpByEmpno(7369);
  25. System.out.println(emp);
  26. }
  27.  
  28. @org.junit.Test
  29. public void getAll() {
  30. Emp emp = new Emp();
  31. //emp.setEmpno(7369);
  32. List<Emp> list = empService.getEmps(emp);
  33. for(Emp e : list){
  34. System.out.println(e);
  35. }
  36. }
  37.  
  38. @org.junit.Test
  39. public void addOne(){
  40. Emp emp = new Emp();
  41. // emp.setEmpno(7300);
  42. emp.setComm(0);
  43. emp.setDeptno(10);
  44. emp.setEname("张三");
  45. emp.setJob("CEO");
  46. emp.setMgr(0);
  47. emp.setSal(1);
  48. emp.setHiredate(new Date());
  49. int i = empService.addEmp(emp);
  50. System.out.println(i);
  51. }
  52.  
  53. }

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

先 maven clearn maven install 一下 :

然后 运行 测试用例:

运行结果 如下:

控制台:

  1. log4j:WARN No appenders could be found for logger (org.springframework.test.context.junit4.SpringJUnit4ClassRunner).
  2. log4j:WARN Please initialize the log4j system properly.
  3. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
  4. 2017-06-12 09:02:35,823 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Finished creating instance of bean 'log4jInitialization'
  5. 2017-06-12 09:02:35,839 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating shared instance of singleton bean 'empDao'
  6. 2017-06-12 09:02:35,839 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating instance of bean 'empDao'
  7. 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
  8. 2017-06-12 09:02:35,839 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating shared instance of singleton bean 'sqlSessionFactory'
  9. 2017-06-12 09:02:35,839 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating instance of bean 'sqlSessionFactory'
  10. 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
  11. 2017-06-12 09:02:35,855 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating shared instance of singleton bean 'dataSource'
  12. 2017-06-12 09:02:35,855 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating instance of bean 'dataSource'
  13. 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
  14. 2017-06-12 09:02:35,933 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Finished creating instance of bean 'dataSource'
  15. 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/]]
  16. 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]
  17. 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]
  18. 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]
  19. 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]]
  20. 2017-06-12 09:02:35,948 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Invoking afterPropertiesSet() on bean with name 'sqlSessionFactory'
  21. 2017-06-12 09:02:35,948 [main] DEBUG [org.mybatis.spring.SqlSessionFactoryBean] - Property 'configuration' or 'configLocation' not specified, using default MyBatis Configuration
  22. 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]'
  23. 2017-06-12 09:02:36,102 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Finished creating instance of bean 'sqlSessionFactory'
  24. 2017-06-12 09:02:36,103 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Invoking afterPropertiesSet() on bean with name 'empDao'
  25. 2017-06-12 09:02:36,103 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Finished creating instance of bean 'empDao'
  26. 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'
  27. 2017-06-12 09:02:36,103 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Finished creating instance of bean 'empServeiceImpl'
  28. 2017-06-12 09:02:36,103 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'log4jInitialization'
  29. 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'
  30. 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'
  31. 2017-06-12 09:02:36,103 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'dataSource'
  32. 2017-06-12 09:02:36,103 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'sqlSessionFactory'
  33. 2017-06-12 09:02:36,103 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating shared instance of singleton bean 'sqlSessionTemplate'
  34. 2017-06-12 09:02:36,103 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating instance of bean 'sqlSessionTemplate'
  35. 2017-06-12 09:02:36,103 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'sqlSessionFactory'
  36. 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
  37. 2017-06-12 09:02:36,103 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Finished creating instance of bean 'sqlSessionTemplate'
  38. 2017-06-12 09:02:36,103 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating shared instance of singleton bean 'transactionManager'
  39. 2017-06-12 09:02:36,103 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating instance of bean 'transactionManager'
  40. 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
  41. 2017-06-12 09:02:36,119 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'dataSource'
  42. 2017-06-12 09:02:36,119 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Invoking afterPropertiesSet() on bean with name 'transactionManager'
  43. 2017-06-12 09:02:36,119 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Finished creating instance of bean 'transactionManager'
  44. 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'
  45. 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'
  46. 2017-06-12 09:02:36,119 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'empDao'
  47. 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'
  48. 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]
  49. 2017-06-12 09:02:36,135 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'lifecycleProcessor'
  50. 2017-06-12 09:02:36,135 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'sqlSessionFactory'
  51. 2017-06-12 09:02:36,135 [main] DEBUG [org.springframework.core.env.PropertySourcesPropertyResolver] - Searching for key 'spring.liveBeansView.mbeanDomain' in [systemProperties]
  52. 2017-06-12 09:02:36,135 [main] DEBUG [org.springframework.core.env.PropertySourcesPropertyResolver] - Searching for key 'spring.liveBeansView.mbeanDomain' in [systemEnvironment]
  53. 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]
  54. 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]]]
  55. 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]
  56. 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
  57. 2017-06-12 09:02:36,135 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'empServeiceImpl'
  58. 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'
  59. 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].
  60. 2017-06-12 09:02:36,150 [main] DEBUG [org.mybatis.spring.SqlSessionUtils] - Creating a new SqlSession
  61. 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
  62. 2017-06-12 09:02:36,166 [main] DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] - Fetching JDBC Connection from DataSource
  63. 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
  64. 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
  65. 2017-06-12 09:02:36,432 [main] DEBUG [com.etoak.msm.emp.dao.EmpDao.addEmp!selectKey] - ==> Parameters:
  66. 2017-06-12 09:02:36,494 [main] DEBUG [com.etoak.msm.emp.dao.EmpDao.addEmp!selectKey] - <== Total: 1
  67. 2017-06-12 09:02:36,494 [main] DEBUG [com.etoak.msm.emp.dao.EmpDao.addEmp] - ==> Preparing: insert into emp values(?,?,?,?,?,?,?,?)
  68. 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)
  69. 2017-06-12 09:02:36,510 [main] DEBUG [com.etoak.msm.emp.dao.EmpDao.addEmp] - <== Updates: 1
  70. 2017-06-12 09:02:36,510 [main] DEBUG [org.mybatis.spring.SqlSessionUtils] - Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@5fb759d6]
  71. 2017-06-12 09:02:36,510 [main] DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] - Returning JDBC Connection to DataSource
  72. 1
  73. 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].
  74. 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]
  75. 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]
  76. 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]]]].
  77. 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]]]
  78. 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]
  79. 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
  80. 2017-06-12 09:02:36,510 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'empServeiceImpl'
  81. 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].
  82. 2017-06-12 09:02:36,510 [main] DEBUG [org.mybatis.spring.SqlSessionUtils] - Creating a new SqlSession
  83. 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
  84. 2017-06-12 09:02:36,541 [main] DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] - Fetching JDBC Connection from DataSource
  85. 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
  86. 2017-06-12 09:02:36,541 [main] DEBUG [com.etoak.msm.emp.dao.EmpDao.getEmps] - ==> Preparing: SELECT * from emp where 1 = 1
  87. 2017-06-12 09:02:36,541 [main] DEBUG [com.etoak.msm.emp.dao.EmpDao.getEmps] - ==> Parameters:
  88. 2017-06-12 09:02:36,557 [main] DEBUG [com.etoak.msm.emp.dao.EmpDao.getEmps] - <== Total: 19
  89. 2017-06-12 09:02:36,557 [main] DEBUG [org.mybatis.spring.SqlSessionUtils] - Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@327bcebd]
  90. 2017-06-12 09:02:36,557 [main] DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] - Returning JDBC Connection to DataSource
  91. Emp [empno=1005, ename=张三, job=CEO, mgr=0, hiredate=Mon Jun 12 00:00:00 CST 2017, sal=1, comm=0, deptno=10]
  92. Emp [empno=7935, ename=MILLER, job=CLERK, mgr=7782, hiredate=null, sal=0, comm=0, deptno=0]
  93. Emp [empno=7369, ename=SMITH, job=CLERK, mgr=7902, hiredate=Wed Dec 17 00:00:00 CST 1980, sal=800, comm=0, deptno=20]
  94. Emp [empno=7499, ename=ALLEN, job=SALESMAN, mgr=7698, hiredate=Fri Feb 20 00:00:00 CST 1981, sal=1600, comm=300, deptno=30]
  95. Emp [empno=7521, ename=WARD, job=SALESMAN, mgr=7698, hiredate=Sun Feb 22 00:00:00 CST 1981, sal=1250, comm=500, deptno=30]
  96. Emp [empno=7566, ename=JONES, job=MANAGER, mgr=7839, hiredate=Thu Apr 02 00:00:00 CST 1981, sal=2975, comm=0, deptno=20]
  97. Emp [empno=7654, ename=MARTIN, job=SALESMAN, mgr=7698, hiredate=Mon Sep 28 00:00:00 CST 1981, sal=1250, comm=1400, deptno=30]
  98. Emp [empno=7698, ename=BLAKE, job=MANAGER, mgr=7839, hiredate=Fri May 01 00:00:00 CST 1981, sal=2850, comm=0, deptno=30]
  99. Emp [empno=7782, ename=CLARK, job=MANAGER, mgr=7839, hiredate=Tue Jun 09 00:00:00 CST 1981, sal=2450, comm=0, deptno=10]
  100. Emp [empno=7788, ename=SCOTT, job=ANALYST, mgr=7566, hiredate=Sun Apr 19 00:00:00 CDT 1987, sal=3000, comm=0, deptno=20]
  101. Emp [empno=7839, ename=KING, job=PRESIDENT, mgr=0, hiredate=Tue Nov 17 00:00:00 CST 1981, sal=5000, comm=0, deptno=10]
  102. Emp [empno=7844, ename=TURNER, job=SALESMAN, mgr=7698, hiredate=Tue Sep 08 00:00:00 CST 1981, sal=1500, comm=0, deptno=30]
  103. Emp [empno=7876, ename=ADAMS, job=CLERK, mgr=7788, hiredate=Sat May 23 00:00:00 CDT 1987, sal=1100, comm=0, deptno=20]
  104. Emp [empno=7900, ename=JAMES, job=CLERK, mgr=7698, hiredate=Thu Dec 03 00:00:00 CST 1981, sal=950, comm=0, deptno=30]
  105. Emp [empno=7902, ename=FORD, job=ANALYST, mgr=7566, hiredate=Thu Dec 03 00:00:00 CST 1981, sal=3000, comm=0, deptno=20]
  106. Emp [empno=7934, ename=MILLER, job=CLERK, mgr=7782, hiredate=Sat Jan 23 00:00:00 CST 1982, sal=1300, comm=0, deptno=10]
  107. Emp [empno=7300, ename=张三, job=CEO, mgr=0, hiredate=Sun Jun 11 00:00:00 CST 2017, sal=1, comm=0, deptno=10]
  108. Emp [empno=1003, ename=张三, job=CEO, mgr=0, hiredate=Sun Jun 11 00:00:00 CST 2017, sal=1, comm=0, deptno=10]
  109. Emp [empno=1004, ename=张三, job=CEO, mgr=0, hiredate=Sun Jun 11 00:00:00 CST 2017, sal=1, comm=0, deptno=10]
  110. 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].
  111. 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]
  112. 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]
  113. 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]]]].
  114. 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]]]
  115. 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]
  116. 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
  117. 2017-06-12 09:02:36,557 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'empServeiceImpl'
  118. 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].
  119. 2017-06-12 09:02:36,557 [main] DEBUG [org.mybatis.spring.SqlSessionUtils] - Creating a new SqlSession
  120. 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
  121. 2017-06-12 09:02:36,557 [main] DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] - Fetching JDBC Connection from DataSource
  122. 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
  123. 2017-06-12 09:02:36,557 [main] DEBUG [com.etoak.msm.emp.dao.EmpDao.getEmpByEmpno] - ==> Preparing: SELECT * from emp where empno = ?
  124. 2017-06-12 09:02:36,557 [main] DEBUG [com.etoak.msm.emp.dao.EmpDao.getEmpByEmpno] - ==> Parameters: 7369(Integer)
  125. 2017-06-12 09:02:36,557 [main] DEBUG [com.etoak.msm.emp.dao.EmpDao.getEmpByEmpno] - <== Total: 1
  126. 2017-06-12 09:02:36,557 [main] DEBUG [org.mybatis.spring.SqlSessionUtils] - Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@10a9d961]
  127. 2017-06-12 09:02:36,557 [main] DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] - Returning JDBC Connection to DataSource
  128. Emp [empno=7369, ename=SMITH, job=CLERK, mgr=7902, hiredate=Wed Dec 17 00:00:00 CST 1980, sal=800, comm=0, deptno=20]
  129. 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].
  130. 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].
  131. 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
  132. 2017-06-12 09:02:36,557 [Thread-1] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'sqlSessionFactory'
  133. 2017-06-12 09:02:36,557 [Thread-1] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'lifecycleProcessor'
  134. 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
  135. 2017-06-12 09:02:36,572 [Thread-1] DEBUG [org.springframework.beans.factory.support.DisposableBeanAdapter] - Invoking destroy() on bean with name 'sqlSessionTemplate'
  136. 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]
  137. 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 项目(包含测试用例)的更多相关文章

  1. 用Eclipse 创建一个 简单的 Maven JavaWeb 项目

    使用Maven 创建一个简单的 javaWeb 项目: 本篇属于 创建 JavaWeb 项目的第三篇: 建议阅读本篇之前 阅读 用 Eclipse 创建一个简单的web项目  ;本篇是这这篇文章的基础 ...

  2. 用 eclipse 创建一个简单的 meaven spring springMvc mybatis 项目

    下面是整体步骤: 1: 先创建一个Maven 项目: 选择跳过骨架: 因为要搭建的是 web 项目  所以这个地方选择 war 包; 点击完成 这样就完成 Maven项目的搭建: 接下俩 先把 Mav ...

  3. 使用Intellij IDEA搭建一个简单的Maven项目

    IntelliJ IDEA是Java最优秀的开发工具,它功能全面,提示比较智能,开发界面炫酷,新技术支持的比较迅速. 我使用了Eclipse快10年了,IntelliJ IDEA这么好用必须要试一试. ...

  4. 详细解释 集成Maven Spring Mybatis项目包生成Bat文件

    有时在项目必须Maven项目包生成bat文件,长官一人.本文将解释的具体使用方法maven-assembly-plugin插件实现bat文件包. 1.首先看一下项目结构 2.配置pom.xml文件,在 ...

  5. idea 创建的maven+spring+mybatis项目整合 报错无法创建bean

    报错如下: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with n ...

  6. 用Eclipse 搭建一个Maven Spring SpringMVC 项目

    1: 先创建一个maven web  项目: 可以参照之前的文章:  用Maven 创建一个 简单的 JavaWeb 项目 创建好之后的目录是这样的; 2: 先配置maven  修改pom.xml & ...

  7. 创建一个简单的maven的web程序

    最近学习Hadoop,发现学习要想用hadoop作为后台运行web程序,必须应用maven,所以学习了今天学习了一下maven,然后搭建了一个简单的web程序 首先我使用的是eclipse中自带的ma ...

  8. 使用maven+eclipse搭建最简单的struts2的helloworld

    使用maven+eclipse搭建最简单的struts2的helloworld 一.web分层结构简介 1.web[细]粒度分层结构: 按细粒度分层可以分为以下6种: 1).表现层:html/css/ ...

  9. mybatis学习笔记(五) -- maven+spring+mybatis从零开始搭建整合详细过程(附demo和搭建过程遇到的问题解决方法)

    文章介绍结构一览 一.使用maven创建web项目 1.新建maven项目 2.修改jre版本 3.修改Project Facts,生成WebContent文件夾 4.将WebContent下的两个文 ...

随机推荐

  1. Linux命令行学习

    "mkdir + 文件夹名字" 创建文件夹 "pwd" 显示当前工作目录的绝对路径. "touch" 创建空文件. "cat /p ...

  2. 201521123100 《java程序设计》第12周学习总结

    1. 本周学习总结 1.1 以你喜欢的方式(思维导图或其他)归纳总结多流与文件相关内容. 2. 书面作业 将Student对象(属性:int id, String name,int age,doubl ...

  3. Python 浅谈注释的重要性

    最近参加了一个比赛,然后看到队友编程的代码,我觉得真的是难以下咽,几乎每个字符都要咨询他,用老师的话来说,这就是山炮编程员,所以此时的我意识到写一篇关于注释程序的重要性了,因此特地的写一篇文章帮助大家 ...

  4. lintcode.44 最小子数组

    最小子数组   描述 笔记 数据 评测 给定一个整数数组,找到一个具有最小和的子数组.返回其最小和. 注意事项 子数组最少包含一个数字 您在真实的面试中是否遇到过这个题? Yes 哪家公司问你的这个题 ...

  5. Spring - Spring容器概念及其初始化过程

    引言 工作4年多,做了3年的java,每个项目都用Spring,但对Spring一直都是知其然而不知其所以然.鄙人深知Spring是一个高深的框架,正好近期脱离加班的苦逼状态,遂决定从Spring的官 ...

  6. 小甲鱼:Python学习笔记001_变量_分支_数据类型_运算符等基础

    1.下载并安装Python 3.5.0 Python是一个跨平台语言,Python从3.0的版本的语法很多不兼容2版本,官网找到最新的版本并下载:http://www.python.org 2.IDL ...

  7. PHP 动态调整内存限制

    最近公司的一个PHP项目在操作大文件的时候总是抛出这个异常 Fixing PHP Fatal Error: Allowed Memory Size Exhausted 经过一番调试后发现是达到了PHP ...

  8. (一)关于java泛型的学习总结(泛型方法、泛型擦除)

    目录概要 一.泛型方法 二.利用泛型方法的特性实现代码的简化 三. 关于泛型的擦除 四.无界通配符和原生类型区别 五.转型和警告   泛型 一般的类中的属性或方法的参数,只能使用具体的类型:要么是基本 ...

  9. unity3D写一个hello world

    unity3D写一个hello world 打开unity并且在assets建立一个新的文件,新的文件命名为hello world.unity.接着创建一个新的C#Sript脚本文件,命名为hello ...

  10. GCD之死锁

    GCD相当好用,但用不好就会死锁,始终要记着这样一句秘籍: 不要在串行队列放dispatch_sync.dispatch_apply 下面看几个例子 1 2 3 4 5 6 7 8 9 10 11 1 ...