1. 程式人生 > >Spring的DAO模組資料庫操作例項

Spring的DAO模組資料庫操作例項

Spring的DAO模組提供了對了JDBC、Hibernate、JDO等DAO層支援。DAO模組依賴於
這裡寫圖片描述,MyEclipse自帶的Spring DAO類庫沒有這兩個類庫,需要自己新增。
下面以儲存實體Person為例作介紹:
傳統的JDBC程式設計,總免不了與Connection、Statement、PreparedStatement、ResultSet、SQLException等打交道,還要注意開啟連線後要釋放連線等瑣碎的問題。
Spring框架對JDBC進行了封裝,完全拋棄了JDBC API。資料庫連線、事務等也交給了Spring打點,開發者只需要使用封裝好的JdbcTemplate執行SQL語句,然後得到需要的結果。

實體類Person:

本類的POJO實體類為Person類。本例將使用Spring提供的JdbcTemplate將Person持久化到資料庫中,或者將Person從資料庫中讀取出來。Person類的程式碼如下:
這裡寫圖片描述
Person.java

package com.helloweenvsfei.spring.dao;

import java.util.Date;

public class Person {
    private Integer id;
    private String name;
    private String sex;
    private int
age; private Date birthday; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getSex
() { return sex; } public void setSex(String sex) { this.sex = sex; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } public Date getBirthday() { return birthday; } public void setBirthday(Date birthday) { this.birthday = birthday; } }

DAO層介面

DAO層介面定義了操作Person實體類的方法。IPerson介面定義了4個方法:
這裡寫圖片描述
分別查詢某人員姓名、新增某人員資訊、查詢記錄數、獲取所有人員資訊等。
IPersonDao介面程式碼沒有與Spring的DAO模組耦合。程式碼如下:
IPersonDao.java

package com.helloweenvsfei.spring.dao;

import java.util.List;

public interface IPersonDao {
    public String getPersonName(Integer id);
    public void addPerson(Person person);
    public int getPersonCount();
    public List<Person> listPersons();
}

繼承JdbcDaoSupport
JdbcDaoSupport類來自於這裡寫圖片描述。PersonDaoImpl實現了介面IPersonDao介面,並繼承Spring的DAO模組中的JdbcDaoSupport類。JdbcDaoSupport提供JdbcTemplate物件,封裝了常用的JDBC操作。PersonDaoImpl中還定義了一個初始化方法,用於初始化表結構(如果不存在則建立)。
由於程式碼直接繼承了Spring提供的JdbcDaoSupport,因此沒有使用Connection、Statement等JDBC API,也不用關閉這些資源。JdbcDaoSupport會自動維護這些資源。程式碼中用Spring封裝好的JdbcTemplate來執行SQL、查詢Person列表、查詢單個Person屬性值、查詢Person的總數。查詢Person列表時返回的是一個List

package com.helloweenvsfei.spring.dao;

import java.sql.Date;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.springframework.jdbc.core.support.JdbcDaoSupport;
public class PersonDaoImpl extends JdbcDaoSupport implements IPersonDao {

    public void initDatabase()
    {
        String sql="create table if not exists tb_person "
                +"(id int auto_increment, "+"name varchar(255), "+"sex varchar(10) , age int ,birthday timestamp, primary key(id))";
        this.getJdbcTemplate().execute(sql);
    }
    @Override
    public String getPersonName(Integer id) {
        String sql="select name from tb_person where id="+id;
        return (String)this.getJdbcTemplate().queryForObject(sql, String.class);
    }

    @Override
    public void addPerson(Person person) {
        String sql="insert into tb_person(name,sex,age,birthday) values(?,?,?,?)";
        this.getJdbcTemplate().update(sql, new Object[]{
                person.getName(),person.getSex(),person.getAge(),person.getBirthday(),
        });
    }

    @Override
    public int getPersonCount() {
        String sql="select count(*) from tb_person";
        return this.getJdbcTemplate().queryForInt(sql);
    }

    @Override
    public List<Person> listPersons() {
        String sql="select id,name,sex,age,birthday for tb_person";
        @SuppressWarnings("unchecked")
        List<Map<String,Object>> list=this.getJdbcTemplate().queryForList(sql);
        List<Person> personList=new ArrayList<Person>();
        for(Map<String,Object> row:list)
        {
            Person person=new Person();
            person.setId((Integer)row.get("id"));
            person.setName(row.get("name").toString());
            person.setSex(row.get("sex").toString());
            person.setAge((Integer)row.get("age"));
            person.setBirthday((Date)row.get("birthday"));

            personList.add(person);
        }
        return personList;
    }

}

Spring配置

applicationContext.xml中需要配置一個數據源,並將該資料來源設定到personDao中。配置程式碼如下:
注意使用com.mysql.jdbc.Driver驅動需要新增下面的庫:
這裡寫圖片描述
ApplicationContext.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:p="http://www.springframework.org/schema/p"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd">
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
    <property name="driverClassName" value="com.mysql.jdbc.Driver"></property>
    <property name="url" value="jdbc:mysql://localhost:3306/spring?characterEncoding=UTF-8">
    </property>
    <property name="username" value="root"></property>
    <property name="password" value="123"></property>
