I have 2 classes (B,C) extends class A.
@Service
public class A extends AbstratClass{
@Autowired
A(MyClass br) {
super(br);
Generally you will get this error when defined two beans with same class
if you address the above two line we have two beans with same class.
when you trying to autowire this class in any other classed you will get this type of error
You have two solutions
First Method
use qualifier by defining a bean id init like this
@Autowired
@Qualifier("a")
MyClass a;
@Autowired
@Qualifier("b")
MyClass b;
Second Method
use JSR250 api(its a jar file you can put into your class path
Then do autowriring like below
@Resource("a")
MyClass a
@Resource("b")
MyClass a