Wrong namespace. Expected 'com.example.springboot.mapper.DepartmentMapper' but found 'com.sandystar.

Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Wrong namespace. Expected ‘com.example.springboot.mapper.DepartmentMapper’ but found ‘com.sandystar.jbaby.dao.DepartmentMapper’

Error creating bean with name ‘departmentController’: Unsatisfied dependency expressed through field ‘departmentService’; nested exception is org.springframework

1.这个就是mapper找不到正确的namespace。更改即可。如果这个错误,也有可能直接导致后面的找不到那个bean:“departmentController”。

2.还有就是如果找不到controller类 的bean,那么你就要
(1)在类上添加@Restcontroller

@RestController
@RequestMapping("/department")

@RequestMapping("/department") -->>这个呢,最好就添加一下,区别一下下面你实现对应功能的操作所要寻求的路径。个人觉得比较好
(2)在mapper类前添加

**@mapper**

(3)在实现类(例如:DepartmentServiceImpl)上添加

@Component("DepartmentServiceImpl")//spring的配置
@Service

(4),详情呢,请看下面的图片。

Wrong namespace. Expected 'com.example.springboot.mapper.DepartmentMapper' but found 'com.sandystar._第1张图片
(5)不懂的呢》请在评论区留下你的小脚脚吧!

你可能感兴趣的:(Wrong namespace. Expected 'com.example.springboot.mapper.DepartmentMapper' but found 'com.sandystar.)