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
- How to Solve Application failed to start error
- SpringBoot startup error Failed to determine a suitable driver class
- Error starting ApplicationContext. To display the auto-configuration report re-run your application
- [Solved] Springboot Error creating bean with name ‘dataSource’ defined in class path resource
- Springboot connects to the database error: testWhileIdle is true, validationQuery not set
- Two implementation methods of spring boot scan mapper interface class
- Mybatis-plus calls its own method error: Invalid bound statement
- SpringCloud: gateway module startup error [How to Solve]
- New Spring boot startup error Failed to auto-configure a DataSource
- [How to Fix] Spring boot startup error: could not resolve placeholder
- org.springframework.core.NestedIOException: Failed to parse mapping resource: ‘file [XXX.xml]‘;
- Gateway Error: Cannot resolve org.springframework.cloud:spring-cloud-starter-gateway:unknown
- Error creating bean with name ‘redistemplate’ defined in class path resource
- [Solved] Redis Error: Error creating bean with name stringRedisTemplate defined in class path resource
- [Solved] SpringBoot Project Start Error: No bean named ‘org.springframework.context.xxxxx.importRegistry‘ available
- [Solved] Error creating bean with name ‘braveHttpServerHandler‘ defined in class path
- [Solved] Spring cloud introduces zuul dependency error
- [Solved] “Field pet in XXX.HelloController required a bean of type ‘XXX.Pet‘ that could not be found.“
- Springboot running shows application run failed [How to Solve]
- [Solved] The version of springcloud must support the current version of springboot, otherwise the startup project will report an error: error starting ApplicationContext