public interface ABCFactory {
DProvider createDProvider();
}
@Component
public class ABCFactoryImpl implements ABCFactory {
@Override
public DProvider createDProvider() {
Context Context = Holder.getContext();
if (loginContext == null) {
return new A();
}
if (Context.getType().isC()) {
return new C();
}
return new B();
}
}
设计模式-工厂模式
最新推荐文章于 2024-08-19 16:01:20 发布