</bean>
<bean id="personDao" class="com.helloweenvsfei.spring.dao.PersonDaoImpl" depends-on="dataSource" init-method="initDatabase">
    <property name="dataSource" ref="dataSource"></property>
</bean>
</beans>

執行程式碼

執行程式前不需要建立表,PersonDaoImpl的initDatabase()會自動建立表結構。但是需要建立資料庫spring,因此initDatabase()無法建立資料庫。建立資料庫的DDL語句:

create database spring character set utf8;

下面的程式碼中先載入applicationContext.xml、建立BeanFactory並從中獲取DAO物件,然後例項化一個Person物件,並用DAO儲存進資料,最後輸出記錄總數、所有的Person物件。執行程式碼如下:
DaoRun.java

package com.helloweenvsfei.spring.dao;


import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;

public class DaoRun {

    public static void main(String[] args) {
        XmlBeanFactory factory=new XmlBeanFactory(new ClassPathResource("applicationContext.xml"));
        IPersonDao personDao=(IPersonDao)factory.getBean("personDao");

        Person person=new Person();
        person.setName("Helloween");
        person.setAge(30);
        person.setSex("男");
        person.setBirthday(new Date());

        personDao.addPerson(person);
        System.out.println("Count:"+personDao.getPersonCount());

        System.out.println(personDao.getPersonName(1));
        List<Person> personList=new ArrayList<Person>();
        for(Person p:personList)
        {
            System.out.println("Name:"+p.getName());
        }
    }

}

執行效果如下:

