Unable to create XADataSource instance from 'com.mysql.cj.jdbc.MysqlXADataSource'

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path 

resource [org/springframework/boot/autoconfigure/jdbc/XADataSourceAutoConfiguration.class]: Bean instantiation via factory
 
method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate 

[javax.sql.DataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException: 

Unable to create XADataSource instance from'com.mysql.cj.jdbc.MysqlXADataSource'

atorg.springframework.beans.factory.support.ConstructorResolver.instantiate,

Unable to create XADataSource instance from 'com.mysql.cj.jdbc.MysqlXADataSource'

今早打开IDEA启动项目,发现报了这个错误,这个是提示说,数据库需要换成6.0以上,那么就在pom.xml,文件里面把mysql改成6.0以上版本,如下:

<dependency>
			<groupId>mysql</groupId>
			<artifactId>mysql-connector-java</artifactId>
			<version>8.0.16</version>
		</dependency>

接着改了yml配置,把以前5.0的配置改成6.0以后的,如下:

5.0前版本的是:

driverClassName: com.mysql.jdbc.Driver

6.0后版本是:

 driverClassName: com.mysql.cj.jdbc.Driver
发布了72 篇原创文章 · 获赞 16 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/qq_40206199/article/details/103256158