我将以不同的方式问我之前的问题。我有一个具有多个实现的接口(2-3个类实现了相同的接口)。我想运行一个方法,谁能告诉我如何决定应该调用哪个方法。当我们引用接口时。
发布于 2016-04-21 17:58:17
我认为你应该试着在你的项目中考虑配置文件例如:-你有两个类
@Profile("dev")
class dev implement something{
}
@profile("live")
class live implement something{
}
---------------------------------
in your application context register the active profile to be picked
appcontext.getEnvironment().setActiveProfiles("live");
---------------------------------
using the active profile
public void doSomething(something somethin){
somethin.//yourmethod
}https://stackoverflow.com/questions/36765863
复制相似问题