springMVC 与mybatis 整合 demo(maven 工程)
一、準備工作(mysql數據庫安裝)
1. 首先創建一個表:
隨便插入一些數據:
二、工程創建
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
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.javapackage 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]
??
結果是正確的:數據庫數據如下
總結
以上是生活随笔為你收集整理的springMVC 与mybatis 整合 demo(maven 工程)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 4月30日
- 下一篇: s3c2440移植MQTT