How to fix 'Cannot determine embedded database driver class for database type NONE' in springboot?


If you do not deal with datasource in your sprintboot application, then the following exception will frustrate you.

o.s.b.d.LoggingFailureAnalysisReporter - 

***************************
APPLICATION FAILED TO START
***************************

Description:

Cannot determine embedded database driver class for database type NONE

Action:

If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).
 - [report:42] - [] - [] 

You can fix this problem in two ways

Method-1: Fixing with application.properties file

you can add the fallowing line in application.properties file

spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration

Method-2: Fixing with Code

You can add EnableAutoConfiguration annotation with DataSourceAutoConfiguration exclude like below

@SpringBootApplication
@EnableAutoConfiguration (exclude = { DataSourceAutoConfiguration.class })
public class SpringbootApplication {
	SpringApplication.run(SpringbootApplication.class, args);
}

or you can also add excludes to the SpringBootApplication annotation itself

@SpringBootApplication (exclude = { DataSourceAutoConfiguration.class })
public class SpringbootApplication {
	SpringApplication.run(SpringbootApplication.class, args);
}