1. 首先创建一个表:
- CREATE TABLE `t_user` (
- `USER_ID` int(11) NOT NULL AUTO_INCREMENT,
- `USER_NAME` char(30) NOT NULL,
- `USER_PASSWORD` char(10) NOT NULL,
- `USER_EMAIL` char(30) NOT NULL,
- PRIMARY KEY (`USER_ID`),
- KEY `IDX_NAME` (`USER_NAME`)
- ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8
随便插入一些数据:
- INSERT INTO t_user (USER_ID, USER_NAME, USER_PASSWORD, USER_EMAIL) VALUES (1, '林炳文', '1234567@', 'ling20081005@126.com');
- INSERT INTO t_user (USER_ID, USER_NAME, USER_PASSWORD, USER_EMAIL) VALUES (2, 'evan', '123', 'fff@126.com');
- INSERT INTO t_user (USER_ID, USER_NAME, USER_PASSWORD, USER_EMAIL) VALUES (3, 'kaka', 'cadg', 'fwsfg@126.com');
- INSERT INTO t_user (USER_ID, USER_NAME, USER_PASSWORD, USER_EMAIL) VALUES (4, 'simle', 'cscs', 'fsaf@126.com');
- INSERT INTO t_user (USER_ID, USER_NAME, USER_PASSWORD, USER_EMAIL) VALUES (5, 'arthur', 'csas', 'fsaff@126.com');
- INSERT INTO t_user (USER_ID, USER_NAME, USER_PASSWORD, USER_EMAIL) VALUES (6, '小德', 'yuh78', 'fdfas@126.com');
- INSERT INTO t_user (USER_ID, USER_NAME, USER_PASSWORD, USER_EMAIL) VALUES (7, '小小', 'cvff', 'fsaf@126.com');
- INSERT INTO t_user (USER_ID, USER_NAME, USER_PASSWORD, USER_EMAIL) VALUES (8, '林林之家', 'gvv', 'lin@126.com');
- INSERT INTO t_user (USER_ID, USER_NAME, USER_PASSWORD, USER_EMAIL) VALUES (9, '林炳文Evankaka', 'dfsc', 'ling2008@126.com');
- INSERT INTO t_user (USER_ID, USER_NAME, USER_PASSWORD, USER_EMAIL) VALUES (10, 'apple', 'uih6', 'ff@qq.com');
二、工程创建
1、Maven工程创建
(1)新建
(3)输出项目名,包,记得选war(表示web项目,以后可以spingMVC连起来用)
(4)创建好之后
(5)检查下
这三个地方JDK的版本一定要一样!!!!
三、sping+mybatis配置
1、整个工程目录如下:
2、POM文件
3、Java代码-------src/main/java
目录如下:
(1)User.java
对应数据库中表的字段,放在src/main/java下的包com.lin.domain
(2)UserDao.java
Dao接口类,用来对应mapper文件。放在src/main/java下的包com.lin.dao,内容如下:
(2)UserService.java和UserServiceImpl.java
service接口类和实现类,放在src/main/java下的包com.lin.service,内容如下:
UserService.java
UserServiceImpl.java(4)mapper文件
用来和dao文件对应,放在src/main/java下的com.lin.mapper包下
4、资源配置-------src/main/resources 目录:
(1)mybatis配置文件
这里没有什么内容,因为都被放到application.xml中去了,放在src/main/resources下的mybatis文件夹下
mybatis-config.xml内容如下:
(2)数据源配置jdbc.properties
放在src/main/resources下的propertiesy文件夹下
(3)spring配置
这是最重要的:application.xml内容如下
(4)日志打印log4j.properties
就放在src/main/resources
四、单元测试
上面的配置完好,接下来就是测验成功
整个目录 如下:
(1)测试基类
(2)测试类
选中selectUserByIdTest,然后右键如下运行
***************************************************************************************************************************************************************************************
注意:
要是jdk1.8 那么spring 版本需要4.0以上
在文件 pom修改 (这里就随意选择4.1.5)
application.xml 修改:
#################################################################################################################################
运行结果:(以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]
结果是正确的:数据库数据如下