15.mybtis_spring_dao(传智播客)

需求:根据用户id查询用户信息

一.配置

1.mybatis.xml



	
	    
	    
	        
	        
	    
	    
	        
	    
	

2.applicationContext-dao.xml



    
    
    
    
        
        
        
        
        
    
    
    
    
        
        
        
        
    
    
    
    
        
    

二.映射




    

三.接口以及接口实现类

public interface UserDao {
    User findUserById(int id) throws Exception;
}

public class UserDaoImpl extends SqlSessionDaoSupport implements UserDao{
    @Override
    public User findUserById(int id) throws Exception {
        SqlSession sqlSession = this.getSqlSession();
        User user = sqlSession.selectOne("findUserById",1);
        return user;
    }
}

四.po类编写

public class User {
    //属性名要和数据库表的字段对应
    private int id;
    private String username;// 用户姓名
    private String sex;// 性别
    private String birthday;// 生日
    private String address;// 地址
    //get和set方法......
}

五.测试

ApplicationContext applicationContext = new ClassPathXmlApplicationContext("config/spring/applicationContext-dao.xml");
UserDaoImpl userDaoImpl = (UserDaoImpl) applicationContext.getBean("userDaoImpl");
User user = userDaoImpl.findUserById(1);
System.out.println(user);

运行测试结果如下

"C:\Program Files\Java\jdk1.8.0_51\bin\java.exe" "-javaagent:D:\IDEA\IntelliJ IDEA 2018.2\lib\idea_rt.jar=56418:D:\IDEA\IntelliJ IDEA 2018.2\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_51\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\rt.jar;E:\代码存档\mybatis\13.mybatis_spring_dao\target\test-classes;E:\代码存档\mybatis\13.mybatis_spring_dao\target\classes;E:\repository\org\springframework\spring-webmvc\4.2.4.RELEASE\spring-webmvc-4.2.4.RELEASE.jar;E:\repository\org\springframework\spring-beans\4.2.4.RELEASE\spring-beans-4.2.4.RELEASE.jar;E:\repository\org\springframework\spring-context\4.2.4.RELEASE\spring-context-4.2.4.RELEASE.jar;E:\repository\org\springframework\spring-aop\4.2.4.RELEASE\spring-aop-4.2.4.RELEASE.jar;E:\repository\aopalliance\aopalliance\1.0\aopalliance-1.0.jar;E:\repository\org\springframework\spring-expression\4.2.4.RELEASE\spring-expression-4.2.4.RELEASE.jar;E:\repository\org\springframework\spring-web\4.2.4.RELEASE\spring-web-4.2.4.RELEASE.jar;E:\repository\org\springframework\spring-core\4.2.4.RELEASE\spring-core-4.2.4.RELEASE.jar;E:\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;E:\repository\org\springframework\spring-orm\4.2.4.RELEASE\spring-orm-4.2.4.RELEASE.jar;E:\repository\org\springframework\spring-tx\4.2.4.RELEASE\spring-tx-4.2.4.RELEASE.jar;E:\repository\org\springframework\spring-aspects\4.2.4.RELEASE\spring-aspects-4.2.4.RELEASE.jar;E:\repository\org\aspectj\aspectjweaver\1.8.7\aspectjweaver-1.8.7.jar;E:\repository\org\springframework\spring-test\4.2.4.RELEASE\spring-test-4.2.4.RELEASE.jar;E:\repository\org\springframework\spring-jdbc\4.2.4.RELEASE\spring-jdbc-4.2.4.RELEASE.jar;E:\repository\mysql\mysql-connector-java\5.1.38\mysql-connector-java-5.1.38.jar;E:\repository\org\mybatis\mybatis\3.3.1\mybatis-3.3.1.jar;E:\repository\org\mybatis\mybatis-spring\1.2.4\mybatis-spring-1.2.4.jar;E:\repository\log4j\log4j\1.2.17\log4j-1.2.17.jar;E:\repository\org\slf4j\slf4j-api\1.7.18\slf4j-api-1.7.18.jar;E:\repository\org\slf4j\slf4j-log4j12\1.7.25\slf4j-log4j12-1.7.25.jar;E:\repository\com\mchange\c3p0\0.9.2.1\c3p0-0.9.2.1.jar;E:\repository\com\mchange\mchange-commons-java\0.2.3.4\mchange-commons-java-0.2.3.4.jar;E:\repository\javax\servlet\jstl\1.2\jstl-1.2.jar;E:\repository\taglibs\standard\1.1.2\standard-1.1.2.jar" Test
DEBUG [main] - Adding [systemProperties] PropertySource with lowest search precedence
DEBUG [main] - Adding [systemEnvironment] PropertySource with lowest search precedence
DEBUG [main] - Initialized StandardEnvironment with PropertySources [systemProperties,systemEnvironment]
 INFO [main] - Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@45fe3ee3: startup date [Sat Dec 08 11:57:15 CST 2018]; root of context hierarchy
