package com.zf.config;

import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;


import org.apache.ibatis.datasource.DataSourceFactory;
import org.apache.ibatis.datasource.jndi.JndiDataSourceFactory;
import org.apache.ibatis.mapping.Environment;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.apache.ibatis.transaction.TransactionFactory;
import org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;


/**
 * MyBatisConfig
 *
 * @author zf
 * @date 16/6/12
 */
@Configuration
public class MyBatisConfig {
    private static final Logger logger = LoggerFactory.getLogger(MyBatisConfig.class);
    @Bean
    public DataSource createDataSource() throws SQLException {
        return DataSourceBuilder.create(Thread.currentThread().getContextClassLoader())
                .driverClassName("com.mysql.jdbc.Driver")
                .url("jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8&connectTimeout=60000&socketTimeout=60000&autoReconnect=true&autoReconnectForPools=true&failOverReadOnly=false&useSSL=false")
                .username("root")
                .password("root").build();
    }
}

@@ -17,16 +17,185 @@
 onfig;%0A%0A
+import org.mybatis.spring.SqlSessionFactoryBean;%0Aimport org.mybatis.spring.annotation.MapperScan;%0Aimport org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration;%0A
 import o
@@ -959,16 +959,70 @@
 uration;
+%0Aimport org.springframework.core.io.ClassPathResource;
 %0A%0Aimport
@@ -1178,16 +1178,42 @@
 uration%0A
+@MapperScan(%22com.zf.dao%22)%0A
 public c

add MapperScan