springMVC 与mybatis 整合 demo(maven 工程)

来源:互联网 发布:python的idle在哪 编辑:程序博客网 时间:2024/05/17 21:57

一、准备工作(mysql数据库安装)

1. 首先创建一个表:

  1. CREATE TABLE `t_user` (  
  2.   `USER_ID` int(11) NOT NULL AUTO_INCREMENT,  
  3.   `USER_NAME` char(30) NOT NULL,  
  4.   `USER_PASSWORD` char(10) NOT NULL,  
  5.   `USER_EMAIL` char(30) NOT NULL,  
  6.   PRIMARY KEY (`USER_ID`),  
  7.   KEY `IDX_NAME` (`USER_NAME`)  
  8. ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8  

随便插入一些数据:

  1. INSERT INTO t_user (USER_ID, USER_NAME, USER_PASSWORD, USER_EMAIL) VALUES (1, '林炳文', '1234567@', 'ling20081005@126.com');  
  2. INSERT INTO t_user (USER_ID, USER_NAME, USER_PASSWORD, USER_EMAIL) VALUES (2, 'evan', '123', 'fff@126.com');  
  3. INSERT INTO t_user (USER_ID, USER_NAME, USER_PASSWORD, USER_EMAIL) VALUES (3, 'kaka', 'cadg', 'fwsfg@126.com');  
  4. INSERT INTO t_user (USER_ID, USER_NAME, USER_PASSWORD, USER_EMAIL) VALUES (4, 'simle', 'cscs', 'fsaf@126.com');  
  5. INSERT INTO t_user (USER_ID, USER_NAME, USER_PASSWORD, USER_EMAIL) VALUES (5, 'arthur', 'csas', 'fsaff@126.com');  
  6. INSERT INTO t_user (USER_ID, USER_NAME, USER_PASSWORD, USER_EMAIL) VALUES (6, '小德', 'yuh78', 'fdfas@126.com');  
  7. INSERT INTO t_user (USER_ID, USER_NAME, USER_PASSWORD, USER_EMAIL) VALUES (7, '小小', 'cvff', 'fsaf@126.com');  
  8. INSERT INTO t_user (USER_ID, USER_NAME, USER_PASSWORD, USER_EMAIL) VALUES (8, '林林之家', 'gvv', 'lin@126.com');  
  9. INSERT INTO t_user (USER_ID, USER_NAME, USER_PASSWORD, USER_EMAIL) VALUES (9, '林炳文Evankaka', 'dfsc', 'ling2008@126.com');  
  10. INSERT INTO t_user (USER_ID, USER_NAME, USER_PASSWORD, USER_EMAIL) VALUES (10, 'apple', 'uih6', 'ff@qq.com');

二、工程创建

1、Maven工程创建

(1)新建


(2)选择快速框架


(3)输出项目名,包,记得选war(表示web项目,以后可以spingMVC连起来用)


(4)创建好之后 



(5)检查下

这三个地方JDK的版本一定要一样!!!!




三、sping+mybatis配置

1、整个工程目录如下:


2、POM文件

<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.lin</groupId>      <artifactId>ssm_project</artifactId>      <version>0.0.1-SNAPSHOT</version>      <packaging>war</packaging>      <properties>          <!-- spring版本号 -->          <spring.version>3.2.8.RELEASE</spring.version>          <!-- log4j日志文件管理包版本 -->          <slf4j.version>1.6.6</slf4j.version>          <log4j.version>1.2.12</log4j.version>          <!-- junit版本号 -->          <junit.version>4.10</junit.version>          <!-- mybatis版本号 -->          <mybatis.version>3.2.1</mybatis.version>      </properties>        <dependencies>          <!-- 添加Spring依赖 -->          <dependency>              <groupId>org.springframework</groupId>              <artifactId>spring-core</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-context</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-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-tx</artifactId>              <version>${spring.version}</version>          </dependency>          <dependency>              <groupId>org.springframework</groupId>              <artifactId>spring-jdbc</artifactId>              <version>${spring.version}</version>          </dependency>          <dependency>              <groupId>org.springframework</groupId>              <artifactId>spring-web</artifactId>              <version>${spring.version}</version>          </dependency>            <!--单元测试依赖 -->          <dependency>              <groupId>junit</groupId>              <artifactId>junit</artifactId>              <version>${junit.version}</version>              <scope>test</scope>          </dependency>            <!-- 日志文件管理包 -->          <!-- log 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>          <!-- log end -->            <!--spring单元测试依赖 -->          <dependency>              <groupId>org.springframework</groupId>              <artifactId>spring-test</artifactId>              <version>${spring.version}</version>              <scope>test</scope>          </dependency>            <!--mybatis依赖 -->          <dependency>              <groupId>org.mybatis</groupId>              <artifactId>mybatis</artifactId>              <version>${mybatis.version}</version>          </dependency>            <!-- mybatis/spring包 -->          <dependency>              <groupId>org.mybatis</groupId>              <artifactId>mybatis-spring</artifactId>              <version>1.2.0</version>          </dependency>            <!-- mysql驱动包 -->          <dependency>              <groupId>mysql</groupId>              <artifactId>mysql-connector-java</artifactId>              <version>5.1.29</version>          </dependency>      </dependencies>    </project>  

3、java代码-------src/main/java

目录如下:


(1)User.java

对应数据库中表的字段,放在src/main/java下的包com.lin.domain


package com.lin.domain;    /**  * User映射类  *   */  public class User {      private Integer userId;      private String userName;      private String userPassword;      private String userEmail;        public Integer getUserId() {          return userId;      }        public void setUserId(Integer userId) {          this.userId = userId;      }        public String getUserName() {          return userName;      }        public void setUserName(String userName) {          this.userName = userName;      }        public String getUserPassword() {          return userPassword;      }        public void setUserPassword(String userPassword) {          this.userPassword = userPassword;      }        public String getUserEmail() {          return userEmail;      }        public void setUserEmail(String userEmail) {          this.userEmail = userEmail;      }        @Override      public String toString() {          return "User [userId=" + userId + ", userName=" + userName                  + ", userPassword=" + userPassword + ", userEmail=" + userEmail                  + "]";      }        }  

(2)UserDao.java

Dao接口类,用来对应mapper文件。放在src/main/java下的包com.lin.dao,内容如下:

package com.lin.dao;      import com.lin.domain.User;    /**  * 功能概要:User的DAO类  *   * @author linbingwen  * @since 2015年9月28日  */  public interface UserDao {      /**      *       * @param userId      * @return      */      public User selectUserById(Integer userId);    }  

(2)UserService.java和UserServiceImpl.java

service接口类和实现类,放在src/main/java下的包com.lin.service,内容如下:

UserService.java

package com.lin.service;    import org.springframework.stereotype.Service;    import com.lin.domain.User;    /**  * 功能概要:UserService接口类  *   */  public interface UserService {      User selectUserById(Integer userId);    }  
UserServiceImpl.java
package com.lin.service;    import org.springframework.beans.factory.annotation.Autowired;  import org.springframework.stereotype.Service;    import com.lin.dao.UserDao;  import com.lin.domain.User;    /**  * 功能概要:UserService实现类  *   *  */  @Service  public class UserServiceImpl implements UserService{      @Autowired      private UserDao userDao;        public User selectUserById(Integer userId) {          return userDao.selectUserById(userId);                }    }  

(4)mapper文件

用来和dao文件对应,放在src/main/java下的com.lin.mapper包下

<?xml version="1.0" encoding="UTF-8"?>    <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"    "http://mybatis.org/dtd/mybatis-3-mapper.dtd">  <mapper namespace="com.lin.dao.UserDao">  <!--设置domain类和数据库中表的字段一一对应,注意数据库字段和domain类中的字段名称不致,此处一定要!-->      <resultMap id="BaseResultMap" type="com.lin.domain.User">          <id column="USER_ID" property="userId" jdbcType="INTEGER" />          <result column="USER_NAME" property="userName" jdbcType="CHAR" />          <result column="USER_PASSWORD" property="userPassword" jdbcType="CHAR" />          <result column="USER_EMAIL" property="userEmail" jdbcType="CHAR" />      </resultMap>      <!-- 查询单条记录 -->      <select id="selectUserById" parameterType="int" resultMap="BaseResultMap">          SELECT * FROM t_user WHERE USER_ID = #{userId}      </select>  </mapper>  

4、资源配置-------src/main/resources  目录:



(1)mybatis配置文件

这里没有什么内容,因为都被放到application.xml中去了,放在src/main/resources下的mybatis文件夹下

mybatis-config.xml内容如下:

<?xml version="1.0" encoding="UTF-8"?>    <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN"    "http://mybatis.org/dtd/mybatis-3-config.dtd">    <configuration>      </configuration> 

(2)数据源配置jdbc.properties

放在src/main/resources下的propertiesy文件夹下

jdbc_driverClassName=com.mysql.jdbc.Driver  jdbc_url=jdbc:mysql://localhost:3306/lxlbase jdbc_username=root  jdbc_password=lxl

(3)Spring配置

这是最重要的:application.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"      xmlns:aop="http://www.springframework.org/schema/aop"      xsi:schemaLocation="               http://www.springframework.org/schema/beans               http://www.springframework.org/schema/beans/spring-beans-3.0.xsd               http://www.springframework.org/schema/aop               http://www.springframework.org/schema/aop/spring-aop-3.0.xsd             http://www.springframework.org/schema/context               http://www.springframework.org/schema/context/spring-context-3.0.xsd">              <!-- 引入jdbc配置文件 -->         <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">          <property name="locations">              <list>                 <value>classpath:properties/*.properties</value>                  <!--要是有多个配置文件,只需在这里继续添加即可 -->              </list>          </property>      </bean>                    <!-- 配置数据源 -->      <bean id="dataSource"          class="org.springframework.jdbc.datasource.DriverManagerDataSource">          <!-- 不使用properties来配置 -->          <!-- <property name="driverClassName" value="com.mysql.jdbc.Driver" />               <property name="url" value="jdbc:mysql://localhost:3306/learning" />               <property name="username" value="root" />               <property name="password" value="christmas258@" /> -->         <!-- 使用properties来配置 -->          <property name="driverClassName">              <value>${jdbc_driverClassName}</value>          </property>          <property name="url">              <value>${jdbc_url}</value>          </property>          <property name="username">              <value>${jdbc_username}</value>          </property>          <property name="password">              <value>${jdbc_password}</value>          </property>      </bean>        <!-- 自动扫描了所有的XxxxMapper.xml对应的mapper接口文件,这样就不用一个一个手动配置Mpper的映射了,只要Mapper接口类和Mapper映射文件对应起来就可以了。 -->      <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">          <property name="basePackage"              value="com.lin.dao" />      </bean>        <!-- 配置Mybatis的文件 ,mapperLocations配置**Mapper.xml文件位置,configLocation配置mybatis-config文件位置-->      <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">          <property name="dataSource" ref="dataSource" />          <property name="mapperLocations" value="classpath*:com/lin/mapper/**/*.xml"/>            <property name="configLocation" value="classpath:mybatis/mybatis-config.xml" />          <!-- <property name="typeAliasesPackage" value="com.tiantian.ckeditor.model"               /> -->      </bean>        <!-- 自动扫描注解的bean -->      <context:component-scan base-package="com.lin.service" />    </beans>  

(4)日志打印log4j.properties

就放在src/main/resources

log4j.rootLogger=DEBUG,Console,Stdout    #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    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     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

四、单元测试

 上面的配置完好,接下来就是测验成功

整个目录 如下:


(1)测试基类

package com.lin.baseTest;    import org.junit.runner.RunWith;  import org.slf4j.Logger;  import org.slf4j.LoggerFactory;  import org.springframework.test.context.ContextConfiguration;  import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;  import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;    /**  * 功能概要:  *    */  //指定bean注入的配置文件  @ContextConfiguration(locations = { "classpath:application.xml" })  //使用标准的JUnit @RunWith注释来告诉JUnit使用Spring TestRunner  @RunWith(SpringJUnit4ClassRunner.class)  public abstract class SpringTestCase extends AbstractJUnit4SpringContextTests{      protected Logger logger = LoggerFactory.getLogger(getClass());  }  

(2)测试类

package com.lin.service;    import org.apache.log4j.Logger;  import org.junit.Test;  import org.springframework.beans.factory.annotation.Autowired;    import com.lin.baseTest.SpringTestCase;  import com.lin.domain.User;    /**  * 功能概要:UserService单元测试  *     */  public class UserServiceTest extends SpringTestCase {      @Autowired      private UserService userService;      Logger logger = Logger.getLogger(UserServiceTest.class);            @Test      public void selectUserByIdTest(){          User user = userService.selectUserById(10);          logger.debug("查找结果" + user);      }        }  

选中selectUserByIdTest,然后右键如下运行



***************************************************************************************************************************************************************************************

注意:

要是jdk1.8 那么spring 版本需要4.0以上

在文件 pom修改 (这里就随意选择4.1.5)

  <!-- spring版本号 -->          <spring.version>4.1.5.RELEASE</spring.version>  
application.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"      xmlns:aop="http://www.springframework.org/schema/aop"      xsi:schemaLocation="               http://www.springframework.org/schema/beans               http://www.springframework.org/schema/beans/spring-beans-4.0.xsd               http://www.springframework.org/schema/aop               http://www.springframework.org/schema/aop/spring-aop-4.0.xsd             http://www.springframework.org/schema/context               http://www.springframework.org/schema/context/spring-context-4.0.xsd">              <!-- 引入jdbc配置文件 -->         <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">          <property name="locations">              <list>                 <value>classpath:properties/*.properties</value>                  <!--要是有多个配置文件,只需在这里继续添加即可 -->              </list>          </property>      </bean>              

#################################################################################################################################

运行结果:(以jdk1.8为例)

2017-06-03 20:09:04,035 [main] DEBUG [org.springframework.test.context.junit4.SpringJUnit4ClassRunner] - SpringJUnit4ClassRunner constructor called with [class com.lin.service.UserServiceTest].
  2017-06-03 20:09:04,267 [main] DEBUG [org.springframework.test.context.BootstrapUtils] - Instantiating TestContextBootstrapper from class [org.springframework.test.context.support.DefaultTestContextBootstrapper]
  2017-06-03 20:09:04,387 [main] DEBUG [org.springframework.test.context.support.AbstractDelegatingSmartContextLoader] - Delegating to GenericXmlContextLoader to process context configuration [ContextConfigurationAttributes@2aaf7cc2 declaringClass = 'com.lin.baseTest.SpringTestCase', classes = '{}', locations = '{classpath:application.xml}', inheritLocations = true, initializers = '{}', inheritInitializers = true, name = [null], contextLoaderClass = 'org.springframework.test.context.ContextLoader'].
  2017-06-03 20:09:04,419 [main] DEBUG [org.springframework.test.context.support.ActiveProfilesUtils] - Could not find an 'annotation declaring class' for annotation type [org.springframework.test.context.ActiveProfiles] and class [com.lin.service.UserServiceTest]
  2017-06-03 20:09:04,538 [main] INFO  [org.springframework.test.context.support.DefaultTestContextBootstrapper] - Could not instantiate TestExecutionListener [org.springframework.test.context.web.ServletTestExecutionListener]. Specify custom listener classes or make the default listener classes (and their required dependencies) available. Offending class: [javax/servlet/ServletContext]
  2017-06-03 20:09:04,557 [main] INFO  [org.springframework.test.context.support.DefaultTestContextBootstrapper] - Using TestExecutionListeners: [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@35bbe5e8, org.springframework.test.context.support.DirtiesContextTestExecutionListener@2c8d66b2]
  2017-06-03 20:09:04,559 [main] DEBUG [org.springframework.test.annotation.ProfileValueUtils] - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.lin.service.UserServiceTest]
  2017-06-03 20:09:04,560 [main] DEBUG [org.springframework.test.annotation.ProfileValueUtils] - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.lin.service.UserServiceTest]
  2017-06-03 20:09:04,561 [main] DEBUG [org.springframework.test.annotation.ProfileValueUtils] - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.lin.service.UserServiceTest]
  2017-06-03 20:09:04,561 [main] DEBUG [org.springframework.test.annotation.ProfileValueUtils] - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.lin.service.UserServiceTest]
  2017-06-03 20:09:04,631 [main] DEBUG [org.springframework.test.annotation.ProfileValueUtils] - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.lin.service.UserServiceTest]
  2017-06-03 20:09:04,632 [main] DEBUG [org.springframework.test.annotation.ProfileValueUtils] - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.lin.service.UserServiceTest]
  2017-06-03 20:09:04,633 [main] DEBUG [org.springframework.test.annotation.ProfileValueUtils] - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.lin.service.UserServiceTest]
  2017-06-03 20:09:04,633 [main] DEBUG [org.springframework.test.annotation.ProfileValueUtils] - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.lin.service.UserServiceTest]
  2017-06-03 20:09:04,634 [main] DEBUG [org.springframework.test.annotation.ProfileValueUtils] - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.lin.service.UserServiceTest]
  2017-06-03 20:09:04,635 [main] DEBUG [org.springframework.test.annotation.ProfileValueUtils] - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.lin.service.UserServiceTest]
  2017-06-03 20:09:04,652 [main] DEBUG [org.springframework.test.annotation.ProfileValueUtils] - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.lin.service.UserServiceTest]
  2017-06-03 20:09:04,652 [main] DEBUG [org.springframework.test.annotation.ProfileValueUtils] - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.lin.service.UserServiceTest]
  2017-06-03 20:09:04,737 [main] DEBUG [org.springframework.test.context.support.DependencyInjectionTestExecutionListener] - Performing dependency injection for test context [[DefaultTestContext@7f690630 testClass = UserServiceTest, testInstance = com.lin.service.UserServiceTest@edf4efb, testMethod = [null], testException = [null], mergedContextConfiguration = [MergedContextConfiguration@2f7a2457 testClass = UserServiceTest, locations = '{classpath:application.xml}', classes = '{}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{}', contextLoader = 'org.springframework.test.context.support.DelegatingSmartContextLoader', parent = [null]]]].
  2017-06-03 20:09:04,738 [main] DEBUG [org.springframework.test.context.support.AbstractDelegatingSmartContextLoader] - Delegating to GenericXmlContextLoader to load context from [MergedContextConfiguration@2f7a2457 testClass = UserServiceTest, locations = '{classpath:application.xml}', classes = '{}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{}', contextLoader = 'org.springframework.test.context.support.DelegatingSmartContextLoader', parent = [null]].
  2017-06-03 20:09:04,738 [main] DEBUG [org.springframework.test.context.support.AbstractGenericContextLoader] - Loading ApplicationContext for merged context configuration [[MergedContextConfiguration@2f7a2457 testClass = UserServiceTest, locations = '{classpath:application.xml}', classes = '{}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{}', contextLoader = 'org.springframework.test.context.support.DelegatingSmartContextLoader', parent = [null]]].
  2017-06-03 20:09:05,271 [main] DEBUG [org.springframework.core.env.StandardEnvironment] - Adding [systemProperties] PropertySource with lowest search precedence
  2017-06-03 20:09:05,272 [main] DEBUG [org.springframework.core.env.StandardEnvironment] - Adding [systemEnvironment] PropertySource with lowest search precedence
  2017-06-03 20:09:05,273 [main] DEBUG [org.springframework.core.env.StandardEnvironment] - Initialized StandardEnvironment with PropertySources [systemProperties,systemEnvironment]
  2017-06-03 20:09:05,498 [main] INFO  [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] - Loading XML bean definitions from class path resource [application.xml]
  2017-06-03 20:09:05,839 [main] DEBUG [org.springframework.beans.factory.xml.DefaultDocumentLoader] - Using JAXP provider [com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl]
  2017-06-03 20:09:06,365 [main] DEBUG [org.springframework.beans.factory.xml.PluggableSchemaResolver] - Loading schema mappings from [META-INF/spring.schemas]
  2017-06-03 20:09:06,446 [main] DEBUG [org.springframework.beans.factory.xml.PluggableSchemaResolver] - Loaded schema mappings: {http://www.springframework.org/schema/tx/spring-tx-2.5.xsd=org/springframework/transaction/config/spring-tx-2.5.xsd, http://www.springframework.org/schema/aop/spring-aop-4.1.xsd=org/springframework/aop/config/spring-aop-4.1.xsd, http://www.springframework.org/schema/context/spring-context-3.1.xsd=org/springframework/context/config/spring-context-3.1.xsd, http://www.springframework.org/schema/jdbc/spring-jdbc-4.1.xsd=org/springframework/jdbc/config/spring-jdbc-4.1.xsd, http://www.springframework.org/schema/util/spring-util-3.0.xsd=org/springframework/beans/factory/xml/spring-util-3.0.xsd, http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd=org/springframework/web/servlet/config/spring-mvc-4.1.xsd, http://mybatis.org/schema/mybatis-spring-1.2.xsd=org/mybatis/spring/config/mybatis-spring-1.2.xsd, http://www.springframework.org/schema/tool/spring-tool.xsd=org/springframework/beans/factory/xml/spring-tool-4.1.xsd, http://www.springframework.org/schema/aop/spring-aop-3.2.xsd=org/springframework/aop/config/spring-aop-3.2.xsd, http://www.springframework.org/schema/lang/spring-lang-4.1.xsd=org/springframework/scripting/config/spring-lang-4.1.xsd, http://www.springframework.org/schema/context/spring-context-4.0.xsd=org/springframework/context/config/spring-context-4.0.xsd, http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd=org/springframework/web/servlet/config/spring-mvc-3.2.xsd, http://www.springframework.org/schema/tool/spring-tool-4.1.xsd=org/springframework/beans/factory/xml/spring-tool-4.1.xsd, http://www.springframework.org/schema/lang/spring-lang-3.2.xsd=org/springframework/scripting/config/spring-lang-3.2.xsd, http://www.springframework.org/schema/cache/spring-cache-3.2.xsd=org/springframework/cache/config/spring-cache-3.2.xsd, http://www.springframework.org/schema/jee/spring-jee-4.1.xsd=org/springframework/ejb/config/spring-jee-4.1.xsd, http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd=org/springframework/jdbc/config/spring-jdbc-3.1.xsd, http://www.springframework.org/schema/util/spring-util-2.0.xsd=org/springframework/beans/factory/xml/spring-util-2.0.xsd, http://www.springframework.org/schema/tool/spring-tool-3.2.xsd=org/springframework/beans/factory/xml/spring-tool-3.2.xsd, http://www.springframework.org/schema/context/spring-context.xsd=org/springframework/context/config/spring-context-4.1.xsd, http://www.springframework.org/schema/cache/spring-cache-4.1.xsd=org/springframework/cache/config/spring-cache-4.1.xsd, http://www.springframework.org/schema/aop/spring-aop-4.0.xsd=org/springframework/aop/config/spring-aop-4.0.xsd, http://www.springframework.org/schema/jee/spring-jee-3.2.xsd=org/springframework/ejb/config/spring-jee-3.2.xsd, http://www.springframework.org/schema/context/spring-context-3.0.xsd=org/springframework/context/config/spring-context-3.0.xsd, http://www.springframework.org/schema/jdbc/spring-jdbc-4.0.xsd=org/springframework/jdbc/config/spring-jdbc-4.0.xsd, http://www.springframework.org/schema/util/spring-util-2.5.xsd=org/springframework/beans/factory/xml/spring-util-2.5.xsd, http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd=org/springframework/web/servlet/config/spring-mvc-4.0.xsd, http://www.springframework.org/schema/beans/spring-beans-3.2.xsd=org/springframework/beans/factory/xml/spring-beans-3.2.xsd, http://www.springframework.org/schema/aop/spring-aop-3.1.xsd=org/springframework/aop/config/spring-aop-3.1.xsd, http://www.springframework.org/schema/lang/spring-lang-4.0.xsd=org/springframework/scripting/config/spring-lang-4.0.xsd, http://www.springframework.org/schema/mvc/spring-mvc.xsd=org/springframework/web/servlet/config/spring-mvc-4.1.xsd, http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd=org/springframework/web/servlet/config/spring-mvc-3.1.xsd, http://www.springframework.org/schema/beans/spring-beans-4.1.xsd=org/springframework/beans/factory/xml/spring-beans-4.1.xsd, http://www.springframework.org/schema/tool/spring-tool-4.0.xsd=org/springframework/beans/factory/xml/spring-tool-4.0.xsd, http://www.springframework.org/schema/tx/spring-tx-3.2.xsd=org/springframework/transaction/config/spring-tx-3.2.xsd, http://www.springframework.org/schema/lang/spring-lang-3.1.xsd=org/springframework/scripting/config/spring-lang-3.1.xsd, http://www.springframework.org/schema/cache/spring-cache-3.1.xsd=org/springframework/cache/config/spring-cache-3.1.xsd, http://www.springframework.org/schema/jee/spring-jee-4.0.xsd=org/springframework/ejb/config/spring-jee-4.0.xsd, http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd=org/springframework/jdbc/config/spring-jdbc-3.0.xsd, http://www.springframework.org/schema/task/spring-task-4.1.xsd=org/springframework/scheduling/config/spring-task-4.1.xsd, http://www.springframework.org/schema/jdbc/spring-jdbc.xsd=org/springframework/jdbc/config/spring-jdbc-4.1.xsd, http://www.springframework.org/schema/tool/spring-tool-3.1.xsd=org/springframework/beans/factory/xml/spring-tool-3.1.xsd, http://www.springframework.org/schema/tx/spring-tx-4.1.xsd=org/springframework/transaction/config/spring-tx-4.1.xsd, http://www.springframework.org/schema/cache/spring-cache-4.0.xsd=org/springframework/cache/config/spring-cache-4.0.xsd, http://www.springframework.org/schema/jee/spring-jee-3.1.xsd=org/springframework/ejb/config/spring-jee-3.1.xsd, http://www.springframework.org/schema/task/spring-task-3.2.xsd=org/springframework/scheduling/config/spring-task-3.2.xsd, http://www.springframework.org/schema/beans/spring-beans-3.1.xsd=org/springframework/beans/factory/xml/spring-beans-3.1.xsd, http://www.springframework.org/schema/util/spring-util.xsd=org/springframework/beans/factory/xml/spring-util-4.1.xsd, http://www.springframework.org/schema/aop/spring-aop-3.0.xsd=org/springframework/aop/config/spring-aop-3.0.xsd, http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd=org/springframework/web/servlet/config/spring-mvc-3.0.xsd, http://www.springframework.org/schema/beans/spring-beans-4.0.xsd=org/springframework/beans/factory/xml/spring-beans-4.0.xsd, http://www.springframework.org/schema/beans/spring-beans.xsd=org/springframework/beans/factory/xml/spring-beans-4.1.xsd, http://mybatis.org/schema/mybatis-spring.xsd=org/mybatis/spring/config/mybatis-spring-1.2.xsd, http://www.springframework.org/schema/tx/spring-tx-3.1.xsd=org/springframework/transaction/config/spring-tx-3.1.xsd, http://www.springframework.org/schema/lang/spring-lang-3.0.xsd=org/springframework/scripting/config/spring-lang-3.0.xsd, http://www.springframework.org/schema/context/spring-context-2.5.xsd=org/springframework/context/config/spring-context-2.5.xsd, http://www.springframework.org/schema/task/spring-task-4.0.xsd=org/springframework/scheduling/config/spring-task-4.0.xsd, http://www.springframework.org/schema/tool/spring-tool-3.0.xsd=org/springframework/beans/factory/xml/spring-tool-3.0.xsd, http://www.springframework.org/schema/tx/spring-tx-4.0.xsd=org/springframework/transaction/config/spring-tx-4.0.xsd, http://www.springframework.org/schema/aop/spring-aop-2.0.xsd=org/springframework/aop/config/spring-aop-2.0.xsd, http://www.springframework.org/schema/jee/spring-jee-3.0.xsd=org/springframework/ejb/config/spring-jee-3.0.xsd, http://www.springframework.org/schema/util/spring-util-4.1.xsd=org/springframework/beans/factory/xml/spring-util-4.1.xsd, http://www.springframework.org/schema/task/spring-task-3.1.xsd=org/springframework/scheduling/config/spring-task-3.1.xsd, http://www.springframework.org/schema/beans/spring-beans-3.0.xsd=org/springframework/beans/factory/xml/spring-beans-3.0.xsd, http://www.springframework.org/schema/jee/spring-jee.xsd=org/springframework/ejb/config/spring-jee-4.1.xsd, http://www.springframework.org/schema/aop/spring-aop-2.5.xsd=org/springframework/aop/config/spring-aop-2.5.xsd, http://www.springframework.org/schema/lang/spring-lang-2.0.xsd=org/springframework/scripting/config/spring-lang-2.0.xsd, http://www.springframework.org/schema/util/spring-util-3.2.xsd=org/springframework/beans/factory/xml/spring-util-3.2.xsd, http://www.springframework.org/schema/task/spring-task.xsd=org/springframework/scheduling/config/spring-task-4.1.xsd, http://www.springframework.org/schema/tool/spring-tool-2.0.xsd=org/springframework/beans/factory/xml/spring-tool-2.0.xsd, http://www.springframework.org/schema/tx/spring-tx-3.0.xsd=org/springframework/transaction/config/spring-tx-3.0.xsd, http://www.springframework.org/schema/lang/spring-lang-2.5.xsd=org/springframework/scripting/config/spring-lang-2.5.xsd, http://www.springframework.org/schema/jee/spring-jee-2.0.xsd=org/springframework/ejb/config/spring-jee-2.0.xsd, http://www.springframework.org/schema/tool/spring-tool-2.5.xsd=org/springframework/beans/factory/xml/spring-tool-2.5.xsd, http://www.springframework.org/schema/jee/spring-jee-2.5.xsd=org/springframework/ejb/config/spring-jee-2.5.xsd, http://www.springframework.org/schema/util/spring-util-4.0.xsd=org/springframework/beans/factory/xml/spring-util-4.0.xsd, http://www.springframework.org/schema/task/spring-task-3.0.xsd=org/springframework/scheduling/config/spring-task-3.0.xsd, http://www.springframework.org/schema/lang/spring-lang.xsd=org/springframework/scripting/config/spring-lang-4.1.xsd, http://www.springframework.org/schema/context/spring-context-3.2.xsd=org/springframework/context/config/spring-context-3.2.xsd, http://www.springframework.org/schema/util/spring-util-3.1.xsd=org/springframework/beans/factory/xml/spring-util-3.1.xsd, http://www.springframework.org/schema/beans/spring-beans-2.0.xsd=org/springframework/beans/factory/xml/spring-beans-2.0.xsd, http://www.springframework.org/schema/cache/spring-cache.xsd=org/springframework/cache/config/spring-cache-4.1.xsd, http://www.springframework.org/schema/tx/spring-tx.xsd=org/springframework/transaction/config/spring-tx-4.1.xsd, http://www.springframework.org/schema/context/spring-context-4.1.xsd=org/springframework/context/config/spring-context-4.1.xsd, http://www.springframework.org/schema/beans/spring-beans-2.5.xsd=org/springframework/beans/factory/xml/spring-beans-2.5.xsd, http://www.springframework.org/schema/tx/spring-tx-2.0.xsd=org/springframework/transaction/config/spring-tx-2.0.xsd, http://www.springframework.org/schema/jdbc/spring-jdbc-3.2.xsd=org/springframework/jdbc/config/spring-jdbc-3.2.xsd, http://www.springframework.org/schema/aop/spring-aop.xsd=org/springframework/aop/config/spring-aop-4.1.xsd}
  2017-06-03 20:09:06,449 [main] DEBUG [org.springframework.beans.factory.xml.PluggableSchemaResolver] - Found XML schema [http://www.springframework.org/schema/beans/spring-beans-4.0.xsd] in classpath: org/springframework/beans/factory/xml/spring-beans-4.0.xsd
  2017-06-03 20:09:06,562 [main] DEBUG [org.springframework.beans.factory.xml.PluggableSchemaResolver] - Found XML schema [http://www.springframework.org/schema/context/spring-context-4.0.xsd] in classpath: org/springframework/context/config/spring-context-4.0.xsd
  2017-06-03 20:09:06,593 [main] DEBUG [org.springframework.beans.factory.xml.PluggableSchemaResolver] - Found XML schema [http://www.springframework.org/schema/tool/spring-tool-4.0.xsd] in classpath: org/springframework/beans/factory/xml/spring-tool-4.0.xsd
  2017-06-03 20:09:06,630 [main] DEBUG [org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader] - Loading bean definitions
  2017-06-03 20:09:06,799 [main] DEBUG [org.springframework.beans.factory.xml.BeanDefinitionParserDelegate] - Neither XML 'id' nor 'name' specified - using generated bean name [org.mybatis.spring.mapper.MapperScannerConfigurer#0]
  2017-06-03 20:09:06,884 [main] DEBUG [org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver] - Loaded NamespaceHandler mappings: {http://www.springframework.org/schema/p=org.springframework.beans.factory.xml.SimplePropertyNamespaceHandler, http://www.springframework.org/schema/mvc=org.springframework.web.servlet.config.MvcNamespaceHandler, http://www.springframework.org/schema/util=org.springframework.beans.factory.xml.UtilNamespaceHandler, http://www.springframework.org/schema/jee=org.springframework.ejb.config.JeeNamespaceHandler, http://www.springframework.org/schema/aop=org.springframework.aop.config.AopNamespaceHandler, http://www.springframework.org/schema/jdbc=org.springframework.jdbc.config.JdbcNamespaceHandler, http://www.springframework.org/schema/cache=org.springframework.cache.config.CacheNamespaceHandler, http://mybatis.org/schema/mybatis-spring=org.mybatis.spring.config.NamespaceHandler, http://www.springframework.org/schema/c=org.springframework.beans.factory.xml.SimpleConstructorNamespaceHandler, http://www.springframework.org/schema/tx=org.springframework.transaction.config.TxNamespaceHandler, http://www.springframework.org/schema/task=org.springframework.scheduling.config.TaskNamespaceHandler, http://www.springframework.org/schema/lang=org.springframework.scripting.config.LangNamespaceHandler, http://www.springframework.org/schema/context=org.springframework.context.config.ContextNamespaceHandler}
  2017-06-03 20:09:07,050 [main] DEBUG [org.springframework.core.io.support.PathMatchingResourcePatternResolver] - Looking for matching resources in directory tree [D:\J2EE work\mavenSpring\target\test-classes\com\lin\service]
  2017-06-03 20:09:07,051 [main] DEBUG [org.springframework.core.io.support.PathMatchingResourcePatternResolver] - Searching directory [D:\J2EE work\mavenSpring\target\test-classes\com\lin\service] for files matching pattern [D:/J2EE work/mavenSpring/target/test-classes/com/lin/service/**/*.class]
  2017-06-03 20:09:07,055 [main] DEBUG [org.springframework.core.io.support.PathMatchingResourcePatternResolver] - Looking for matching resources in directory tree [D:\J2EE work\mavenSpring\target\classes\com\lin\service]
  2017-06-03 20:09:07,055 [main] DEBUG [org.springframework.core.io.support.PathMatchingResourcePatternResolver] - Searching directory [D:\J2EE work\mavenSpring\target\classes\com\lin\service] for files matching pattern [D:/J2EE work/mavenSpring/target/classes/com/lin/service/**/*.class]
  2017-06-03 20:09:07,056 [main] DEBUG [org.springframework.core.io.support.PathMatchingResourcePatternResolver] - Resolved location pattern [classpath*:com/lin/service/**/*.class] to resources [file [D:\J2EE work\mavenSpring\target\test-classes\com\lin\service\UserServiceTest.class], file [D:\J2EE work\mavenSpring\target\classes\com\lin\service\UserService.class], file [D:\J2EE work\mavenSpring\target\classes\com\lin\service\UserServiceImpl.class]]
  2017-06-03 20:09:07,081 [main] DEBUG [org.springframework.context.annotation.ClassPathBeanDefinitionScanner] - Identified candidate component class: file [D:\J2EE work\mavenSpring\target\classes\com\lin\service\UserServiceImpl.class]
  2017-06-03 20:09:07,163 [main] DEBUG [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] - Loaded 9 bean definitions from location pattern [classpath:application.xml]
  2017-06-03 20:09:07,199 [main] INFO  [org.springframework.context.support.GenericApplicationContext] - Refreshing org.springframework.context.support.GenericApplicationContext@15975490: startup date [Sat Jun 03 20:09:07 CST 2017]; root of context hierarchy
  2017-06-03 20:09:07,199 [main] DEBUG [org.springframework.context.support.GenericApplicationContext] - Bean factory for org.springframework.context.support.GenericApplicationContext@15975490: org.springframework.beans.factory.support.DefaultListableBeanFactory@543e710e: defining beans [propertyConfigurer,dataSource,org.mybatis.spring.mapper.MapperScannerConfigurer#0,sqlSessionFactory,userServiceImpl,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor]; root of factory hierarchy
  2017-06-03 20:09:07,262 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating shared instance of singleton bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor'
  2017-06-03 20:09:07,262 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating instance of bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor'
  2017-06-03 20:09:07,297 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Eagerly caching bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor' to allow for resolving potential circular references
  2017-06-03 20:09:07,299 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Finished creating instance of bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor'
  2017-06-03 20:09:07,390 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating shared instance of singleton bean 'org.mybatis.spring.mapper.MapperScannerConfigurer#0'
  2017-06-03 20:09:07,390 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating instance of bean 'org.mybatis.spring.mapper.MapperScannerConfigurer#0'
  2017-06-03 20:09:07,390 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Eagerly caching bean 'org.mybatis.spring.mapper.MapperScannerConfigurer#0' to allow for resolving potential circular references
  2017-06-03 20:09:07,612 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Invoking afterPropertiesSet() on bean with name 'org.mybatis.spring.mapper.MapperScannerConfigurer#0'
  2017-06-03 20:09:07,612 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Finished creating instance of bean 'org.mybatis.spring.mapper.MapperScannerConfigurer#0'
  2017-06-03 20:09:07,615 [main] DEBUG [org.springframework.core.env.StandardEnvironment] - Adding [systemProperties] PropertySource with lowest search precedence
  2017-06-03 20:09:07,615 [main] DEBUG [org.springframework.core.env.StandardEnvironment] - Adding [systemEnvironment] PropertySource with lowest search precedence
  2017-06-03 20:09:07,615 [main] DEBUG [org.springframework.core.env.StandardEnvironment] - Initialized StandardEnvironment with PropertySources [systemProperties,systemEnvironment]
  2017-06-03 20:09:07,616 [main] DEBUG [org.springframework.core.io.support.PathMatchingResourcePatternResolver] - Looking for matching resources in directory tree [D:\J2EE work\mavenSpring\target\classes\com\lin\dao]
  2017-06-03 20:09:07,617 [main] DEBUG [org.springframework.core.io.support.PathMatchingResourcePatternResolver] - Searching directory [D:\J2EE work\mavenSpring\target\classes\com\lin\dao] for files matching pattern [D:/J2EE work/mavenSpring/target/classes/com/lin/dao/**/*.class]
  2017-06-03 20:09:07,617 [main] DEBUG [org.springframework.core.io.support.PathMatchingResourcePatternResolver] - Resolved location pattern [classpath*:com/lin/dao/**/*.class] to resources [file [D:\J2EE work\mavenSpring\target\classes\com\lin\dao\UserDao.class]]
  2017-06-03 20:09:07,617 [main] DEBUG [org.mybatis.spring.mapper.ClassPathMapperScanner] - Identified candidate component class: file [D:\J2EE work\mavenSpring\target\classes\com\lin\dao\UserDao.class]
  2017-06-03 20:09:07,618 [main] DEBUG [org.mybatis.spring.mapper.ClassPathMapperScanner] - Creating MapperFactoryBean with name 'userDao' and 'com.lin.dao.UserDao' mapperInterface
  2017-06-03 20:09:07,619 [main] DEBUG [org.mybatis.spring.mapper.ClassPathMapperScanner] - Enabling autowire by type for MapperFactoryBean with name 'userDao'.
  2017-06-03 20:09:07,621 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating shared instance of singleton bean 'propertyConfigurer'
  2017-06-03 20:09:07,621 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating instance of bean 'propertyConfigurer'
  2017-06-03 20:09:07,622 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Eagerly caching bean 'propertyConfigurer' to allow for resolving potential circular references
  2017-06-03 20:09:07,638 [main] DEBUG [org.springframework.core.io.support.PathMatchingResourcePatternResolver] - Looking for matching resources in directory tree [D:\J2EE work\mavenSpring\target\classes\properties]
  2017-06-03 20:09:07,638 [main] DEBUG [org.springframework.core.io.support.PathMatchingResourcePatternResolver] - Searching directory [D:\J2EE work\mavenSpring\target\classes\properties] for files matching pattern [D:/J2EE work/mavenSpring/target/classes/properties/*.properties]
  2017-06-03 20:09:07,639 [main] DEBUG [org.springframework.core.io.support.PathMatchingResourcePatternResolver] - Resolved location pattern [classpath:properties/*.properties] to resources [file [D:\J2EE work\mavenSpring\target\classes\properties\jdbc.properties]]
  2017-06-03 20:09:07,639 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Finished creating instance of bean 'propertyConfigurer'
  2017-06-03 20:09:07,639 [main] INFO  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] - Loading properties file from file [D:\J2EE work\mavenSpring\target\classes\properties\jdbc.properties]
  2017-06-03 20:09:07,703 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating shared instance of singleton bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor'
  2017-06-03 20:09:07,703 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating instance of bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor'
  2017-06-03 20:09:07,705 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Eagerly caching bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor' to allow for resolving potential circular references
  2017-06-03 20:09:07,705 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Finished creating instance of bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor'
  2017-06-03 20:09:07,705 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating shared instance of singleton bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor'
  2017-06-03 20:09:07,705 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating instance of bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor'
  2017-06-03 20:09:07,706 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Eagerly caching bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor' to allow for resolving potential circular references
  2017-06-03 20:09:07,706 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Finished creating instance of bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor'
  2017-06-03 20:09:07,709 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating shared instance of singleton bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor'
  2017-06-03 20:09:07,709 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating instance of bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor'
  2017-06-03 20:09:07,769 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Eagerly caching bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor' to allow for resolving potential circular references
  2017-06-03 20:09:07,770 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Finished creating instance of bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor'
  2017-06-03 20:09:07,770 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating shared instance of singleton bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor'
  2017-06-03 20:09:07,771 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating instance of bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor'
  2017-06-03 20:09:07,771 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Eagerly caching bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor' to allow for resolving potential circular references
  2017-06-03 20:09:07,771 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Finished creating instance of bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor'
  2017-06-03 20:09:07,771 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating shared instance of singleton bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor'
  2017-06-03 20:09:07,771 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating instance of bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor'
  2017-06-03 20:09:07,772 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Eagerly caching bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor' to allow for resolving potential circular references
  2017-06-03 20:09:07,772 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Finished creating instance of bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor'
  2017-06-03 20:09:07,851 [main] DEBUG [org.springframework.context.support.GenericApplicationContext] - Unable to locate MessageSource with name 'messageSource': using default [org.springframework.context.support.DelegatingMessageSource@358ee631]
  2017-06-03 20:09:07,870 [main] DEBUG [org.springframework.context.support.GenericApplicationContext] - Unable to locate ApplicationEventMulticaster with name 'applicationEventMulticaster': using default [org.springframework.context.event.SimpleApplicationEventMulticaster@3901d134]
  2017-06-03 20:09:07,910 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@543e710e: defining beans [propertyConfigurer,dataSource,org.mybatis.spring.mapper.MapperScannerConfigurer#0,sqlSessionFactory,userServiceImpl,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor,org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor,userDao]; root of factory hierarchy
  2017-06-03 20:09:07,910 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'propertyConfigurer'
  2017-06-03 20:09:07,910 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating shared instance of singleton bean 'dataSource'
  2017-06-03 20:09:07,910 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating instance of bean 'dataSource'
  2017-06-03 20:09:08,008 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Eagerly caching bean 'dataSource' to allow for resolving potential circular references
  2017-06-03 20:09:08,079 [main] INFO  [org.springframework.jdbc.datasource.DriverManagerDataSource] - Loaded JDBC driver: com.mysql.jdbc.Driver
  2017-06-03 20:09:08,080 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Finished creating instance of bean 'dataSource'
  2017-06-03 20:09:08,080 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'org.mybatis.spring.mapper.MapperScannerConfigurer#0'
  2017-06-03 20:09:08,081 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating shared instance of singleton bean 'sqlSessionFactory'
  2017-06-03 20:09:08,081 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating instance of bean 'sqlSessionFactory'
  2017-06-03 20:09:08,121 [main] DEBUG [org.apache.ibatis.logging.LogFactory] - Logging initialized using 'class org.apache.ibatis.logging.slf4j.Slf4jImpl' adapter.
  2017-06-03 20:09:08,206 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Eagerly caching bean 'sqlSessionFactory' to allow for resolving potential circular references
  2017-06-03 20:09:08,215 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'dataSource'
  2017-06-03 20:09:08,216 [main] DEBUG [org.springframework.core.io.support.PathMatchingResourcePatternResolver] - Looking for matching resources in directory tree [D:\J2EE work\mavenSpring\target\classes\com\lin\mapper]
  2017-06-03 20:09:08,217 [main] DEBUG [org.springframework.core.io.support.PathMatchingResourcePatternResolver] - Searching directory [D:\J2EE work\mavenSpring\target\classes\com\lin\mapper] for files matching pattern [D:/J2EE work/mavenSpring/target/classes/com/lin/mapper/**/*.xml]
  2017-06-03 20:09:08,223 [main] DEBUG [org.springframework.core.io.support.PathMatchingResourcePatternResolver] - Resolved location pattern [classpath*:com/lin/mapper/**/*.xml] to resources [file [D:\J2EE work\mavenSpring\target\classes\com\lin\mapper\UserMapper.xml]]
  2017-06-03 20:09:08,225 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Invoking afterPropertiesSet() on bean with name 'sqlSessionFactory'
  2017-06-03 20:09:08,514 [main] DEBUG [org.mybatis.spring.SqlSessionFactoryBean] - Parsed configuration file: 'class path resource [mybatis/mybatis-config.xml]'
  2017-06-03 20:09:08,516 [main] DEBUG [org.springframework.jdbc.datasource.DriverManagerDataSource] - Creating new JDBC DriverManager Connection to [jdbc:mysql://localhost:3306/lxlbase]
  2017-06-03 20:09:09,591 [main] DEBUG [org.mybatis.spring.SqlSessionFactoryBean] - Parsed mapper file: 'file [D:\J2EE work\mavenSpring\target\classes\com\lin\mapper\UserMapper.xml]'
  2017-06-03 20:09:09,592 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Finished creating instance of bean 'sqlSessionFactory'
  2017-06-03 20:09:09,593 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating shared instance of singleton bean 'userServiceImpl'
  2017-06-03 20:09:09,593 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating instance of bean 'userServiceImpl'
  2017-06-03 20:09:09,595 [main] DEBUG [org.springframework.beans.factory.annotation.InjectionMetadata] - Registered injected element on class [com.lin.service.UserServiceImpl]: AutowiredFieldElement for private com.lin.dao.UserDao com.lin.service.UserServiceImpl.userDao
  2017-06-03 20:09:09,595 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Eagerly caching bean 'userServiceImpl' to allow for resolving potential circular references
  2017-06-03 20:09:09,597 [main] DEBUG [org.springframework.beans.factory.annotation.InjectionMetadata] - Processing injected element of bean 'userServiceImpl': AutowiredFieldElement for private com.lin.dao.UserDao com.lin.service.UserServiceImpl.userDao
  2017-06-03 20:09:09,599 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating shared instance of singleton bean 'userDao'
  2017-06-03 20:09:09,599 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Creating instance of bean 'userDao'
  2017-06-03 20:09:09,600 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Eagerly caching bean 'userDao' to allow for resolving potential circular references
  2017-06-03 20:09:09,617 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning eagerly cached instance of singleton bean 'userDao' that is not fully initialized yet - a consequence of a circular reference
  2017-06-03 20:09:09,618 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'sqlSessionFactory'
  2017-06-03 20:09:09,618 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Autowiring by type from bean name 'userDao' via property 'sqlSessionFactory' to bean named 'sqlSessionFactory'
  2017-06-03 20:09:09,629 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Invoking afterPropertiesSet() on bean with name 'userDao'
  2017-06-03 20:09:09,629 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Finished creating instance of bean 'userDao'
  2017-06-03 20:09:09,630 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'userDao'
  2017-06-03 20:09:09,633 [main] DEBUG [org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor] - Autowiring by type from bean name 'userServiceImpl' to bean named 'userDao'
  2017-06-03 20:09:09,633 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Finished creating instance of bean 'userServiceImpl'
  2017-06-03 20:09:09,634 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor'
  2017-06-03 20:09:09,634 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor'
  2017-06-03 20:09:09,634 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor'
  2017-06-03 20:09:09,634 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor'
  2017-06-03 20:09:09,634 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor'
  2017-06-03 20:09:09,634 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor'
  2017-06-03 20:09:09,635 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'userDao'
  2017-06-03 20:09:09,649 [main] DEBUG [org.springframework.context.support.GenericApplicationContext] - Unable to locate LifecycleProcessor with name 'lifecycleProcessor': using default [org.springframework.context.support.DefaultLifecycleProcessor@11fc564b]
  2017-06-03 20:09:09,650 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'lifecycleProcessor'
  2017-06-03 20:09:09,716 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'sqlSessionFactory'
  2017-06-03 20:09:09,780 [main] DEBUG [org.springframework.core.env.PropertySourcesPropertyResolver] - Searching for key 'spring.liveBeansView.mbeanDomain' in [systemProperties]
  2017-06-03 20:09:09,780 [main] DEBUG [org.springframework.core.env.PropertySourcesPropertyResolver] - Searching for key 'spring.liveBeansView.mbeanDomain' in [systemEnvironment]
  2017-06-03 20:09:09,780 [main] DEBUG [org.springframework.core.env.PropertySourcesPropertyResolver] - Could not find key 'spring.liveBeansView.mbeanDomain' in any property source. Returning [null]
  2017-06-03 20:09:09,812 [main] DEBUG [org.springframework.test.context.DefaultCacheAwareContextLoaderDelegate] - Storing ApplicationContext in cache under key [[MergedContextConfiguration@2f7a2457 testClass = UserServiceTest, locations = '{classpath:application.xml}', classes = '{}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{}', contextLoader = 'org.springframework.test.context.support.DelegatingSmartContextLoader', parent = [null]]]
  2017-06-03 20:09:09,812 [main] DEBUG [org.springframework.test.context.cache] - Spring test ApplicationContext cache statistics: [ContextCache@55740540 size = 1, hitCount = 0, missCount = 1, parentContextCount = 0]
  2017-06-03 20:09:09,816 [main] DEBUG [org.springframework.beans.factory.annotation.InjectionMetadata] - Processing injected element of bean 'com.lin.service.UserServiceTest': AutowiredFieldElement for private com.lin.service.UserService com.lin.service.UserServiceTest.userService
  2017-06-03 20:09:09,859 [main] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'userServiceImpl'
  2017-06-03 20:09:09,859 [main] DEBUG [org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor] - Autowiring by type from bean name 'com.lin.service.UserServiceTest' to bean named 'userServiceImpl'
  2017-06-03 20:09:09,903 [main] DEBUG [org.mybatis.spring.SqlSessionUtils] - Creating a new SqlSession
  2017-06-03 20:09:10,128 [main] DEBUG [org.mybatis.spring.SqlSessionUtils] - SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@44a7bfbc] was not registered for synchronization because synchronization is not active
  2017-06-03 20:09:10,354 [main] DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] - Fetching JDBC Connection from DataSource
  2017-06-03 20:09:10,354 [main] DEBUG [org.springframework.jdbc.datasource.DriverManagerDataSource] - Creating new JDBC DriverManager Connection to [jdbc:mysql://localhost:3306/lxlbase]
  2017-06-03 20:09:10,434 [main] DEBUG [org.mybatis.spring.transaction.SpringManagedTransaction] - JDBC Connection [com.mysql.jdbc.JDBC4Connection@2df9b86] will not be managed by Spring
  2017-06-03 20:09:10,437 [main] DEBUG [com.lin.dao.UserDao.selectUserById] - ooo Using Connection [com.mysql.jdbc.JDBC4Connection@2df9b86]
  2017-06-03 20:09:10,459 [main] DEBUG [com.lin.dao.UserDao.selectUserById] - ==>  Preparing: SELECT * FROM t_user WHERE USER_ID = ? 
  2017-06-03 20:09:10,599 [main] DEBUG [com.lin.dao.UserDao.selectUserById] - ==> Parameters: 1(Integer)

  2017-06-03 20:09:11,615 [main] DEBUG [org.mybatis.spring.SqlSessionUtils] - Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@44a7bfbc]
  2017-06-03 20:09:11,615 [main] DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] - Returning JDBC Connection to DataSource
  2017-06-03 20:09:11,616 [main] DEBUG [com.lin.service.UserServiceTest] - 查找结果User [userId=1, userName=JACK, userPassword=1234, userEmail=JACK@.COM]
  2017-06-03 20:09:11,616 [main] DEBUG [org.springframework.test.context.support.DirtiesContextTestExecutionListener] - After test method: context
[DefaultTestContext@7f690630 testClass = UserServiceTest, testInstance = com.lin.service.UserServiceTest@edf4efb, testMethod = selectUserByIdTest@UserServiceTest, testException = [null], mergedContextConfiguration = [MergedContextConfiguration@2f7a2457 testClass = UserServiceTest, locations = '{classpath:application.xml}', classes = '{}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{}', contextLoader = 'org.springframework.test.context.support.DelegatingSmartContextLoader', parent = [null]]], class dirties context [false], class mode [null], method dirties context [false].
  2017-06-03 20:09:11,617 [main] DEBUG [org.springframework.test.context.support.DirtiesContextTestExecutionListener] - After test class: context [DefaultTestContext@7f690630 testClass = UserServiceTest, testInstance = [null], testMethod = [null], testException = [null], mergedContextConfiguration = [MergedContextConfiguration@2f7a2457 testClass = UserServiceTest, locations = '{classpath:application.xml}', classes = '{}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{}', contextLoader = 'org.springframework.test.context.support.DelegatingSmartContextLoader', parent = [null]]], dirtiesContext [false].
  2017-06-03 20:09:11,668 [Thread-0] INFO  [org.springframework.context.support.GenericApplicationContext] - Closing org.springframework.context.support.GenericApplicationContext@15975490: startup date [Sat Jun 03 20:09:07 CST 2017]; root of context hierarchy
  2017-06-03 20:09:11,669 [Thread-0] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'sqlSessionFactory'
  2017-06-03 20:09:11,669 [Thread-0] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'lifecycleProcessor'
  2017-06-03 20:09:11,669 [Thread-0] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@543e710e: defining beans [propertyConfigurer,dataSource,org.mybatis.spring.mapper.MapperScannerConfigurer#0,sqlSessionFactory,userServiceImpl,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor,org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor,userDao]; root of factory hierarchy
  2017-06-03 20:09:11,670 [Thread-0] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Retrieved dependent beans for bean 'userServiceImpl': [com.lin.service.UserServiceTest]
  

结果是正确的:数据库数据如下



原创粉丝点击