2017-01-04 02:50:26,635 [org.springframework.core.env.MutablePropertySources]-[DEBUG] Adding [systemProperties] PropertySource with lowest search precedence
2017-01-04 02:50:26,647 [org.springframework.core.env.MutablePropertySources]-[DEBUG] Adding [systemEnvironment] PropertySource with lowest search precedence
2017-01-04 02:50:26,648 [org.springframework.core.env.AbstractEnvironment]-[DEBUG] Initialized StandardEnvironment with PropertySources [systemProperties,systemEnvironment]
2017-01-04 02:50:26,658 [org.springframework.beans.factory.xml.XmlBeanDefinitionReader]-[INFO] Loading XML bean definitions from class path resource [applicationContext.xml]
2017-01-04 02:50:26,698 [org.springframework.beans.factory.xml.DefaultDocumentLoader]-[DEBUG] Using JAXP provider [com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl]
2017-01-04 02:50:26,771 [org.springframework.beans.factory.xml.PluggableSchemaResolver]-[DEBUG] Trying to resolve XML entity with public id [null] and system id [http://www.springframework.org/schema/beans/spring-beans-4.1.xsd]
2017-01-04 02:50:26,773 [org.springframework.beans.factory.xml.PluggableSchemaResolver]-[DEBUG] Loading schema mappings from [META-INF/spring.schemas]
2017-01-04 02:50:26,791 [org.springframework.beans.factory.xml.PluggableSchemaResolver]-[DEBUG] Loaded schema mappings: {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/jms/spring-jms-2.5.xsd=org/springframework/jms/config/spring-jms-2.5.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://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/oxm/spring-oxm-3.0.xsd=org/springframework/oxm/config/spring-oxm-3.0.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/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/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/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/task/spring-task-4.1.xsd=org/springframework/scheduling/config/spring-task-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/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/jms/spring-jms-3.2.xsd=org/springframework/jms/config/spring-jms-3.2.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://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/jms/spring-jms-4.1.xsd=org/springframework/jms/config/spring-jms-4.1.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/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/task/spring-task-3.1.xsd=org/springframework/scheduling/config/spring-task-3.1.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/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/jms/spring-jms.xsd=org/springframework/jms/config/spring-jms-4.1.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/jms/spring-jms-3.1.xsd=org/springframework/jms/config/spring-jms-3.1.xsd, http://www.springframework.org/schema/oxm/spring-oxm.xsd=org/springframework/oxm/config/spring-oxm-4.1.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/oxm/spring-oxm-4.1.xsd=org/springframework/oxm/config/spring-oxm-4.1.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/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/jms/spring-jms-4.0.xsd=org/springframework/jms/config/spring-jms-4.0.xsd, http://www.springframework.org/schema/oxm/spring-oxm-3.2.xsd=org/springframework/oxm/config/spring-oxm-3.2.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/task/spring-task-3.0.xsd=org/springframework/scheduling/config/spring-task-3.0.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/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/jms/spring-jms-3.0.xsd=org/springframework/jms/config/spring-jms-3.0.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/oxm/spring-oxm-4.0.xsd=org/springframework/oxm/config/spring-oxm-4.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/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/oxm/spring-oxm-3.1.xsd=org/springframework/oxm/config/spring-oxm-3.1.xsd, http://www.springframework.org/schema/aop/spring-aop.xsd=org/springframework/aop/config/spring-aop-4.1.xsd}
2017-01-04 02:50:26,798 [org.springframework.beans.factory.xml.PluggableSchemaResolver]-[DEBUG] Found XML schema [http://www.springframework.org/schema/beans/spring-beans-4.1.xsd] in classpath: org/springframework/beans/factory/xml/spring-beans-4.1.xsd
2017-01-04 02:50:26,954 [org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader]-[DEBUG] Loading bean definitions
2017-01-04 02:50:27,005 [org.springframework.beans.factory.xml.BeanDefinitionParserDelegate]-[DEBUG] Neither XML 'id' nor 'name' specified - using generated bean name [com.helloweenvsfei.spring.aop.MethodBeforeInterceptor#4715c34e]
2017-01-04 02:50:27,009 [org.springframework.beans.factory.xml.BeanDefinitionParserDelegate]-[DEBUG] Neither XML 'id' nor 'name' specified - using generated bean name [com.helloweenvsfei.spring.aop.MethodAfterInterceptor#64a39f6]
2017-01-04 02:50:27,012 [org.springframework.beans.factory.xml.BeanDefinitionParserDelegate]-[DEBUG] Neither XML 'id' nor 'name' specified - using generated bean name [com.helloweenvsfei.spring.aop.ThrowsInterceptor#117a1ad3]
2017-01-04 02:50:27,016 [org.springframework.beans.factory.xml.BeanDefinitionParserDelegate]-[DEBUG] Neither XML 'id' nor 'name' specified - using generated bean name [com.helloweenvsfei.spring.aop.AopServiceImpl#591c486a]
2017-01-04 02:50:27,027 [org.springframework.beans.factory.support.DefaultSingletonBeanRegistry]-[DEBUG] Creating shared instance of singleton bean 'dataSource'
2017-01-04 02:50:27,028 [org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory]-[DEBUG] Creating instance of bean 'dataSource'
2017-01-04 02:50:27,072 [org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory]-[DEBUG] Eagerly caching bean 'dataSource' to allow for resolving potential circular references
2017-01-04 02:50:27,096 [org.springframework.core.io.support.SpringFactoriesLoader]-[DEBUG] Loaded [org.springframework.beans.BeanInfoFactory] names: [org.springframework.beans.ExtendedBeanInfoFactory]
2017-01-04 02:50:27,105 [org.springframework.beans.CachedIntrospectionResults]-[DEBUG] Getting BeanInfo for class [org.apache.commons.dbcp.BasicDataSource]
2017-01-04 02:50:27,122 [org.springframework.beans.CachedIntrospectionResults]-[DEBUG] Caching PropertyDescriptors for class [org.apache.commons.dbcp.BasicDataSource]
2017-01-04 02:50:27,123 [org.springframework.beans.CachedIntrospectionResults]-[DEBUG] Found bean property 'accessToUnderlyingConnectionAllowed' of type [boolean]
2017-01-04 02:50:27,132 [org.springframework.beans.CachedIntrospectionResults]-[DEBUG] Found bean property 'class' of type [java.lang.Class]
2017-01-04 02:50:27,136 [org.springframework.beans.CachedIntrospectionResults]-[DEBUG] Found bean property 'connection' of type [java.sql.Connection]
2017-01-04 02:50:27,137 [org.springframework.beans.CachedIntrospectionResults]-[DEBUG] Found bean property 'defaultAutoCommit' of type [boolean]
2017-01-04 02:50:27,138 [org.springframework.beans.CachedIntrospectionResults]-[DEBUG] Found bean property 'defaultCatalog' of type [java.lang.String]
2017-01-04 02:50:27,139 [org.springframework.beans.CachedIntrospectionResults]-[DEBUG] Found bean property 'defaultReadOnly' of type [boolean]
2017-01-04 02:50:27,140 [org.springframework.beans.CachedIntrospectionResults]-[DEBUG] Found bean property 'defaultTransactionIsolation' of type [int]
2017-01-04 02:50:27,141 [org.springframework.beans.CachedIntrospectionResults]-[DEBUG] Found bean property 'driverClassName' of type [java.lang.String]
2017-01-04 02:50:27,143 [org.springframework.beans.CachedIntrospectionResults]-[DEBUG] Found bean property 'initialSize' of type [int]
2017-01-04 02:50:27,147 [org.springframework.beans.CachedIntrospectionResults]-[DEBUG] Found bean property 'logAbandoned' of type [boolean]
2017-01-04 02:50:27,148 [org.springframework.beans.CachedIntrospectionResults]-[DEBUG] Found bean property 'logWriter' of type [java.io.PrintWriter]
2017-01-04 02:50:27,149 [org.springframework.beans.CachedIntrospectionResults]-[DEBUG] Found bean property 'loginTimeout' of type [int]
2017-01-04 02:50:27,150 [org.springframework.beans.CachedIntrospectionResults]-[DEBUG] Found bean property 'maxActive' of type [int]
2017-01-04 02:50:27,151 [org.springframework.beans.CachedIntrospectionResults]-[DEBUG] Found bean property 'maxIdle' of type [int]
2017-01-04 02:50