Spring Boot - Cannot determine embedded database driver class for database type NONE
If you are seeing the error "Cannot determine embedded database driver class for database type NONE" in a Spring Boot application, it means that the application is trying to auto-configure an embedded database, but it is unable to determine which database driver to use.
To fix this error, you will need to specify the database driver that you want to use in your application. You can do this by adding the appropriate dependency to your pom.xml
file (if you are using Maven) or your build.gradle
file (if you are using Gradle).
For example, if you want to use an embedded H2 database, you can add the following dependency to your pom.xml
file:
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
Or, if you want to use an embedded MySQL database, you can add the following dependency:
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
Once you have added the appropriate dependency, you will also need to configure your application to use the embedded database. You can do this by adding the appropriate configuration properties to your application.properties
file.
For example, to configure an H2 database, you can add the following properties:
spring.datasource.url=jdbc:h2:mem:testdb
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=password
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
Or, to configure a MySQL database, you can add the following properties:
spring.datasource.url=jdbc:mysql://localhost:3306/testdb
spring.datasource.driverClassName=com.mysql.jdbc.Driver
spring.datasource.username=root
spring.datasource.password=password