错误:
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
原因:
在服务中引用的依赖包含了
<dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> <version>3.4.2</version> </dependency>
所以当没有连接数据库时就会报错。
解决方法:
1,排除不需要的依赖
2,在启动类加上exclude= {DataSourceAutoConfiguration.class}
@SpringBootApplication(exclude= {DataSourceAutoConfiguration.class})