报错:Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

报错原因:无法配置DataSource:未指定'url'属性,也无法配置嵌入数据源。

解决方法:

在应用中没有配置datasource的一些相关属性,例如:地址值啊,数据库驱动啊,用户名啊,密码啊

在application.properties 中添加相关属性

spring:
  datasource:
    password: root
    username: root
    url: jdbc:mysql://localhost:3306/vip?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
    driver-class-name: com.mysql.jdbc.Driver
mybatis-plus:
mapper-locations: classpath*:/mapper/**/*.xml
global-config:
db-config:
id-type: auto

 

 

@EnableDiscoveryClient
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)    //添加该注解
public class VipstoreGatewayApplication {

 

posted @ 2020-12-23 20:27  事有回响  阅读(1017)  评论(0编辑  收藏  举报