今天下午在启动spring cloud微服务的时候,报了这个错误:

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2018-07-03 20:17:10.295 ERROR 19024 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :

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

Description:

Cannot determine embedded database driver class for database type NONE

Action:

If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).

Disconnected from the target VM, address: '127.0.0.1:55393', transport: 'socket'

Process finished with exit code 1

刚开始我以为是端口被占用。果断cmd并输入netstat -aon,找半天没发现占用的端口,然后又网上看了一下,

转自:https://blog.csdn.net/Loser100/article/details/78190703?locationNum=9&fps=1

SpringBoot启动报错:Cannot determine embedded database driver class for database type NONE

springboot启动时会自动注入数据源和配置jpa

解决办法一:

启动类中加入注解:@SpringBootApplication(exclude={DataSourceAutoConfiguration.class,HibernateJpaAutoConfiguration.class})

解决方法二:

在Application.properties文件内配置数据源即可。代码如下:
spring.datasource.url=jdbc:mysql://localhost:3306/test
spring.datasource.username=root
spring.datasource.password=123456
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.max-idle=10
spring.datasource.max-wait=10000
spring.datasource.min-idle=5
spring.datasource.initial-size=5

我仔细的检查了一下,也加了注解,试了一下,我靠,没用啊,人生呐,真是改不完的bedug,

只好用出终极大招,拷贝我自己的代码,删除项目,从新从svn更新项目,导入运行,哎呦我去。怎么还是这问题?难道是我项目配置问题?不对啊,我其他的项目都没有问题啊。束手无策,只好求助小碗(一个认真工作的大佬);

通过反复调试,终于找到了。问题所在,pom.xml里面有一个错误的配置,

       <dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>

删了就可以运行,微服务也可以注册。配置文件请大家仔细检查。配置文件不对,什么都是扯淡。

欢迎大家关注公众号,不定时干货,只做有价值的输出

spring cloud(学习笔记)微服务启动错误(1)的更多相关文章

  1. Spring Cloud学习笔记-005

    服务消费者 之前已经搭建好了微服务中的核心组件——服务注册中心(包括单节点模式和高可用模式).也有了服务提供者,接下来搭建一个服务消费者,它主要完成两个目标,发现服务以及消费服务.其中,服务发现的任务 ...

  2. SpringCloud(9)使用Spring Cloud OAuth2保护微服务系统

    一.简介 OAth2是一个标准的授权协议. 在认证与授权的过程中,主要包含以下3种角色. 服务提供方 Authorization Server. 资源持有者 Resource Server. 客户端 ...

  3. Spring Cloud与Docker——微服务架构概述

    Spring Cloud与Docker--微服务架构概述 单体应用架构概述 微服务概述 微服务的特性 微服务架构的优点 微服务面临的挑战 微服务的设计原则 单体应用架构概述 传统的服务发布都是采用单体 ...

  4. 《Spring Cloud与Docker微服务架构实战》配套代码

    不才写了本使用Spring Cloud玩转微服务架构的书,书名是<Spring Cloud与Docker微服务架构实战> - 周立,已于2017-01-12交稿.不少朋友想先看看源码,现将 ...

  5. Spring Cloud与Docker微服务架构实战 PDF

    电子版百度云下载 链接: https://pan.baidu.com/s/115u011CJ8MZzJx_NqutyTQ 提取码: 关注公众号[GitHubCN]回复2019获取 本书的代码 共计70 ...

  6. Spring Cloud与Docker微服务架构实战 PDF版 内含目录

    Spring Cloud与Docker微服务架构实战  目录 1 微服务架构概述 1 1.1 单体应用架构存在的问题1 1.2 如何解决单体应用架构存在的问题3 1.3 什么是微服务3 1.4 微服务 ...

  7. Spring Cloud学习笔记之微服务架构

    目录 什么是微服务 架构优点 架构的挑战 设计原则 什么是微服务     微服务构架方法是以开发一种小型服务的方式,来开发一个独立的应用系统的.     其中每个小型服务都运行在自己的进程中,并经常采 ...

  8. Spring Cloud 学习笔记(一)——入门、特征、配置

    [TOC] 0 放在前面 0.1 参考文档 http://cloud.spring.io/spring-cloud-static/Brixton.SR7/ https://springcloud.cc ...

  9. 从 Spring Cloud 看一个微服务框架的「五脏六腑」

    原文:https://webfe.kujiale.com/spring-could-heart/ Spring Cloud 是一个基于 Spring Boot 实现的微服务框架,它包含了实现微服务架构 ...

  10. spring cloud + mybatis 分布式 微服务 b2b2c 多商户商城 全球部署方案

    用java实施的电子商务平台太少了,使用spring cloud技术构建的b2b2c电子商务平台更少,大型企业分布式互联网电子商务平台,推出PC+微信+APP+云服务的云商平台系统,其中包括B2B.B ...

随机推荐

  1. C++ const 理解

    转载自:https://www.cnblogs.com/jiabei521/p/3335676.html 如果函数需要传入一个指针,面试官可能会问是否需要为该指针加上const,把const加在指针不 ...

  2. 安装SVN并使用IDEA检出项目

    首先去下载小王八:https://tortoisesvn.net/downloads.html 下载完毕,打开 .. ..注意勾选command line工具 .. .. 下一步,打开IDEA,配置S ...

  3. IO以及file的一些基本方法

    IO定义:将内存的数据 持久化到设备上 这个动作称为输出 写 Output操作 把硬盘上的数据读取到内存 这个动作称为输入 读 Input 把上面这两种操作称为IO操作 File类的静态成员变量:pa ...

  4. MySQL会发生死锁吗?

    SHOW ENGINE INNODB STATUS;来查看死锁日志: SHOW PROCESSLIST;查看进程 MySQL的InnoDB引擎事务有4种隔离级别,主要是为了保证数据的一致性. Inno ...

  5. makefile解析:一些常用函数

    #======================================================================= #指定目标文件名,makefile中的变量直接使用不用 ...

  6. go goroutine

    进程和线程 进程是程序在操作系统中的一次执行过程,系统进行资源分配和调度的 一个独立单位. 线程是进程的一个执行实体,是CPU调度和分派的基本单位,它是比进程更 小的能独立运行的基本单位. 一个进程可 ...

  7. 2017-12-18python全栈9期第三天第一节之昨天内容回顾与作业讲解用户三次机会再试试

    #!/user/bin/python# -*- coding:utf-8 -*-username = "zd"password = "123"i = 3whil ...

  8. 剑指Offer_编程题_15

    题目描述 输入一个链表,反转链表后,输出链表的所有元素. /* struct ListNode { int val; struct ListNode *next; ListNode(int x) : ...

  9. db mysql / mysql cluster 5.7.19 / performance

    s 问题1: 数据库底层若表碎片化严重,导致表索引走向偏差,致使该表读写速度变慢,影响业务运行 解决1: 数据库表重组 end

  10. Centos 6\7下yum安装rstudio-server\shiny-server

    rstudio-server安装 #wget https://download2.rstudio.org/rstudio-server-rhel-1.1.463-x86_64.rpm #yum ins ...