Unsatisfied dependency expressed through bean property ‘sqlSessionFactory‘ 终于解决了
参考地址Exception encountered during context initialization - cancelling refresh attempt:org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'pmsBrandMapper'def
·
参考地址
Exception encountered during context initialization - cancelling refresh attempt:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'pmsBrandMapper'
defined in file [G:\sq\mall\target\classes\com\macro\mall\tiny\mbg\mapper\PmsBrandMapper.class]: Unsatisfied
dependency expressed through bean property 'sqlSessionFactory'; nested exception is
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name
'sqlSessionFactory' defined in class path resource
[org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Unsatisfied dependency expressed
through method 'sqlSessionFactory' parameter 0; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in
class path resource [com/alibaba/druid/spring/boot/autoconfigure/DruidDataSourceAutoConfigure.class]:
Invocation of init method failed; nested exception is
org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to
determine a suitable driver class
就是这个问题困扰了我很久,一直都是没法实例化:之前查了很多资料,也不感觉有哪里错了,数据库也能连上,pom文件也设置了
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
<include>**/*.properties</include>
</includes>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.xml</include>
<include>**/*.properties</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</build>
但是怎么滴就是一直不可以正常启动,有时候也会可以启动(特别莫名其妙)
直到今天又来查资料了
看了下我这resources目录下有三个文件
我在pom里面只写了两个
还差一个yml文件
于是就
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
<include>**/*.properties</include>
<include>**/*.yml</include>
</includes>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.xml</include>
<include>**/*.properties</include>
<include>**/*.yml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</build>
就好了具体为什么移步头部链接吧,解释的可以。
更多推荐
已为社区贡献2条内容
所有评论(0)