If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
学习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.的更多相关文章
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- 报错Cannot determine embedded database driver class for database type NONE解决方法
由于我不需要数据库,启动springboot报错: Cannot determine embedded database driver class for database type NONE If ...
- 异常 SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase]
使用Spring 的JDBCtemplate 调用数据库的时候 出现了如下的问题 SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-S ...
- 解决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 ...
- SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase] 错误
在一次改bug的过程,爆出了数据库错误,但是一看后面控制台,并没有爆出以前的具体的数据库错误的原因,而是 SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, In ...
- Cannot determine embedded database driver class for database type NONE
springboot+jpa使用自定义配置文件连接数据库报错:Cannot determine embedded database driver class for database type NON ...
随机推荐
- 6.01-re-split_chinese
import re # 1.拆分字符串 one = 'asdsfsgsh' # 标准 是 s 为拆分 pattern = re.compile('s') result = pattern.split( ...
- java 关于打断点
比如:前台传过来参数中文乱码,需要decode才可以使用, 判断问题. debug 在 DispatcherServlet OncePerRequestFilter 打断点, 查看前台过来的中文在哪里 ...
- JS学习实践(1) JavaScript 修改图像灯泡
修改灯泡 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <titl ...
- openvon安装
一.安装环境 1.阿里云centos7 2.关闭防火墙,selinux 临时关闭:setenforce 0 永久关闭:vim /etc/selinux/config 3.修改yum源 1)备份原有的y ...
- leetcode 155. Min Stack 、232. Implement Queue using Stacks 、225. Implement Stack using Queues
155. Min Stack class MinStack { public: /** initialize your data structure here. */ MinStack() { } v ...
- Java中Enumeration接口的用法
Enumeration是java.util中的一个接口类,在Enumeration中封装了有关枚举数据集合的方法,与Iterator差不多,用来遍历集合中的元素 但是枚举Enumeration只提供 ...
- 编写Linux C++程序如何影响VIRT(虚存)和RES(实存/常驻内存)
转载目的,主要是为了理解lVIRT虚拟内存.RES常驻内存.共享内存SHR.SWAP和实际程序应用如何对应的. 在Linux命令行中执行top命令,可以查询到所有进程使用的VIRT虚拟内存.RES常驻 ...
- F#.NET周报 2018第34周-Ionide下载量100万
回顾一下过去一周F#和.NET最新相关信息 原文 新闻 Ionide 你在VS Code 上写F# 是离不开他的. ^^ 下载100万了 .NET Core 2.1.3发布,支持LTS版本(L ...
- 基于Metronic的Bootstrap开发框架经验总结(16)-- 使用插件bootstrap-table实现表格记录的查询、分页、排序等处理
在业务系统开发中,对表格记录的查询.分页.排序等处理是非常常见的,在Web开发中,可以采用很多功能强大的插件来满足要求,且能极大的提高开发效率,本随笔介绍这个bootstrap-table是一款非常有 ...
- SpringBoot集成Freemarker与Thymeleaf
一:概括 pom.xml添加依赖 配置application.yml HTML页面使用表达式 二:Freemarker模板引擎 1.添加依赖 <!-- ftl模板引擎 --> <de ...