【问题标题】:Spring : Cannot determine embedded database driver class for database type NONESpring:无法确定数据库类型 NONE 的嵌入式数据库驱动程序类
【发布时间】:2018-06-18 03:52:39
【问题描述】:

我想使用活动配置文件“firza”运行我的项目,但它给了我以下错误。在谷歌上搜索后,我尝试了所有可能的修复,但没有任何效果:| 有谁能够帮我?

application.properties

spring.datasource.url=jdbc:mysql://localhost:3306/MySportsAcademy?createDatabaseIfNotExist=true
spring.datasource.username=admin
spring.datasource.password=ivl123
spring.data.rest.basePath=/api
#spring.profiles.active=firza
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.jpa.properties.hibernate.dialect=com.ivl.MySportsAcademy.dbconfig.MySportsAcademyMysql57Dialect
spring.jpa.hibernate.ddl-auto=update
allowed.origins=http://localhost:9000
logging.level.org.springframework.security=DEBUG
logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
logging.level.org.apache.tomcat.jdbc.pool=DEBUG
logging.level.com.reservos=DEBUG
logging.level.com.sendgrid=DEBUG
logging.level.org.hibernate.tool.hbm2ddl=debug
server.port=3000

application-firza.properties

spring.datasource.url=jdbc:mysql://localhost:3306/MySportsAcademy?createDatabaseIfNotExist=true
spring.datasource.username=root
spring.datasource.password=admin
spring.data.rest.basePath=/api

spring.jpa.hibernate.ddl-auto=update
allowed.origins=http://localhost:9000
logging.level.org.springframework.security=DEBUG
logging.level.org.hibernate.SQL=DEBUG
logging.level.org.apache.tomcat.jdbc.pool=DEBUG
logging.level.com.reservos=DEBUG
logging.level.com.sendgrid=DEBUG
logging.level.org.hibernate.tool.hbm2ddl=debug
server.port=3000
admin.email.id=bilal.raza@indusvalleylabs.com

pom.xml

<dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>

错误

***************************
APPLICATION FAILED TO START
***************************

Description:

Cannot determine embedded database driver class for database type NONE

Action:

If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (the profiles "firza" are currently active).

【问题讨论】:

  • 如果不存在也添加这个依赖:org.springframework.bootspring-boot-starter-data-jpa
  • spring.datasource.driver-class-name=com.mysql.jdbc.Driver 在 application-firza.properties 中丢失
  • @Afridi 已经在场
  • @Chids 它没有任何区别..错误仍然存​​在:|
  • 在您的主应用程序类中添加这一行:@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class}) 检查:journaldev.com/13830/…

标签: mysql database maven spring-boot configuration


【解决方案1】:

确保资源文件夹中有 application.properties 和所需的数据库参数

这里是例子

spring.datasource.platform=mysql
spring.datasource.driverClassName=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://vaquarkhan.com:3307/vk01?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
spring.datasource.username=xyz
spring.datasource.password=xyzwe
spring.datasource.initialization-mode=never
#spring.datasource.schema=schema.sql
logging.level.org.springframework.integration=DEBUG

【讨论】:

    猜你喜欢
    • 2014-07-27
    • 2016-02-16
    • 2018-07-10
    • 2019-04-09
    • 2018-03-28
    • 2018-02-12
    • 2018-01-04
    • 1970-01-01
    相关资源
    最近更新 更多