Spring Boot 框架下的 maven项目 ,启动错误:Error starting ApplicationContext. To display the conditions report re-run your
启动时出现了上图的错误.
原因1:
1、未在配置文件中配置相关的数据源连接。
2、未能配置数据源:未指定“url”属性,无法配置嵌入的数据源。
3、无法确定合适的驱动程序类
解决方法:
我的是maven项目。
在配置文件application.yml 中配置数据库的数据源环境,让驱动器可以找到数据源。
启动成功:
原因2:
我的项目是因为用到了mybatis-plus,而没有在pom.xml 配置文件中导入依赖
解决方法:
在pom.xml 配置文件中导入 mybatis-plus 依赖
<!--引入 mybatis-plus 数据源-->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
</dependency>
重新刷新maven,之后启动成功。