博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Spring boot 启动报错 Failed to auto-configure a DataSource
阅读量:6927 次
发布时间:2019-06-27

本文共 596 字,大约阅读时间需要 1 分钟。

  第一次搭建spring boot,选择了web,mysql,mybatis,thymeleaf功能。启动时报错:

***************************

APPLICATION FAILED TO START
***************************

Description:

Failed to auto-configure a DataSource: 'spring.datasource.url' is not specified and no embedded datasource could be auto-configured.

Reason: Failed to determine a suitable driver class

该问题的解决方法是:

在启动类的@EnableAutoConfiguration或@SpringBootApplication后添加(exclude = {DataSourceAutoConfiguration.class}),排除此类的autoconfig。启动以后就可以正常运行。

这是因为添加了数据库组件,所以autoconfig会去读取数据源配置,而我新建的项目还没有配置数据源,所以会导致异常出现。

转载于:https://www.cnblogs.com/wjw1210/p/8571717.html

你可能感兴趣的文章
显示来访用户的IP及其地区
查看>>
nohup和&后台运行,进程查看及终止 详解
查看>>
Codeforces Round #540 Tanya and Candies 预处理
查看>>
CF1101F Trucks and Cities
查看>>
WCF 第二章 契约 WSDL中的操作名字、类型、操作和命名空间
查看>>
淘宝使用的灰色度方案
查看>>
实验4
查看>>
××校招:前端线上笔试题--页面中的一个元素(10px*10px)围绕坐标(200, 300) 做圆周运动...
查看>>
nginx负载均衡实验
查看>>
Numpy矩阵与通用函数
查看>>
逃离裁员:程序员在云时代的生存之道
查看>>
性能测试指标(图表)
查看>>
几个重要指标和注意事项(重要)
查看>>
React从0到1--Redux
查看>>
c语言判断闰年作业
查看>>
求博客园.net 2.0版的源码
查看>>
python 遍历, 获取目录下所有文件名和文件夹的方法-----os.walk(), os.listdir
查看>>
intelij idea按键失灵
查看>>
[PHP]require include
查看>>
Python-Snakebite库操作Hadoop
查看>>