问题描述:
***************************
APPLICATION FAILED TO START
***************************
Description:
Field deptService in com.kangning.web.controller.system.SysDeptController required a bean of type 'com.kangning.system.service.ISysDeptService' that could not be found.
The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)
Action:
Consider defining a bean of type 'com.kangning.system.service.ISysDeptService' in your configuration.
这个问题大概的意思是项目启动过程中,没有找到对应bean的实例,导致项目启动失败
解决办法:
1、在业务逻辑层中,类的实例化需要在实现类上添加@Service实例化该类,代码如下
2、在数据访问层,经常用到@Component、@Mapper对接口实现解析并实例化
3、控制器层,大家有时称它为Controller层即控制器层,在该类上经常用到@RestController注解相当于@Controller和@ResponseBody注解的组合,表示该类是一个控制器,使得控制器方法返回的对象会自动通过消息转换器(如Jackson)转换为JSON或XML格式,并写入HTTP响应体中。适用于创建Restful API的控制器类。
总结,对于上述我描述的问题,直接使用业务逻辑层中的@Service即可解决。