代码改变世界

springcloud config配置git作为数据源然后启动报错 If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.

2021-03-31 10:34  方斌  阅读(452)  评论(0编辑  收藏  举报

不想连接数据库的话有以下解决方案
解决方案1
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})

@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
// 激活配置中心
@EnableConfigServer
public class ConfigMain3344 {
    public static void main(String[] args) {
        SpringApplication.run(ConfigMain3344.class, args);
    }
}

解决方案2
如果以上方法不行那就,将pom文件带有数据库相关的删除,例如:jdbc、mysql等,或者用tree命令查询下是否引入了mysql相关jar包
本人出错就是因为引入了一个公共的项目,公共项目的pom中包含mysql的配置导致出现以上问题