# 问题

新项目搭建时,项目启不来,报了一个错。

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).

# 处理方式一:排除两个默认配置

排除两个默认配置

1
2
3
4
@SpringBootApplication(exclude={DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class})
public class Application {

}

结论:没用

# 处理方式二:可行

网上说各种多于的依赖导至的问题,通过 IDEA 查看 jar 依赖,确实是。
由 pagehelper 这个依赖引起的。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<!--<dependency>-->
<!--<groupId>org.hibernate</groupId>-->
<!--<artifactId>hibernate-validator</artifactId>-->
<!--<version>4.2.0.Final</version>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>org.mybatis.spring.boot</groupId>-->
<!--<artifactId>mybatis-spring-boot-starter</artifactId>-->
<!--<version>1.1.1</version>-->
<!--</dependency>-->

<!--pagehelper-->
<!--<dependency>-->
<!--<groupId>com.github.pagehelper</groupId>-->
<!--<artifactId>pagehelper-spring-boot-starter</artifactId>-->
<!--<version>1.1.2</version>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>mysql</groupId>-->
<!--<artifactId>mysql-connector-java</artifactId>-->
<!--<version>5.1.21</version>-->
<!--</dependency>-->

# 总结

程序启动类不需要排除任务一个类,只需要去除引用却可。