zhouhao 8 gadi atpakaļ
vecāks
revīzija
61469a6ca0

+ 1 - 1
hsweb-web-dao/hsweb-web-dao-mybatis/pom.xml

@@ -58,7 +58,7 @@
         <dependency>
             <groupId>org.mybatis.spring.boot</groupId>
             <artifactId>mybatis-spring-boot-starter</artifactId>
-            <version>1.0.1</version>
+            <version>1.1.1</version>
         </dependency>
 
         <!--mybatis end-->

+ 3 - 11
hsweb-web-dao/hsweb-web-dao-mybatis/src/main/java/org/hsweb/web/mybatis/MyBatisAutoConfiguration.java

@@ -58,6 +58,7 @@ public class MyBatisAutoConfiguration {
     @Bean(name = "sqlSessionFactory")
     public SqlSessionFactory sqlSessionFactory(@Qualifier("dataSource") DataSource dataSource) throws Exception {
         SqlSessionFactoryBean factory = new SqlSessionFactoryBean();
+        factory.setVfs(SpringBootVFS.class);
         if (properties.isDynamicDatasource()) {
             factory.setSqlSessionFactoryBuilder(new DynamicDataSourceSqlSessionFactoryBuilder());
             factory.setTransactionFactory(new SpringManagedTransactionFactory() {
@@ -68,10 +69,9 @@ public class MyBatisAutoConfiguration {
             });
         }
         factory.setDataSource(dataSource);
-        factory.setVfs(SpringBootVFS.class);
-        if (StringUtils.hasText(this.properties.getConfig())) {
+        if (StringUtils.hasText(this.properties.getConfigLocation())) {
             factory.setConfigLocation(this.resourceLoader.getResource(this.properties
-                    .getConfig()));
+                    .getConfigLocation()));
         }
         if (this.interceptors != null && this.interceptors.length > 0) {
             factory.setPlugins(this.interceptors);
@@ -89,12 +89,4 @@ public class MyBatisAutoConfiguration {
         return factory.getObject();
     }
 
-//    @Bean(name = "sqlSessionTemplate")
-//    public SqlSessionTemplate sqlSessionTemplate(SqlSessionFactory sqlSessionFactory) {
-//        if (this.properties.isDynamicDatasource()) {
-//            return new DynamicSqlSessionTemplate(sqlSessionFactory);
-//        }
-//        return new SqlSessionTemplate(sqlSessionFactory);
-//    }
-
 }