zoukankan      html  css  js  c++  java
  • springboot启动报错:Cannot determine embedded database driver class for database type NONE

    一.报错信息

    2020-08-17 10:28:21.731  INFO 9208 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
    2020-08-17 10:28:21.747  INFO 9208 --- [           main] utoConfigurationReportLoggingInitializer : 
    
    Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
    2020-08-17 10:28:21.753 ERROR 9208 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 
    
    ***************************
    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 (no profiles are currently active).

    从意思分析,就是因为我没有配置数据库的连接呗,但是我又不需要连接数据库,所以

    二.解决办法

    需要在启动类的@EnableAutoConfiguration或@SpringBootApplication中添加exclude = {DataSourceAutoConfiguration.class},排除此类的autoconfig。启动以后就可以正常运行。排除数据库的自动启动

    package com.web.boot;
    
    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.autoconfigure.SpringBootApplication;
    import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
    
    @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
    public class ApplicationStart {
        public static void main(String[] args) {
            SpringApplication.run(ApplicationStart.class, args);
    
        }
    
    }
  • 相关阅读:
    2018.10.10python homework
    2018.10.10python学习第十六天part3
    2018.10.10python学习第十六天part2
    2018.10.10python学习第十六天part1
    2018.09.28python学习第十三天part3
    2018.09.28python学习第十三天part2
    2018.09.28python学习第十三天part1
    当不搞技术好几年后,又回来了,忽然很亲切
    福大软工 · BETA 版冲刺前准备(团队)
    事后诸葛亮
  • 原文地址:https://www.cnblogs.com/KdeS/p/13516171.html
Copyright © 2011-2022 走看看