很多时候你新建了Maven 或者SpringBoot 工程,激动的点了主启动类,你就发现了下面的错误

 Error starting Tomcat context. Exception: org.springframework.beans.factory.BeanCreationException. Message: 
Error creating bean with name 'servletEndpointRegistrar' defined in class path resource
[org/springframework/boot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfiguration$
WebMvcServletEndpointManagementContextConfiguration.class]:
Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException:
Failed to instantiate [org.springframework.boot.actuate.endpoint.web.ServletEndpointRegistrar]:
Factory method 'servletEndpointRegistrar' threw exception;
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'healthEndpoint' defined in class path resource
[org/springframework/boot/actuate/autoconfigure/health/HealthEndpointConfiguration.class]:
Unsatisfied dependency expressed through method 'healthEndpoint' parameter 0;
nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'healthContributorRegistry' defined in class path resource
[org/springframework/boot/actuate/autoconfigure/health/HealthEndpointConfiguration.class]:
Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException:
Failed to instantiate [org.springframework.boot.actuate.health.HealthContributorRegistry]:
Factory method 'healthContributorRegistry' threw exception;
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'org.springframework.boot.actuate.autoconfigure.jdbc.DataSourceHealthContributorAutoConfiguration':
Unsatisfied dependency expressed through constructor parameter 0;
nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]:
Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]:
Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException:
Failed to determine a suitable driver class
[ restartedMain] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
--- [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt:
org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException:
Unable to start embedded Tomcat
--- [ restartedMain] ConditionEvaluationReportLoggingListener : Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-09-03 13:12:04.338 ERROR 24572 --- [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter : ***************************
APPLICATION FAILED TO START
*************************** Description: Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be 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).

  这里说的是啥意思呢,你没有数据库相关的链接,数据库相关的链接在哪里配置呢,就是在你的Resource文件目录下的properties 或者yml文件中

但是这里你可能会说,我**不用数据库,我干啥配这个b玩意,我想说这句话的时候,你已经点了很多遍的主启动都报这个错误,

今天你算来对了,我敢肯定80%的人都遇到过这个问题。但是不知道为啥,今天我给你分析一下昂:

①:在IDEA 中用SpringInitial  点点点生成的SpringBoot/cloud项目
②:跟视频操作,一顿操作后发现不能启动,
③:DonwLoad下的代码   复制进去的POM依赖

还有很多昂,不墨迹了说重点吧。
解决方法:

首先着重看自己的POM依赖(是自己的POM,不是父工程,也不是其他工程,是自己的)中有无以下依赖

<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
</dependency>

  

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>

  经过鄙人的测试,就是第一个依赖捣的鬼,这就是为啥你加了这个依赖你不配置相关的mysql链接,Spring就给你报错的原因。

最后提醒:按需注入POM才是正道,老铁们,我做的对么?

关于idea中SpringBoot启动失败的坑的更多相关文章

  1. springboot启动失败( No active profile set, falling back to default profiles: default)

    问题: springboot启动失败( No active profile set, falling back to default profiles: default) 解决方法 在pom.xml文 ...

  2. APMServ中Apache启动失败的原因

    APMServ中Apache启动失败绝大多数的情况是因为APMServ得路径出错和80端口被占用,也有可能您使用的是WIN8系统,下面SJY根据不同情况告诉大家如何解决APMServ中Apache启动 ...

  3. hadoop中namenode启动失败

    jps发现namenode启动失败 每次开机都要重新格式化一下namenode才可以 其实问题出现自tmp文件上,因为每次开机就会被清空,所以现在我们配置一个tmp文件目录. 如果之前没有配置过,默认 ...

  4. SpringBoot 启动失败 Failed to determine a suitable driver class 问题解决方案

    Description: Failed to auto-configure a DataSource: 'spring.datasource.url' is not specified and no ...

  5. 微服务中springboot启动问题

    log4j:WARN No appenders could be found for logger (org.springframework.web.context.support.StandardS ...

  6. 微服务框架中springboot启动的一个问题

    微服务中,采用的是springboot构建单个项目,其中一个项目user启动过程中总是启动补起来,相关的地方都没有错,始终启动不起来,而且要命的是控制台不打印日志,日志级别是debug级别的,但是打印 ...

  7. HDFS中namenode启动失败

    1.环境配置: -1.core-site.xml文件 <configuration> <property> <name>fs.defaultFS</name& ...

  8. 解决springboot启动失败问题:Unable to start embedded container;

    将一个springboot项目导入到eclipse后,启动时报错Unable to start embedded container,以下时全部错误信息: Application startup fa ...

  9. 在windows 2008 R2中SQl Server 2008中代理启动失败的一个原因总结

    启动SQL代理的时候报错如下: 关调用实时(JIT)调试而不是此对话框的详细信息,请参见此消息的结尾. ************** 异常文本 **************System.NullRef ...

随机推荐

  1. .NETCore中实现ObjectId反解

    前言 在设计数据库的时候,我们通常需要给业务数据表分配主键,很多时候,为了省事,我都是直接使用 GUID/UUID 的方式,但是在 MonggoDB 中,其内部实现了 ObjectId(以下统称为Oi ...

  2. "点"醒自己

    回顾: 过去的经历 从18年开始在某机构进行了测试培训,9月正式加入测试小白大军,中间也经历了半年的空窗期,入职2个月应能力不够被公司辞退,后通过培训班的朋友内推到一家软件外包公司,工作到现在. 思考 ...

  3. APP常用控件学习理解

    1.TextView 示例: layout_width指的是文本的所占宽度(不一定填充满),layout_height指的是文本所占高(不一定填充满),warp_coonent :包裹文本宽度 mat ...

  4. TF签名 外部测试 内部测试 TestFlight

    1.将release包传到iTunes connect 2. 绿线是内部测试 A.需要添加测试员 B.最多25个测试员 C.提交到iTunes connect不需要等待审核,即可测试 红线是外部测试( ...

  5. fetch封装

    import {fetch as fetchPro} from "whatwg-fetch" import qs from "qs" const get=(ur ...

  6. 最新版CentOS8系统安装和基本配置

    一.Centos8新版简介 Redhat公司在2019年5月推出了rhel8,年底推出了centos8,紧接着也会把相关的技术认证完全转换为新平台. 阿里云.华为云目前也已推出centos8的公共镜像 ...

  7. Ubuntu18.04安装Nautilus-actions自定义文件管理器鼠标右键列表

    sudo add-apt-repository ppa:daniel-marynicz/filemanager-actions #需要添加源 sudo apt-get install filemana ...

  8. JavaScript在HTML中的基础用法总结

    网页主要由三部分组成,分别为html.CSS和Javascript.如果说HTML是肉身,CSS是皮相,那Javascript就是灵魂.因此,三者的联系与融合则至关重要.本文就来为大家讲解一下Java ...

  9. C#连接Oracle数据库,通过EF自动生成与数据库表相关的实体类

    C#连接Oracle数据库,通过EF自动生成与数据库表相关的实体类 ps:如需转载,请在转载文章明显处,i标注作者和原文地址 一.准备条件 需要自己电脑上已经安装了Oracle数据库,并且已经创建了相 ...

  10. IOS 如何持久化自定义对象 2014-08-01 01:38

    如果持久话自定义对象 那么这个对象一定要遵循 NSCoding 协议 并实现编解码:然后再将编解码后的数据 NSKeyedArchiver 到NSData中   @interface NSKeyAnd ...