项目启动报错:
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate
[org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory'
threw exception; nested exception is
com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: Error: GlobalConfigUtils setMetaData Fail !
Cause:com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: Error: Get proxy
targetObject exception !
Cause:org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'scopedTarget.dataSource' defined in class path resource
[org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]:
Bean instantiation via factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to instantiate
[com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception;
nested exception is
org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreatio
nException: Failed to determine a suitable driver class
可能出现的问题:
1、mybatis-plus 和 spring boot 版本不对应
可参考如图:
2、数据源冲突,可以尝试排除该依赖
3、编译问题(我就是这个问题)
不要把mapper.xml文件编译,一定要注释掉
4、打包插件问题
父模块中声明了build配置,就不要在子模块声明了,因为这个配置会覆盖父模块的配置