MybatisAutoConfiguration未创建dataSource bean

时间:2018-10-19 12:33:14

标签: spring-boot mybatis

我有一个使用mybatis-spring-boot-autoconfigure-1.3.2.jar的SpringBoot 2.0.4.RELEASE项目,并且工作正常。

mybatis-spring-boot-autoconfigure-1.3.2.jar将创建类型[com.zaxxer.hikari.HikariDataSource]的bean datasource

但是当我使用jar xvf提取jar文件时,然后我使用jar cvmf0 /META-INF/MANIFEST.MF来恢复jar。尽管jar是相同的,但是无法创建{ {1}} bean。
  我使用datasource运行我的项目,发现java -Ddebug -jar不在类路径的顶部。
  这是一些错误日志:

spring-boot-2.0.4.RELEASE.jar

application.yml是:

MybatisAutoConfiguration:
   Did not match:
      - @ConditionalOnBean (types: javax.sql.DataSource; SearchStrategy: all) **did not find any beans of typejavax.sql.DataSource** (OnBeanCondition)
   Matched:
      - @ConditionalOnClass found required classes 'org.apache.ibatis.session.SqlSessionFactory','org.mybatis.spring.SqlSessionFactoryBean'; @ConditionalOnMissingClass did not find unwanted class (OnClassCondition)


 Caused by: java.lang.IllegalArgumentException: Property'sqlSessionFactory' or 'sqlSessionTemplate' are required
     at org.springframework.util.Assert.notNull(Assert.java:193) ~[spring-core-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
     at org.mybatis.spring.support.SqlSessionDaoSupport.checkDaoConfig(SqlSessionDaoSupport.java:74)~[mybatis-spring-1.3.2.jar!/:1.3.2]
     at org.mybatis.spring.mapper.MapperFactoryBean.checkDaoConfig(MapperFactoryBean.java:73) ~[mybatis-spring-1.3.2.jar!/:1.3.2]
     at org.springframework.dao.support.DaoSupport.afterPropertiesSet(DaoSupport.java:44~[spring-tx-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1758)~[spring-beans-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1695)~[spring-beans-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
     ... 108 common frames omitted

0 个答案:

没有答案