DEBUG [main] - Adding [systemProperties] PropertySource with lowest search precedence
DEBUG [main] - Adding [systemEnvironment] PropertySource with lowest search precedence
DEBUG [main] - Initialized StandardEnvironment with PropertySources [systemProperties,systemEnvironment]
 INFO [main] - Loading XML bean definitions from class path resource [config/spring/applicationContext-dao.xml]
DEBUG [main] - Using JAXP provider [com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl]
DEBUG [main] - Loading schema mappings from [META-INF/spring.schemas]
DEBUG [main] - 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/cache/spring-cache-4.2.xsd=org/springframework/cache/config/spring-cache-4.2.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/aop/spring-aop-3.2.xsd=org/springframework/aop/config/spring-aop-3.2.xsd, http://www.springframework.org/schema/tool/spring-tool.xsd=org/springframework/beans/factory/xml/spring-tool-4.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/beans/spring-beans-4.2.xsd=org/springframework/beans/factory/xml/spring-beans-4.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/task/spring-task-4.2.xsd=org/springframework/scheduling/config/spring-task-4.2.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.2.xsd, http://www.springframework.org/schema/tx/spring-tx-4.2.xsd=org/springframework/transaction/config/spring-tx-4.2.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.2.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.2.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/util/spring-util-4.2.xsd=org/springframework/beans/factory/xml/spring-util-4.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.2.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.2.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.2.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.2.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/context/spring-context-4.2.xsd=org/springframework/context/config/spring-context-4.2.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/aop/spring-aop-4.2.xsd=org/springframework/aop/config/spring-aop-4.2.xsd, http://www.springframework.org/schema/lang/spring-lang.xsd=org/springframework/scripting/config/spring-lang-4.2.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/jdbc/spring-jdbc-4.2.xsd=org/springframework/jdbc/config/spring-jdbc-4.2.xsd, http://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd=org/springframework/web/servlet/config/spring-mvc-4.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.2.xsd, http://www.springframework.org/schema/tx/spring-tx.xsd=org/springframework/transaction/config/spring-tx-4.2.xsd, http://www.springframework.org/schema/lang/spring-lang-4.2.xsd=org/springframework/scripting/config/spring-lang-4.2.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/tool/spring-tool-4.2.xsd=org/springframework/beans/factory/xml/spring-tool-4.2.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/jee/spring-jee-4.2.xsd=org/springframework/ejb/config/spring-jee-4.2.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.2.xsd}
DEBUG [main] - 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
DEBUG [main] - 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
DEBUG [main] - 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
DEBUG [main] - Loading bean definitions
DEBUG [main] - 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}
DEBUG [main] - Loaded 4 bean definitions from location pattern [config/spring/applicationContext-dao.xml]
DEBUG [main] - Bean factory for org.springframework.context.support.ClassPathXmlApplicationContext@45fe3ee3: org.springframework.beans.factory.support.DefaultListableBeanFactory@204f30ec: defining beans [org.springframework.context.support.PropertySourcesPlaceholderConfigurer#0,dataSource,sqlSessionFactory,userDaoImpl]; root of factory hierarchy
DEBUG [main] - Creating shared instance of singleton bean 'org.springframework.context.support.PropertySourcesPlaceholderConfigurer#0'
DEBUG [main] - Creating instance of bean 'org.springframework.context.support.PropertySourcesPlaceholderConfigurer#0'
DEBUG [main] - Eagerly caching bean 'org.springframework.context.support.PropertySourcesPlaceholderConfigurer#0' to allow for resolving potential circular references
DEBUG [main] - Finished creating instance of bean 'org.springframework.context.support.PropertySourcesPlaceholderConfigurer#0'
DEBUG [main] - Adding [environmentProperties] PropertySource with lowest search precedence
 INFO [main] - Loading properties file from class path resource [config/mybatis/db.properties]
DEBUG [main] - Adding [localProperties] PropertySource with lowest search precedence
DEBUG [main] - Searching for key 'jdbc.url' in [environmentProperties]
DEBUG [main] - Searching for key 'jdbc.url' in [systemProperties]
DEBUG [main] - Searching for key 'jdbc.url' in [systemEnvironment]
DEBUG [main] - Could not find key 'jdbc.url' in any property source. Returning [null]
DEBUG [main] - Searching for key 'jdbc.url' in [localProperties]
DEBUG [main] - Found key 'jdbc.url' in [localProperties] with type [String] and value 'jdbc:mysql://localhost:3306/study?useSSL=false'
DEBUG [main] - Searching for key 'jdbc.driver' in [environmentProperties]
DEBUG [main] - Searching for key 'jdbc.driver' in [systemProperties]
DEBUG [main] - Searching for key 'jdbc.driver' in [systemEnvironment]
DEBUG [main] - Could not find key 'jdbc.driver' in any property source. Returning [null]
DEBUG [main] - Searching for key 'jdbc.driver' in [localProperties]
DEBUG [main] - Found key 'jdbc.driver' in [localProperties] with type [String] and value 'com.mysql.jdbc.Driver'
DEBUG [main] - Searching for key 'jdbc.username' in [environmentProperties]
DEBUG [main] - Searching for key 'jdbc.username' in [systemProperties]
DEBUG [main] - Searching for key 'jdbc.username' in [systemEnvironment]
DEBUG [main] - Could not find key 'jdbc.username' in any property source. Returning [null]
DEBUG [main] - Searching for key 'jdbc.username' in [localProperties]
DEBUG [main] - Found key 'jdbc.username' in [localProperties] with type [String] and value 'root'
DEBUG [main] - Searching for key 'jdbc.password' in [environmentProperties]
DEBUG [main] - Searching for key 'jdbc.password' in [systemProperties]
DEBUG [main] - Searching for key 'jdbc.password' in [systemEnvironment]
DEBUG [main] - Could not find key 'jdbc.password' in any property source. Returning [null]
DEBUG [main] - Searching for key 'jdbc.password' in [localProperties]
DEBUG [main] - Found key 'jdbc.password' in [localProperties] with type [String] and value 'admin123'
DEBUG [main] - Unable to locate MessageSource with name 'messageSource': using default [org.springframework.context.support.DelegatingMessageSource@7a9273a8]
DEBUG [main] - Unable to locate ApplicationEventMulticaster with name 'applicationEventMulticaster': using default [org.springframework.context.event.SimpleApplicationEventMulticaster@45820e51]
DEBUG [main] - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@204f30ec: defining beans [org.springframework.context.support.PropertySourcesPlaceholderConfigurer#0,dataSource,sqlSessionFactory,userDaoImpl]; root of factory hierarchy
DEBUG [main] - Returning cached instance of singleton bean 'org.springframework.context.support.PropertySourcesPlaceholderConfigurer#0'
DEBUG [main] - Creating shared instance of singleton bean 'dataSource'
DEBUG [main] - Creating instance of bean 'dataSource'
 INFO [main] - MLog clients using log4j logging.
 INFO [main] - Initializing c3p0-0.9.2.1 [built 20-March-2013 10:47:27 +0000; debug? true; trace: 10]
DEBUG [main] - MBean: com.mchange.v2.c3p0:type=PooledDataSource,identityToken=2tssb09z12u1kciekolc|481a15ff,name=2tssb09z12u1kciekolc|481a15ff registered.
DEBUG [main] - MBean: com.mchange.v2.c3p0:type=PooledDataSource,identityToken=2tssb09z12u1kciekolc|481a15ff,name=2tssb09z12u1kciekolc|481a15ff unregistered, in order to be reregistered after update.
DEBUG [main] - MBean: com.mchange.v2.c3p0:type=PooledDataSource,identityToken=2tssb09z12u1kciekolc|481a15ff,name=2tssb09z12u1kciekolc|481a15ff registered.
DEBUG [main] - Eagerly caching bean 'dataSource' to allow for resolving potential circular references
DEBUG [main] - Finished creating instance of bean 'dataSource'
DEBUG [main] - Creating shared instance of singleton bean 'sqlSessionFactory'
DEBUG [main] - Creating instance of bean 'sqlSessionFactory'
DEBUG [main] - Logging initialized using 'class org.apache.ibatis.logging.slf4j.Slf4jImpl' adapter.
DEBUG [main] - Eagerly caching bean 'sqlSessionFactory' to allow for resolving potential circular references
DEBUG [main] - Returning cached instance of singleton bean 'dataSource'
DEBUG [main] - Invoking afterPropertiesSet() on bean with name 'sqlSessionFactory'
DEBUG [main] - Class not found: org.jboss.vfs.VFS
DEBUG [main] - JBoss 6 VFS API is not available in this environment.
DEBUG [main] - Class not found: org.jboss.vfs.VirtualFile
DEBUG [main] - VFS implementation org.apache.ibatis.io.JBoss6VFS is not valid in this environment.
DEBUG [main] - Using VFS adapter org.apache.ibatis.io.DefaultVFS
DEBUG [main] - Find JAR URL: file:/E:/%e4%bb%a3%e7%a0%81%e5%ad%98%e6%a1%a3/mybatis/13.mybatis_spring_dao/target/classes/com/steven/ssm/po
DEBUG [main] - Not a JAR: file:/E:/%e4%bb%a3%e7%a0%81%e5%ad%98%e6%a1%a3/mybatis/13.mybatis_spring_dao/target/classes/com/steven/ssm/po
DEBUG [main] - Reader entry: User.class
DEBUG [main] - Listing file:/E:/%e4%bb%a3%e7%a0%81%e5%ad%98%e6%a1%a3/mybatis/13.mybatis_spring_dao/target/classes/com/steven/ssm/po
DEBUG [main] - Find JAR URL: file:/E:/%e4%bb%a3%e7%a0%81%e5%ad%98%e6%a1%a3/mybatis/13.mybatis_spring_dao/target/classes/com/steven/ssm/po/User.class
DEBUG [main] - Not a JAR: file:/E:/%e4%bb%a3%e7%a0%81%e5%ad%98%e6%a1%a3/mybatis/13.mybatis_spring_dao/target/classes/com/steven/ssm/po/User.class
DEBUG [main] - Reader entry: ����   3 H
DEBUG [main] - Checking to see if class com.steven.ssm.po.User matches criteria [is assignable to Object]
DEBUG [main] - Parsed configuration file: 'class path resource [config/mybatis/mybatis.xml]'
DEBUG [main] - Property 'mapperLocations' was not specified or no matching resources found
DEBUG [main] - Finished creating instance of bean 'sqlSessionFactory'
DEBUG [main] - Creating shared instance of singleton bean 'userDaoImpl'
DEBUG [main] - Creating instance of bean 'userDaoImpl'
DEBUG [main] - Eagerly caching bean 'userDaoImpl' to allow for resolving potential circular references
DEBUG [main] - Returning cached instance of singleton bean 'sqlSessionFactory'
DEBUG [main] - Invoking afterPropertiesSet() on bean with name 'userDaoImpl'
DEBUG [main] - Finished creating instance of bean 'userDaoImpl'
DEBUG [main] - Unable to locate LifecycleProcessor with name 'lifecycleProcessor': using default [org.springframework.context.support.DefaultLifecycleProcessor@2e005c4b]
DEBUG [main] - Returning cached instance of singleton bean 'lifecycleProcessor'
DEBUG [main] - Returning cached instance of singleton bean 'sqlSessionFactory'
DEBUG [main] - Searching for key 'spring.liveBeansView.mbeanDomain' in [systemProperties]
DEBUG [main] - Searching for key 'spring.liveBeansView.mbeanDomain' in [systemEnvironment]
DEBUG [main] - Could not find key 'spring.liveBeansView.mbeanDomain' in any property source. Returning [null]
DEBUG [main] - Returning cached instance of singleton bean 'userDaoImpl'
DEBUG [main] - Creating a new SqlSession
DEBUG [main] - SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@5c33f1a9] was not registered for synchronization because synchronization is not active
DEBUG [main] - Fetching JDBC Connection from DataSource
 INFO [main] - Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -> 2tssb09z12u1kciekolc|481a15ff, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.mysql.jdbc.Driver, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 2tssb09z12u1kciekolc|481a15ff, idleConnectionTestPeriod -> 0, initialPoolSize -> 3, jdbcUrl -> jdbc:mysql://localhost:3306/study?useSSL=false, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 0, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 15, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 3, numHelperThreads -> 3, preferredTestQuery -> null, properties -> {user=******, password=******}, propertyCycle -> 0, statementCacheNumDeferredCloseThreads -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, userOverrides -> {}, usesTraditionalReflectiveProxies -> false ]
DEBUG [main] - incremented pending_acquires: 1
DEBUG [main] - Starting acquisition series. Incremented pending_acquires [1],  attempts_remaining: 30
DEBUG [main] - com.mchange.v2.async.ThreadPoolAsynchronousRunner@1d296da: Adding task to queue -- com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@7c7a06ec
DEBUG [main] - incremented pending_acquires: 2
DEBUG [main] - Starting acquisition series. Incremented pending_acquires [2],  attempts_remaining: 30
DEBUG [main] - com.mchange.v2.async.ThreadPoolAsynchronousRunner@1d296da: Adding task to queue -- com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@75d4a5c2
DEBUG [main] - incremented pending_acquires: 3
DEBUG [main] - Starting acquisition series. Incremented pending_acquires [3],  attempts_remaining: 30
DEBUG [main] - com.mchange.v2.async.ThreadPoolAsynchronousRunner@1d296da: Adding task to queue -- com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@557caf28
DEBUG [main] - com.mchange.v2.resourcepool.BasicResourcePool@408d971b config: [start -> 3; min -> 3; max -> 15; inc -> 3; num_acq_attempts -> 30; acq_attempt_delay -> 1000; check_idle_resources_delay -> 0; mox_resource_age -> 0; max_idle_time -> 0; excess_max_idle_time -> 0; destroy_unreturned_resc_time -> 0; expiration_enforcement_delay -> 0; break_on_acquisition_failure -> false; debug_store_checkout_exceptions -> false]
DEBUG [main] - Created new pool for auth, username (masked): 'ro******'.
DEBUG [main] - acquire test -- pool size: 0; target_pool_size: 3; desired target? 1
DEBUG [main] - awaitAvailable(): [unknown]
DEBUG [main] - trace com.mchange.v2.resourcepool.BasicResourcePool@408d971b [managed: 0, unused: 0, excluded: 0]
DEBUG [C3P0PooledConnectionPoolManager[identityToken->2tssb09z12u1kciekolc|481a15ff]-HelperThread-#2] - com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager@681cffb1.acquireResource() returning. 
DEBUG [C3P0PooledConnectionPoolManager[identityToken->2tssb09z12u1kciekolc|481a15ff]-HelperThread-#0] - com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager@681cffb1.acquireResource() returning. 
DEBUG [C3P0PooledConnectionPoolManager[identityToken->2tssb09z12u1kciekolc|481a15ff]-HelperThread-#1] - com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager@681cffb1.acquireResource() returning. 
DEBUG [C3P0PooledConnectionPoolManager[identityToken->2tssb09z12u1kciekolc|481a15ff]-HelperThread-#2] - trace com.mchange.v2.resourcepool.BasicResourcePool@408d971b [managed: 1, unused: 1, excluded: 0]
DEBUG [C3P0PooledConnectionPoolManager[identityToken->2tssb09z12u1kciekolc|481a15ff]-HelperThread-#2] - decremented pending_acquires: 2
DEBUG [C3P0PooledConnectionPoolManager[identityToken->2tssb09z12u1kciekolc|481a15ff]-HelperThread-#2] - Acquisition series terminated successfully. Decremented pending_acquires [2],  attempts_remaining: 30
DEBUG [main] - trace com.mchange.v2.resourcepool.BasicResourcePool@408d971b [managed: 1, unused: 0, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@64a7772e)
DEBUG [main] - JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@206a70ef] will not be managed by Spring
DEBUG [C3P0PooledConnectionPoolManager[identityToken->2tssb09z12u1kciekolc|481a15ff]-HelperThread-#1] - trace com.mchange.v2.resourcepool.BasicResourcePool@408d971b [managed: 2, unused: 1, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@64a7772e)
DEBUG [C3P0PooledConnectionPoolManager[identityToken->2tssb09z12u1kciekolc|481a15ff]-HelperThread-#1] - decremented pending_acquires: 1
DEBUG [C3P0PooledConnectionPoolManager[identityToken->2tssb09z12u1kciekolc|481a15ff]-HelperThread-#1] - Acquisition series terminated successfully. Decremented pending_acquires [1],  attempts_remaining: 30
DEBUG [C3P0PooledConnectionPoolManager[identityToken->2tssb09z12u1kciekolc|481a15ff]-HelperThread-#0] - trace com.mchange.v2.resourcepool.BasicResourcePool@408d971b [managed: 3, unused: 2, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@64a7772e)
DEBUG [C3P0PooledConnectionPoolManager[identityToken->2tssb09z12u1kciekolc|481a15ff]-HelperThread-#0] - decremented pending_acquires: 0
DEBUG [C3P0PooledConnectionPoolManager[identityToken->2tssb09z12u1kciekolc|481a15ff]-HelperThread-#0] - Acquisition series terminated successfully. Decremented pending_acquires [0],  attempts_remaining: 30
DEBUG [main] - ==>  Preparing: select * from user where id=? 
DEBUG [main] - ==> Parameters: 1(Integer)
DEBUG [main] - <==      Total: 1
DEBUG [main] - Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@5c33f1a9]
DEBUG [main] - Returning JDBC Connection to DataSource
DEBUG [main] - com.mchange.v2.async.ThreadPoolAsynchronousRunner@1d296da: Adding task to queue -- com.mchange.v2.resourcepool.BasicResourcePool$1RefurbishCheckinResourceTask@3bf7ca37
DEBUG [main] - trace com.mchange.v2.resourcepool.BasicResourcePool@408d971b [managed: 3, unused: 2, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@64a7772e)
User [id=1, username=steven, sex=1, birthday=1991-02-11, address=nanjing]

你可能感兴趣的:(Mybatis)