启动springboot时候报错,错误内容为:
org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driverclassfordatabase type NONE. If you want an embedded database pleaseputa supported oneontheclasspath. If you have database settingstobe loadedfroma particular profile you may needtoactiveit(no profiles are currently active).
错误原因:
不知道使用什么数据库,需要在pom.xml标注使用什么数据库,如h2
解决思路:
1.修改pom.xml
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
2.在@SpringBootApplication中排除其注入
@SpringBootApplication(exclude={DataSourceAutoConfiguration.class,HibernateJpaAutoConfiguration.class})
网友评论