admin 管理员组文章数量: 1086019
启功SpringBoot项目时报错,问题描述如下:
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).
原因:
在pom中引入了mybatis-spring-boot-starter 坐标,Spring boot默认会加载org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration类,DataSourceAutoConfiguration类使用了@Configuration注解向spring注入了dataSource bean。因为工程中没有关于dataSource相关的配置信息,当spring创建dataSource bean因缺少相关的信息就会报错
解决方案:
- 方案一:去掉 mybatis 的坐标依赖
- 方案二:将启动类上的注解改为 @SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
- 方案三:在 application.yml 配置上数据库的连接信息
本文标签: DataBase Embedded Derby HSQL
版权声明:本文标题:Consider the following: If you want an embedded database (H2, HSQL or Derby) 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://roclinux.cn/b/1738334482a1965587.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论