springBoot 启动 If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.

**

Springboot启动时报错 If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.

**
产生这个错误的原因是springboot的自动配置,如果你没有配置DataSource就会导致下图这个错误
springBoot 启动 If you want an embedded database (H2, HSQL or Derby), please put it on the classpath._第1张图片
解决方案1

@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)//排除自动配置
public class ErukaServerMain {
    public static void main(String[] args) {
        SpringApplication.run(ErukaServerMain.class,args);
    }
}

解决方案2
如果以上方法不行那就,将pom文件带有数据库相关的删除,例如:jdbc、mysql-connect等等

你可能感兴趣的:(java)