org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘externalDump

  在学习SpringCloud Alibaba Nacos时,出现了上述异常,因为我的数据库是8.0+版本,所以得在nacos的application.properties文件中db.url.0那一行加上参数useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC,这样就不会报上述错误了。

  配置如下:

nacos.istio.mcp.server.enabled=false

spring.datasource.platform=mysql
#jdbc.DriverClassName=com.mysql.cj.jdbc.Driver   这行可加可不加
db.num=1
db.url.0=jdbc:mysql://localhost:3306/你创建的数据库名称?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
db.user=root
db.password=你的数据库密码

  如果报org.springframework.jdbc.CannotGetJdbcConnectionException: PreparedStatementCallback; Could not retrieve transation read-only status server; nested exception is java.sql.SQLException: Could not retrieve transation read-only status server异常的, 请看我的这篇博客https://blog.csdn.net/ls_wifi/article/details/107922284

 

posted @ 2020-08-10 21:34  小帅学java  阅读(59)  评论(0)    收藏  举报