No qualifying bean of type [com.it.service.DeptService] found for dependency

今天出现了这样一个错误,弄了好久,意思就是我的'deptEmpController没有deptsv依赖,找了好半天,终于找到了原因。

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'deptEmpController': Unsatisfied dependency expressed through field 'deptsv': No qualifying bean of type [com.it.service.DeptService] found for dependency [com.it.service.DeptService]: expected at least 1 bean which qualifies as autowire candidate for this dependency. 


Spring管理service(通过xml读取service,利用反射创建实例),controller的时候,由于Controller里面注入了service,但实际并没有找到service的实例化,慢慢找到原来在applicationContext-Service.xml中,没有配置我所注入service,所以没有办法实例化,导致出错


错误的配置(只配置了一个)

applicationContext-Service.xml:

 


正确的配置

applicationContext-Service.xml:

 

 







你可能感兴趣的:(ssh配置文件错误)