@@ -0,0 +1,1803 @@
+package com.zf.config;%0A%0Aimport org.mybatis.spring.SqlSessionFactoryBean;%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.context.annotation.Bean;%0Aimport org.springframework.context.annotation.Configuration;%0Aimport org.springframework.context.support.ClassPathXmlApplicationContext;%0Aimport org.springframework.core.io.ClassPathResource;%0Aimport org.springframework.core.io.Resource;%0Aimport org.thymeleaf.expression.Lists;%0A%0Aimport javax.sql.DataSource;%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0A/**%0A * SessionFactory%0A *%0A * @author zf%0A * @date 16/6/14%0A */%0A@Configuration%0Apublic class SessionFactoryConfig %7B%0A%0A    /**%0A     * mybatis %E9%85%8D%E7%BD%AE%E8%B7%AF%E5%BE%84%0A     */%0A    private static String MYBATIS_CONFIG = %22mybatis-config.xml%22;%0A%0A    /**%0A     * mybatis mapper resource %E8%B7%AF%E5%BE%84%0A     */%0A    private static String MAPPER_PATH = %22classpath*:mapper/*.xml%22;%0A%0A    @Autowired%0A    private DataSource dataSource;%0A%0A%0A    /**%0A     * %E5%88%9B%E5%BB%BAsqlSessionFactoryBean %E5%AE%9E%E4%BE%8B%0A     * %E5%B9%B6%E4%B8%94%E8%AE%BE%E7%BD%AEconfigtion %E5%A6%82%E9%A9%BC%E5%B3%B0%E5%91%BD%E5%90%8D.%E7%AD%89%E7%AD%89%0A     * %E8%AE%BE%E7%BD%AEmapper %E6%98%A0%E5%B0%84%E8%B7%AF%E5%BE%84%0A     * %E8%AE%BE%E7%BD%AEdatasource%E6%95%B0%E6%8D%AE%E6%BA%90%0A     * @return%0A     */%0A    @Bean%0A    public SqlSessionFactoryBean createSqlSessionFactoryBean() %7B%0A        SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();%0A        sqlSessionFactoryBean.setConfigLocation(new ClassPathResource(MYBATIS_CONFIG));%0A        createResourceArray();%0A        sqlSessionFactoryBean.setMapperLocations(createResourceArray());%0A        sqlSessionFactoryBean.setDataSource(dataSource);%0A        return sqlSessionFactoryBean;%0A    %7D%0A%0A    /**%0A     * %E5%88%9B%E5%BB%BAmapper%E8%B5%84%E6%BA%90%E8%B7%AF%E5%BE%84%0A     * @return%0A     */%0A    private Resource%5B%5D createResourceArray() %7B%0A        List%3CResource%3E resources = new ArrayList%3C%3E();%0A        resources.add(new ClassPathXmlApplicationContext(MAPPER_PATH));%0A        return resources.toArray(new Resource%5B1%5D);%0A    %7D%0A%7D%0A

add SessionFactoryConfig