springCloud报错:Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedded dat
springCloud项目启动报如下错误:由于项目中引用了mybatis项目的数据配置,会去加载数据库信息,也可能是依赖项目中有关于mybaits相关的配置***************************APPLICATION FAILED TO START***************************Description:Failed to configure a DataSou
·
springCloud项目启动报如下错误 :
由于项目中引用了mybatis项目的数据配置,会去加载数据库信息,也可能是依赖项目中有关于mybaits相关的配置
***************************
APPLICATION FAILED TO START
***************************
Description:
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
Action:
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).
解决方式:
若此项目不需要加载数据库配置
1.可以在pom.xml中使用 <exclusions> 排除依赖
<dependency>
<groupId>com.atguigu.gulimall</groupId>
<artifactId>gulimall-common</artifactId>
<version>0.0.1-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>mybatis</artifactId>
<groupId>org.mybatis</groupId>
</exclusion>
</exclusions>
</dependency>
2. 也可以使用注解
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
@EnableDiscoveryClient
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
public class GulimallGatewayApplication {
public static void main(String[] args) {
SpringApplication.run(GulimallGatewayApplication.class, args);
}
}
更多推荐




所有评论(0)