原因
在pom.xml中配置了jdbc依赖却没有配置数据源:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
解决
一:启动类中加入注解:@SpringBootApplication(exclude={DataSourceAutoConfiguration.class,HibernateJpaAutoConfiguration.class})
二:新建一个Application.properties文件,配置好数据源即可