在使用springboot启动项目时,数据库报错缺失文件

109 阅读1分钟

项目场景:

在使用springboot启动项目时,数据库报错缺失文件 Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

问题描述:

在这里插入图片描述

原因分析:

这是因为springboot启动时没有在配置文件中读取到数据源导致的

解决方案:

第一种.在properties配置文件中加入数据库信息 第二种.如果不需要加载数据库可以在启动类中取消加载数据库 在这里插入图片描述