lundi 23 février 2015

Choose implementation at load time

I use spring 3.2.13.RELEASE. I have a boolean properties in a properties file to activate a version or another.


And I Have the following bean:



public interface VersionBean{
void doSomething();
}

public class FirstVersionBean implements VersionBean{
}

public class SecondVersionBean implements VersionBean{
}

public class Service{
private VersionBean versionBean;
}


Is it possible to inject the firstVersionBean if my boolean is true and if false use secondVersionBean?


Aucun commentaire:

Enregistrer un commentaire