簡體   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