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 ...
随机推荐
- Python 抖音机器人,论如何在抖音上找到漂亮小姐姐?
只有想不到,没有做不到,最近抖音风靡好友圈,马上就有技术宅本着“代码改变世界”的理念开始了搞事之路. 需要注意的事,漂亮不漂亮没有明确的界限,每个人都有每个人的审美,只有外表而没有心灵的美也是空洞的. ...
- 洛谷P1274-魔术数字游戏
Problem 洛谷P1274-魔术数字游戏 Accept: 118 Submit: 243Time Limit: 1000 mSec Memory Limit : 128MB Probl ...
- 《JAVA程序设计》_第一周学习总结
20175217吴一凡 <java程序设计> 第一周学习总结 虽然已经做好了心理准备,但第一周的学习任务着实让我忙了整整三天,还是挺充实的吧.寒假已经在自己的电脑上安装好了虚拟机,我就在我 ...
- 【转】Android-Accessibility(辅助功能/无障碍,自动安装APP)
参考: http://www.infoq.com/cn/articles/android-accessibility-installing https://developer.android.com/ ...
- ②---Java开发工具Eclipse安装配置
Java开发工具Eclipse安装及配置 以下将为大家介绍Java开发工具Eclipse安装及配置. 一.下载Eclipse安装文件 正所谓工欲善其事必先利其器,我们在开发java语言过程中同样需要依 ...
- selenium中遇到div弹框,一起引申到其他弹框
1.div弹框和DOM普通元素一样处理 2.出现一下就自动消失的弹框,也是在DOM中有描述的,可以使用xpath,用其内容定位 3.(转,其他弹框处理,包括alert和不同windows) https ...
- AI 积分图
积分图(Integral Image),可以用于快速计算矩形特征.积分图每个位置(x, y)的值,等于原图对应位置的左上角所有像素点的值之和.因为“积分”在离散情况下就是求和,所以这也是积分图的命名由 ...
- HTML5学习总结-番外05 http 状态码
所有状态码汇总: 1xx(临时响应)表示临时响应并需要请求者继续执行操作的状态代码. 代码 说明100 (继续) 请求者应当继续提出请求. 服务器返回此代码表示已收到请求的第一部分,正在等待其 ...
- mongodb .explain('executionStats') 查询性能分析(转)
mongodb性能分析方法:explain() 为了演示的效果,我们先来创建一个有200万个文档的记录.(我自己的电脑耗了15分钟左右插入完成.如果你想插更多的文档也没问题,只要有耐心等就可以了.) ...
- 07 YAPI/基础设施 - DevOps之路
07 YAPI/基础设施 - DevOps之路 文章Github地址,欢迎start:https://github.com/li-keli/DevOps-WiKi 简介 YApi 是一个可本地部署的. ...