1234567891011121314151617181920212223242526 |
- package com.qxgmat.data;
- import org.springframework.context.annotation.Configuration;
- import tk.mybatis.spring.annotation.MapperScan;
- import javax.sql.DataSource;
- @Configuration
- @MapperScan({"com.qxgmat.data.dao", "com.qxgmat.data.relation"})
- public class MybatisConfig {
- // /**
- // * 根据数据源创建SqlSessionFactory
- // */
- // @Bean(name = "customSqlSessionFactory")
- // public SqlSessionFactory sqlSessionFactory(DataSource dataSource,
- // @Value("${mybatis.type-aliases-package}") String typeAliasesPackage,
- // @Value("${mybatis.mapper-locations}") String mapperLocations) throws Exception{
- // SqlSessionFactoryBean bean = new SqlSessionFactoryBean();
- // bean.setDataSource(dataSource);
- // //下边两句仅仅用于*.xml文件,如果整个持久层操作不需要使用到xml文件的话(只用注解就可以搞定),则不加
- // bean.setTypeAliasesPackage(typeAliasesPackage);//指定基包
- // bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(mapperLocations));
- // return bean.getObject();
- // }
- }
|