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 ...
随机推荐
- docker学习笔记(四)-持久化数据,安装docker-compose
Docker 持久化数据 实战 compose 安装docker-compose
- Harbor是什么
第一次听到这个名字应该是2016年初的时候,那是在容器技术已经兴起的,各个容器管理平台正处于群雄逐鹿的时候,mesos.kubernetes.swarm等被国内外各个厂商用来作为容器的管理系统.这个时 ...
- go 调用windows dll 的三种方法
参考:https://blog.csdn.net/qq_39584315/article/details/81287669 大部分代码参考:https://studygolang.com/articl ...
- 深度学习框架PyTorch一书的学习-第三章-Tensor和autograd-1-Tensor
参考https://github.com/chenyuntc/pytorch-book/tree/v1.0 希望大家直接到上面的网址去查看代码,下面是本人的笔记 Tensor Tensor可以是一个数 ...
- node.js如何引用其它js文件
以Java来说,比如要实现第三方存储,我可能需要导入对应的库,以maven为例,使用腾讯云或者七牛云.阿里云,我需要导入对应的maven依赖.再比如,有些时候我们封装某个类,而那个类不在该包下,我们需 ...
- Ubuntu Server 16.04修改IP、DNS、hosts
本文记录下Ubuntu Server 16.04修改IP.DNS.hosts的方法 -------- 1. Ubuntu Server 16.04修改IP sudo vi /etc/network/i ...
- EF Core中,通过实体类向SQL Server数据库表中插入数据后,实体对象是如何得到数据库表中的默认值的
我们使用EF Core的实体类向SQL Server数据库表中插入数据后,如果数据库表中有自增列或默认值列,那么EF Core的实体对象也会返回插入到数据库表中的默认值. 下面我们通过例子来展示,EF ...
- JSOUP如何POST只含JSON格式的数据
引言 现在前后端分离渐渐成为主流,网站可以通过json格式的数据和服务端进行交互,比如下图: 关于这点,JSOUP官方API文档已经给出了解决方法 Connection requestBody(St ...
- springcloud(十三):Eureka 2.X 停止开发,但注册中心还有更多选择:Consul 使用详解
在上个月我们知道 Eureka 2.X 遇到困难停止开发了,但其实对国内的用户影响甚小,一方面国内大都使用的是 Eureka 1.X 系列,另一方面 Spring Cloud 支持很多服务发现的软件, ...
- Mysql启动找不到mysql.sock文件问题(Centos7)
刚装完Mysql5.7,将Mysql添加到开机自启.reboot之后mysql服务却没启动起来, 直接输入mysql –uroot –p ,出现如下错误,找不到mysql.sock文件.用servic ...