新建Spring boot 启动报错 Failed to auto-configure a DataSource
今天学习springboot,使用idea创建项目。在选择组件时添加了mysq 然后在第一次启动的时候启动报错,错误信息如下:
***************************
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
Action:
Consider the following:
If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).
在多方查证后,需要在启动类的@EnableAutoConfiguration或@SpringBootApplication中添加exclude
= {DataSourceAutoConfiguration.class},排除此类的autoconfig。启动以后就可以正常运行。
这是因为添加了数据库组件,所以autoconfig会去读取数据源配置,而我新建的项目还没有配置数据源,所以会导致异常出现。
解决问题方法2:不用改动添加语句,注意项目文件结构的正确性
新建Spring boot 启动报错 Failed to auto-configure a DataSource的更多相关文章
- Spring boot 启动报错 Failed to auto-configure a DataSource
1.Spring boot 启动报错 Failed to auto-configure a DataSource 参考资料https://blog.csdn.net/liuyinfei_java/ar ...
- spring Boot启动报错Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: org.springframework.core.annotation.AnnotatedElementUtils.getAnnotationAttributes
spring boot 启动报错如下 org.springframework.context.ApplicationContextException: Unable to start web serv ...
- 解决spring boot启动报错java.lang.NoClassDefFoundError: ch/qos/logback/classic/Level
解决spring boot启动报错java.lang.NoClassDefFoundError: ch/qos/logback/classic/Level 学习了:https://blog.csdn. ...
- 【原创】大叔经验分享(67)spring boot启动报错
spring boot 启动报错: Caused by: java.lang.IllegalArgumentException: LoggerFactory is not a Logback Logg ...
- spring boot 启动报错(spring-boot-devtools热部署后):The elements [spring.resources.cache-period] were left unbound. Update your application's configuration
详细错误代码: *************************** APPLICATION FAILED TO START *************************** Descript ...
- Spring Boot 启动报错 Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 37
使用命令 java -jar springBoot.jar 启动项目,结果报错如下: Exception at java.lang.String.substring(String.java:) at ...
- spring boot启动报错Error starting ApplicationContext(未能配置数据源)
主要错误:Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource c ...
- Spring Boot 启动报错:LoggingFailureAnalysisReporter
17:57:19: Executing task 'bootRun'... Parallel execution with configuration on demand is an incubati ...
- Spring boot 启动报错:com.mongodb.MongoSocketOpenException: Exception opening socket
详细错误信息: com.mongodb.MongoSocketOpenException: Exception opening socket at com.mongodb.connection.Soc ...
随机推荐
- linux 下如何将网页版应用生成桌面图标
使用linux mint已经两年了,很多国民应用,都没有Linux版,但是这些应用都有网页版,今天就说下最简单的将网页应用变成桌面应用,无需配置,安装任何插件.以微信为例; 首先,在谷歌浏览器打开网页 ...
- Android新版xUtils3工具类相关debug
首先出现问题是 build.gradle中的csayısıom.lidroid.xutils:xutils:2.6.13报错了,所以想到是版本的问题,github上搜了xutils发现有新版xutil ...
- Wannafly挑战赛19:C. 多彩的树
传送门 $k$的范围非常小, $O(n2^k)$求出状态最多为$S$的路径数, 然后容斥. #include <iostream> #include <sstream> #in ...
- 分布式---Raft算法
6.Raft Raft也是分布式一致性协议,主要是用来竞选主节点. 单个Candidate的竞选 有三种节点:Follower,Candidate和Leader.Leader会周期性的发送心跳 ...
- python 中的 [:-1] 和 [::-1]
1.案例解释 a='python' b=a[::-1] print(b) #nohtyp c=a[::-2] print(c) #nhy #从后往前数的话,最后一个位置为-1 d=a[:-1] #从位 ...
- 数据绑定-POJO对象绑定参数
测试: 效果:
- ajax的交互原理,同步和异步的区别
ajax的交互原理分别为: 创建对象——建立连接——发送数据——注册回调——执行回调 var xhr=new XMLHttpRequest()//创建对象 xhr.open(请求,url,true或者 ...
- vue--支付宝支付
1.支付宝支付:前端发起一个请求,后台返回一个页面,直接将返回的页面(一个表单),再执行表单提交 okFryOtherPayHandler(){ let reqBody = {}; reqBody.o ...
- mock.js 模拟数据
1. 劫持请求,返回模拟数据: 用于前后台对接前数据模拟 相比于静态json文件而言:代码完成后不必修改源文件对应的接口调用.可模拟增删改查 2.实例代码 <!doctype html> ...
- Python测开面试题之装饰器
Python的装饰器是面试常被问到的问题之一,在面试Python测试开发时被问到的概率不低于70%,那么装饰器的原理是什么,怎么快速写出一个装饰器呢,接下来我们详细讲解装饰器的实现方法. Python ...