Cannot determine embedded database driver class for database type NONE
springboot+jpa使用自定义配置文件连接数据库报错:Cannot determine embedded database driver class for database type NONE
原因:没有配置数据源dataSource,配置文件加载进来了的。
解决办法:在配置类中配置数据源
package com.springboot1.util;
import org.apache.tomcat.jdbc.pool.DataSource;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
@Configuration
@PropertySource(value={"classpath:jdbc.properties"})
@ConfigurationProperties(prefix="database",ignoreUnknownFields = false)
@Component
//@ConfigurationProperties(prefix="database",locations="classpath:jdbc.properties")高版本中@ConfigurationProperties去除了locations的属性
public class PropertyConfig {
private String driverName=null;
private String url=null;
private String username=null;
private String password=null;
public String getDriverName() {
return driverName;
}
public void setDriverName(String driverName) {
this.driverName = driverName;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
@Bean
public DataSource druidDataSource() {
DataSource datasource = new DataSource();
datasource.setUrl(url);
datasource.setUsername(username);
datasource.setPassword(password);
datasource.setDriverClassName(driverName);
return datasource;
}
}
Cannot determine embedded database driver class for database type NONE的更多相关文章
- 解决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 ...
- Caused by: org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embe
Caused by: org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationEx ...
- 深入Spring Boot:怎样排查 Cannot determine embedded database driver class for database type NONE
ref:https://www.journaldev.com/13830/spring-boot-cannot-determine-embedded-database-driver-class-for ...
- Eureka 客户端启动报错误 Cannot determine embedded database driver class for database type NONE
用这种数据库配置就是死活连不上数据库 提示:Cannot determine embedded database driver class for database type NONE 解决方式: 启 ...
- Springboot项目启动报错,提示Cannot determine embedded database driver class for database type NONE
我在springboot项目里面引入了数据库的配置: <dependency> <groupId>org.mybatis.spring.boot</groupId> ...
- spriing boot 启动报错:Cannot determine embedded database driver class for database type NONE
最近在学习使用spring boot.使用maven创建好工程,只引用需要用到的spring boot相关的jar包,除此之外没有任何的配置. 写了一个最简单的例子,如下所示: package com ...
- 【spring cloud】【spring boot】项目启动报错:Cannot determine embedded database driver class for database type NONE
解决参考文章:https://blog.csdn.net/hengyunabc/article/details/78762097 spring boot启动报错如下: Error starting A ...
- SpringBoot项目报错Cannot determine embedded database driver class for database type NONE
原因: Cannot determine embedded database driver class for database type NONE 这是因为spring boot默认会加载org.s ...
- 报错Cannot determine embedded database driver class for database type NONE解决方法
由于我不需要数据库,启动springboot报错: Cannot determine embedded database driver class for database type NONE If ...
随机推荐
- Blender Python脚本的6个技巧
https://www.youtube.com/watch?v=vFoh3S8MLBI&index=3&list=PLw8Sjaw0TPm0J9DXj3XGi1_9fxXezlzrM ...
- python中type、class、object之间的关系
先看一段代码 # -*- coding:UTF-8 -*- __autor__ = 'zhouli' __date__ = '2018/11/13 18:40' a = 1 b = 'abc' pri ...
- SQL Server 2008 R2 根据.asmx访问WebService
.asmx 都是.Net 同系列,所以学习的时候会比较简单. 方法一: 步骤1.在浏览器打开.asmx地址可以到方法列表, 步骤2.点进方法列表会有SOAP调用的案例, 步骤3.SQL Server ...
- 简易数据库实现 UNIX环境高级编程(APUE)第二十章 A Database Library
将课程的源代码 使用C++写了一部分 LINUX WINDOW均可运行 #ifndef MYDB_H #define MYDB_H #include <iostream> #include ...
- RNQOJ 4 数列
把N化成二进制是关键,比如把序号10化成二进制就是1010,对于K=2来说第10个数就是2^3+2^1,对于k=3来说第10个数就是3^3+3^1;这里只需要把K替代一下就可以解决了 #include ...
- poj3304(是否存在一条直线与所有给出线段相交
题意:给出n条线段,问你是否存在一条直线让他与所有线段相交. 思路:枚举两条直线的起点和终点做一条直线,看他是否与所有线段相交. #include<cstdio> #include< ...
- QT中报错collect2:ld returned 1 exit status的可能原因。
参考:https://blog.csdn.net/u014546553/article/details/78781547 1.编译成功的例子在后台执行,有时一闪而过,如果再次build ,则会提示上述 ...
- ABP框架系列之五十:(Swagger-UI-集成)
Introduction From it's web site: "....with a Swagger-enabled API, you get interactive documenta ...
- 【转】Linux中的EAGAIN含义
在Linux环境下开发经常会碰到很多错误(设置errno),其中EAGAIN是其中比较常见的一个错误(比如用在非阻塞操作中). 从字面上来看,是提示再试一次.这个错误经常出现在当应用程序进行一些非阻塞 ...
- Hdp安装问题杂解
5.在安装的时候遇到的问题 5.1使用ambari-server start的时候出现ERROR: Exiting with exit code -1. 5.1.1REASON: Ambari Ser ...