[Solved] Springboot project Create to start Error: APPLICATION FAILED TO START


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).
Process finished with exit code 1

Spring boot loads the org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration class by default, after introducing mybatis-spring-boot-starter in the pom. DataSourceAutoConfiguration class uses the @Configuration annotation to inject the dataSource bean into spring because there is no configuration information about the dataSource in the project, so when spring creates the dataSource bean due to the lack of relevant information it will report an error.

Add attribute @SpringBootApplication(exclude = DataSourceAutoConfiguration.class) to the Spring boot boot boot class to prevent Spring boot from automatically injecting the dataSource

Read More: