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

2024-01-02 16:20:02

当我们遇到以下报错:

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://blog.csdn.net/weixin_44853310/article/details/135339989
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。