Springboot-mybatis创建项目报错day01

problem01

出现springboot引入mbatis-plus依赖单元测试时出现 Error:(3, 44) java: 程序包com.baomidou.mybatisplus.core.mapper不存在。

Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException:异常。

solution

Springboot-mybatis创建项目报错day01_第1张图片

点击右边侧栏Maven的Generate Sources and Update Folders For All Projects,为所有项目生成源和更新文件夹

problem02

There are test failures.
 
Please refer to F:\2-work\springboot\springboot_docker\target\surefire-reports for the individual test results.
Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.

 solution

Springboot-mybatis创建项目报错day01_第2张图片

忽略掉要执行的项目的test包

problem03

访问localhost:8090报错500

调用userservice.list()报错Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause

solution

Springboot-mybatis创建项目报错day01_第3张图片

可能是代码写错了,要检查是否添加了注解等

我这里是使用mapper接口的地方没有加 @Autowired

Springboot-mybatis创建项目报错day01_第4张图片

并且这里的datasource是数据库的名称

你可能感兴趣的:(spring,boot,mybatis,后端)