SpringBoot 启动抛异常Failed to configure a DataSource

很明显,Failed to configure a DataSource: ‘url’ attribute is not specified and no embedded datasource could be configured.这里是没找到URL,说明根本没配置相关的属性

解决:在Application.yml配置文件中添加对应的即可

spring:
  datasource:
    # 当前数据源操作类型
    type: com.alibaba.druid.pool.DruidDataSource
    # mysql驱动类
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/mCloudSql?useSSL=false&serverTimezone=UTC
    username: root
    password: root

猜你喜欢

转载自blog.csdn.net/weixin_43409994/article/details/106766273
今日推荐