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. 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.
Reason: Failed to determine suitable jdbc url
Action: Consider the following: If you want an embedded database (H2, HSQL or Derby), please put it on the classpath. 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
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.