[英]Using two datasources with Spring Boot
I followed the docs at https://docs.spring.io/spring-boot/docs/current/reference/html/howto.html#howto-two-datasources and created my source code accordingly.我按照https://docs.spring.io/spring-boot/docs/current/reference/html/howto.html#howto-two-datasources的文档并相应地创建了我的源代码。 When I start up the application I receive this error message:
当我启动应用程序时,我收到此错误消息:
APPLICATION FAILED TO START
应用程序无法启动
Description:
描述:
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
无法配置数据源:未指定“url”属性,并且无法配置嵌入式数据源。
Reason: Failed to determine suitable jdbc url
原因:无法确定合适的 jdbc url
Action: Consider the following: If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
行动:考虑以下几点:如果您想要一个嵌入式数据库(H2、HSQL 或 Derby),请将其放在类路径中。 If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).
如果您有要从特定配置文件加载的数据库设置,您可能需要激活它(当前没有配置文件处于活动状态)。
I searched for similar issues and only found that one: Error access two datasource with Spring Boot我搜索了类似的问题,只发现一个: Error access two datasource with Spring Boot
The solution for this was contained in the error message but (at least for me) a little bit too hidden.解决方案包含在错误消息中,但(至少对我而言)有点太隐藏了。
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. 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.