java - No unique bean of type exception. Issues with autowiring inherited classes -


i new java code , had exception autowiring service interface.

i have classes , b. b extends , each class has own services.

@service @qualifier("aservice") public interface aservice {     //some methods }  @service @qualifier("bservice") public interface bservice {     //some methods } 

i using these interfaces in classes, , have put annotation @qualifer.

public class test() {      @autowired     @qualifier("aservice") private aservice aservice;      @autowired     @qualifier("bservice") private bservice bservice;      //some code } 

but keep getting exception :

no unique bean of type [com.analysis.dw.aservice] defined : unsatisfied dependency of type [interface com.analysis.dw.aservice]: expected @ least 1 matching bean 

thanks in advance :)

use annotations on class, not interface!

@service @qualifier("aservice") public class aserviceimpl implements aservice {     //some methods } 

spring not instantiate interface.


Comments