配置多数据源 dynamic-datasource-spring-boot-starter 踩到的坑 (不断更新中)

x33g5p2x  于2021-09-18 转载在 Spring  
字(0.5k)|赞(0)|评价(0)|浏览(1794)

环境

java version: 1.8

spring boot version:2.1.14.RELEASE

dynamic-datasource-spring-boot-starter version:3.2.0

程序包 com. baomidou dynamic datasource annotation不存在Error:(19,2)java:找不到符号符号类DS

代码没有红线提示,点击也能跳转,就是编译不过。

试过了网上的所有办法,包括

在这里插入图片描述

最终解决办法,更换 idea 版本

博主之前版本是 2020.1

更换成 2020.2 问题解决

Failed to configure a DataSource: ‘url’ attribute is not specified and no embedded datasource could be configured.

完整信息如下:

在这里插入图片描述

解决办法,在启动类上加上如下配置,使得项目启动不会默认加载数据源,使用时才加载。

@SpringBootApplication(exclude = DruidDataSourceAutoConfigure.class)

相关文章