繁体   English   中英

使用 Spring 引导的两个数据源

[英]Using two datasources with Spring Boot

我按照https://docs.spring.io/spring-boot/docs/current/reference/html/howto.html#howto-two-datasources的文档并相应地创建了我的源代码。 当我启动应用程序时,我收到此错误消息:


应用程序无法启动


描述:

无法配置数据源:未指定“url”属性,并且无法配置嵌入式数据源。

原因:无法确定合适的 jdbc url

行动:考虑以下几点:如果您想要一个嵌入式数据库(H2、HSQL 或 Derby),请将其放在类路径中。 如果您有要从特定配置文件加载的数据库设置,您可能需要激活它(当前没有配置文件处于活动状态)。

我搜索了类似的问题,只发现一个: Error access two datasource with Spring Boot

解决方案包含在错误消息中,但(至少对我而言)有点太隐藏了。

I forgot to add the h2 jar so the real reason wasn't that Spring Boot couldn't determine suitable jdbc url but more the missing driver.

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM