springboot项目禁用dataSource数据源功能,只需修改yml文件,关闭数据库连接功能

当我们遇到以下报错:

Description:

Failed to configure a DataSource: ‘url’ attribute is not specified and no embedded datasource could be configured.

Reason: Failed to determine a suitable 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).

 

如果不想使用数据库功能,可以这样配置:

application.yml: 

spring:
  autoconfigure:
    exclude: org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration

本文来自网络,不代表协通编程立场,如若转载,请注明出处:https://net2asp.com/60a3549488.html