学习Spring Boot 过程中遇到了下列这个问题

Description:

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
//无法配置数据库,没有指定url属性,并且无法配置embedded datasource
Reason: Failed to determine a suitable driver class
//原因:无法明确指定正确的驱动类(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).

//建议:
//如果如果需要加载嵌入式的数据库,请将他放入路径中
//如果有数据库设置需要从指定配置文件中加载,需要调用该配置文件(目前没有活动的配置文件)

Process finished with exit code 1
在网上找了很多答案,

其中的一篇:https://www.cnblogs.com/yourGod/p/9178515.html

按照上述的解决办法:)

程序入口处:

@SpringBootApplication
public class DemoApplication {

修改为:
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
public class DemoApplication {
也许你改成这样子 ,问题就解决了, 但是我的没有解决,加了这个产生了一个新的问题:

Description:

Field userRepository in com.wcyq.demo.service.impl.UserServiceImpl required a bean of type 'com.wcyq.demo.domain.UserRepository' that could not be found.

Action:

Consider defining a bean of type 'com.wcyq.demo.domain.UserRepository' in your configuration.

Process finished with exit code 1
出现这个问题,看看是否 程序入口的 xxxApplication.java 是否在最外层的包下.如果不是,把该类放在最外层的包下面

参考自:https://blog.csdn.net/zhouyingge1104/article/details/78267882/

也许你走到这一步,问题就已经得到解决了

但是我发现上面这篇还是没有能够帮助到我. 依然还是上述问题提示错误信息.

继续寻找错误

是否缺少注解

@Service //该注解必须加上,否者会导致上述错误
public class UserServiceImpl implements UserService {
  参考自:https://blog.csdn.net/cutterwolf/article/details/77862652

但是我发现我加了注解,还是一样有这个错误,怎么办?

还是包没有扫到,继续添加:

@SpringBootApplication(exclude = DataSourceAutoConfiguration.class,scanBasePackages={ "com.wcyq.demo"})
public class DemoApplication {
程序依旧还是那个错误;

后面又找了一下问题,把程序全部rebuild   还有有同样的问题, 最后干脆重新新建项目,然后按照教程重新运行了下,没有发现上述的其他问题, 搞不懂什么鬼,先记录在这里!
---------------------
作者:一往无前-千夜
来源:CSDN
原文:https://blog.csdn.net/wolfking0608/article/details/82886062
版权声明:本文为博主原创文章,转载请附上博文链接!

If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.的更多相关文章

  1. embedded database (H2, HSQL or Derby), please put it on the classpath

    Description: Failed to configure a DataSource: 'url' attribute is not specified and no embedded data ...

  2. Spring boot 启动错误处理: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...

    错误原因 在pom中引入了mybatis-spring-boot-starter ,Spring boot默认会加载org.springframework.boot.autoconfigure.jdb ...

  3. 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 ne

    更多精彩关注微信公众号 错误原因 在pom中引入了mybatis-spring-boot-starter ,Spring boot默认会加载org.springframework.boot.autoc ...

  4. Consider the following: If you want an embedded database (H2, HSQL or Der...

    这个坑把java进程干掉就可以了,因为占用了 Description: Failed to configure a DataSource: 'url' attribute is not specifi ...

  5. 报错Cannot determine embedded database driver class for database type NONE解决方法

    由于我不需要数据库,启动springboot报错: Cannot determine embedded database driver class for database type NONE If ...

  6. 异常 SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase]

    使用Spring 的JDBCtemplate 调用数据库的时候 出现了如下的问题 SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-S ...

  7. 解决spring-boot启动中碰到的问题:Cannot determine embedded database driver class for database type NONE

    问题 如下: 2017-07-16 08:50:57.436  INFO 13524 --- [           main] c.p.p.web.PointshopWebApplication   ...

  8. SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase] 错误

    在一次改bug的过程,爆出了数据库错误,但是一看后面控制台,并没有爆出以前的具体的数据库错误的原因,而是 SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, In ...

  9. Cannot determine embedded database driver class for database type NONE

    springboot+jpa使用自定义配置文件连接数据库报错:Cannot determine embedded database driver class for database type NON ...

随机推荐

  1. CSAPP:第一章计算机系统漫游

    CSAPP:计算机系统漫游 关键点:上下文.程序运行.计算机系统抽象. 信息就是位+上下文一个程序的运行过程系统的硬件组成编译系统是如何工作的?一个程序的运行过程(c语言举例)计算机系统中的抽象 信息 ...

  2. 第一章 mysql的体系结构与存储引擎

    数据库从逻辑上可以分为两部分,一部分负责存储即文件系统,这部分有个更时髦的名字叫存储引擎,存储引擎负责如何把数据以及索引相关的内容以合适的形式组织并存储到磁盘上.另一部分为server部分,负责和用户 ...

  3. Leetcode 1. Two Sum (Python)

    refer to https://blog.csdn.net/linfeng886/article/details/79772348 Description Given an array of int ...

  4. 环境部署(五):Linux下安装Gradle

    Gradle是一个基于Apache的Ant和Maven的项目自动化构建工具,相比于Ant和Maven的局限性,Gradle可以更好的帮助管理项目中的差异.依赖.编译.打包.部署. 可以自定义满足自己需 ...

  5. 动手做webserver的核心之http解析

    简介 webserver往小里说核心功能就是socket管理.url处理.http协议处理.业务dll管理等:下面简介绍一下http协议:超文本传输协议(HTTP)是一种通信协议,当时就是为web传输 ...

  6. Volley使用

    Volley是常用的网络请求框架,主要的用法如下: 获取字符串: public static void volleyTest1(final Context context){ RequestQueue ...

  7. 显式与隐式(ExplicitAndImplicit)

    显式与隐式(Explicit And Implicit) 1.概念 1.1 显式 实现的单词Explicit意思是清楚的.明确的.详述的.所以,显式的“显”是指明显且清楚的实现,相对于接口来说,就是明 ...

  8. COMCMS_CORE 起步篇,如何运行和部署

    前言:关于最近开源后,不少朋友问,怎么我下载下来,运行不了.或者怎么没有左边菜单.货不对板?还是我吃了数据? 感言:开源不容易,更不容易的是,明明毫无保留,还这么大误会,真是泪奔..... 好了.步入 ...

  9. List,DataTable实现行转列的通用方案

    最近在做报表统计方面的需求,涉及到行转列报表.根据以往经验使用SQL可以比较容易完成,这次决定挑战一下直接通过代码方式完成行转列.期间遇到几个问题和用到的新知识这里整理记录一下. 阅读目录 问题介绍 ...

  10. 蛙蛙推荐: TensorFlow Hello World 之平面拟合

    tensorflow 已经发布了 2.0 alpha 版本,所以是时候学一波 tf 了.官方教程有个平面拟合的类似Hello World的例子,但没什么解释,新手理解起来比较困难. 所以本文对这个案例 ...