Tag Archives: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘com.southwind.mmall002.service.Impl.ProductCategoryServiceImplTest’:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘com.southwind.mmall002.service.Impl.ProductCategoryServiceImplTest’:

 

  org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘com.southwind.mmall002.service.Impl.ProductCategoryServiceImplTest’: Unsatisfied dependency expressed through field ‘service’; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type ‘com.southwind.mmall002.service.ProductCategoryService’ available: expected single matching bean but found 2: ProductCategoryService,productCategoryService

When using the test class for testing, the above error reports occur. The general meaning is that there is an interface and an implementation class in the service. The spring container does not know which one to use. Here, I solved the error by adding @ qualifier (“productcategoryservice”) annotation to the injection class and adding @ service (“productcategoryservice”) to the serviceimpl class. As shown below