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 ...
随机推荐
- P1577 切绳子(二分)
思路:先来分析一下数据范围,是1e4个数据,但是,是double类型,结果不超过0.01那么在绳子最大的情况下,单纯的找正确答案暴力的话就是1e7的时间复杂度,再乘上1e4的数据,这样肯定不行.那么很 ...
- 【vue】vue +element 搭建项目,点击空白处关闭弹窗
<template> <div class="step2"> <el-button @click="togglePanel($event)& ...
- 箱线图boxplot
箱线图boxplot--展示数据的分布 图表作用: 1.反映一组数据的分布特征,如:分布是否对称,是否存在离群点 2.对多组数据的分布特征进行比较 3.如果只有一个定量变量,很少用箱线图去看数据的分布 ...
- java 基础 动态绑定和多态
- 图解HTTP,TCP,IP,MAC的关系
入门 用户发了一个HTTP的请求,想要访问我们网站的首页,这个HTTP请求被放在一个TCP报文中,再被放到一个IP数据报中,最终的目的地就是我们的115.39.19.22. 进阶 IP数据报其实是通过 ...
- iOS开发简记(9):APPStore审核
"觅知音"这个APP的第一个版本从提交审核到上架,历时三个星期,其中遇到一些审核上的问题,它的处理或许能帮助到遇到同样问题的小伙伴们,所以这里列举出来,这三个星期如何跟苹果的审核团 ...
- 使用C#创建SQLite控制台应用程序
本文属于原创,转载请注明出处,谢谢! 一.开发环境 操作系统:Windows 10 X64 开发环境:VS2015 编程语言:C# .NET版本:.NET Framework 4.0 目标平台:X86 ...
- 【深度学习】一文读懂机器学习常用损失函数(Loss Function)
最近太忙已经好久没有写博客了,今天整理分享一篇关于损失函数的文章吧,以前对损失函数的理解不够深入,没有真正理解每个损失函数的特点以及应用范围,如果文中有任何错误,请各位朋友指教,谢谢~ 损失函数(lo ...
- Vue(二)基础
01-vue的起步 1.引包 a) 直接下载,并用<script>标签引入 b) CDN方式引入: <script src="https://cdn.bootcss.com ...
- 小L的项链切割 (回文串)
题目描述 小T送给了小L了一串项链.为了方便,我们把项链上形态不同钻石用不同的字母表示.这样小L的项链就变成了一个字符串.小L忽然想把这串项链优美地切割一下,她想把它切割成尽量少的回文项链,啊也就是回 ...