xufenglei
2017-12-07 dba72443e05e7b0a52ee85bfd9f4641aebc42c60
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package com.moral.config;
 
import java.util.Properties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
 
import com.moral.common.mapper.BaseMapper;
 
import tk.mybatis.spring.mapper.MapperScannerConfigurer;
 
@Configuration
public class MapperScannerConfig {
    @Bean
    public MapperScannerConfigurer mapperScannerConfigurer() {
        MapperScannerConfigurer mapperScannerConfigurer = new MapperScannerConfigurer();
        mapperScannerConfigurer.setSqlSessionFactoryBeanName("sqlSessionFactory");
        mapperScannerConfigurer.setBasePackage("com.moral.mapper");//扫描该路径下的dao
        Properties properties = new Properties();
        properties.setProperty("mappers", BaseMapper.class.getName());//通用dao
        properties.setProperty("notEmpty", "false");
        properties.setProperty("IDENTITY", "MYSQL");
        mapperScannerConfigurer.setProperties(properties);
        return mapperScannerConfigurer;
    }
 
}