I have two spring bean classes which are implemeting the same interface.
public interface Abc()
{
String getNumber();
}
The two classes are
@Service
public class SomeClass implements abc
{
@Override
public class getNumber()
{
}
}
@Service
public class SomeClass1 implements abc
{
@Override
public class getNumber()
{
}
}
In my Service class.
@Service
public class Demo
{
@Autowired
private Abc abc;
}
}
I got an error "required a single bean, but 2 were found"
For that error i can have the chance to put @Primary in the top of one of the bean.
But i have only way to say "one bean configuration" based on the value which i will get in runtime(From the database).
Can you please suggest me a way.