[JAVA] [Spring Boot] DataSourceProperties $ DataSourceBeanCreationException

Occurrence event

When I tried to make a web application using SpringBoot for easy operation verification, it failed at build time. I got the following error.


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

Reason: Failed to determine a suitable driver class

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).

It seems that the data source setting has failed?

How to respond

Apparently, it was because I mentioned MyBatis, which I thought I would use later. After deleting the definition of MyBatis from pom.xml, it started normally, but there seems to be other solutions as below.

1. Add the EnableAutoConfiguration annotation.

Add annotations to the [project name Application.java] file.


public class MyAppSampleAppApplication {

	public static void main(String[] args) {
		SpringApplication.run(MyAppSampleApplication.class, args);

2. Set the data source obediently



Note: How to set up multiple data sources

While researching, I found a description when I want to use multiple databases, so make a note. [How to specify two data sources](https://www.it-swarm.dev/ja/java/spring-boot%E3%81%AF2%E3%81%A4%E3%81%AE%E3 % 83% 87% E3% 83% BC% E3% 82% BF% E3% 82% BD% E3% 83% BC% E3% 82% B9% E3% 82% 92% E8% A8% AD% E5% AE % 9A% E3% 81% 97% E3% 81% A6% E4% BD% BF% E7% 94% A8% E3% 81% 99% E3% 82% 8B / 1053464638 /)

Recommended Posts

[Spring Boot] DataSourceProperties $ DataSourceBeanCreationException
Spring Boot Form
Spring Boot Memorandum
gae + spring boot
SPRING BOOT learning record 01
Spring Boot + Heroku Postgres
Spring boot memo writing (1)
First Spring Boot (DI)
SPRING BOOT learning record 02
Spring Boot exception handling
Spring Boot Servlet mapping
Spring boot development-development environment-
Spring Boot learning procedure
Learning Spring Boot [Beginning]
Spring boot memo writing (2)
Spring Boot 2.2 Document Summary
Spring Boot 2.3 Application Availability
Spring boot tutorials Topics
Download with Spring Boot
[Spring Boot] Environment construction (macOS)
Try Spring Boot from 0 to 100.
Generate barcode with Spring Boot
Hello World with Spring Boot
Spring Boot on Microsoft Azure
Implement GraphQL with Spring Boot
Spring Boot tutorial task schedule
Spring 5 & Spring Boot 2 Hands-on preparation procedure
Get started with Spring boot
Spring Boot 2 multi-project in Gradle
[Spring Boot] Web application creation
spring boot port duplication problem
Run LIFF with Spring Boot
SNS login with Spring Boot
Spring Boot Hot Swapping settings
Introduction to Spring Boot ① ~ DI ~
File upload with Spring Boot
Spring Boot starting with copy
Introduction to Spring Boot ② ~ AOP ~
CICS-Run Java application-(4) Spring Boot application
Spring Boot + Springfox springfox-boot-starter 3.0.0 Use
Spring Boot DB related tips
Hello World with Spring Boot
Set cookies with Spring Boot
[Spring Boot] Easy paging recipe
Use Spring JDBC with Spring Boot
Docker × Spring Boot environment construction
Major changes in Spring Boot 1.5
Add module with Spring Boot
Getting Started with Spring Boot
NoHttpResponseException in Spring Boot + WireMock
[Spring Boot] Send an email
Spring Boot performance related settings
Introduction to Spring Boot Part 1
Spring Boot External setting priority
Try using Spring Boot Security
[Java] [Spring] Spring Boot 1.4-> 1.2 Downgrade Note
Try Spring Boot on Mac
Create microservices with Spring Boot
Spring Boot DB connection pool
Send email with spring boot
Spring Boot for annotation learning