@Service注解是标注在实现类上的
因为@Service是把spring容器中的bean进行实例化,也就是等同于new操作,只有实现类是可以进行new实例化的,而接口则不能,所以是加在实现类上的。
@Autowired CombineDataOADService combineDataOADService;
相当于
(多态,狗=new 金毛())
@Autowired
CombineDataOADService combineDataOADService = new CombineDataOADServiceImplA();
或者
(多态,狗=new 二哈())
@Autowired
CombineDataOADService combineDataOADService = new CombineDataOADServiceImplB();
可以随意切换实现类金毛或者二哈,而不用改代码,起到解耦的作用.