记录一次springboot+mybatis一直报bean无法注入的错误
首先是controller层代码
@RestController
public class DepartmentController {
@Autowired
private DepartmentDao departmentDao;
@Autowired
private EmployeeDao employeeDao;
@GetMapping("/getDepartment/{id}")
public Department getDepartment(@PathVariable("id") Integer id){
return departmentDao.getDepartment(id);
}
@GetMapping("/getEmployee/{id}")
public Employee getEmployee(@PathVariable("id") Integer id){
return employeeDao.getEmployee(id);
}
}
因为只是一个简单的demo,所以直接跳的dao层,错误来了!
@Repository
public interface DepartmentDao {
@Select("select * from department where id =#{id}")
Department getDepartment(Integer id);
}
按道理说,dao层上加了@Repositor