I have:
interface I { someMethod(); }
class A implements I { someMethod(){} }
class B implements I { someMethod(){} }
In some class i want to do:
class Logic {
I obj;
run(boolean x){
if(x){
obj = new A();
} else {
obj = new B();
}
obj.someMethod();
}
I can do this easily with plain
Java but, i how to do using spring?
Before that, is there any design problem with that code?