1.微服务工厂类
This commit is contained in:
parent
d93069b4a0
commit
498c6a4d4e
|
|
@ -0,0 +1,24 @@
|
||||||
|
package tqq9.lc123.cloud.app.eip.iscb;
|
||||||
|
|
||||||
|
import kd.bos.dataentity.TypesContainer;
|
||||||
|
import kd.bos.dataentity.resource.ResManager;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class ServiceFactory {
|
||||||
|
private static Map<String, String> serviceMap = new HashMap<>();
|
||||||
|
|
||||||
|
static {
|
||||||
|
serviceMap.put("LCLogService","tqq9.lc123.cloud.app.eip.iscb.impl.LCLogServiceImpl");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Object getService(String serviceName) {
|
||||||
|
String className = serviceMap.get(serviceName);
|
||||||
|
if (className == null) {
|
||||||
|
throw new RuntimeException(String.format(
|
||||||
|
ResManager.loadKDString("%s对应的服务实现未找到", "ServiceFactory_0", "bos-ecos-mservice"), serviceName));
|
||||||
|
}
|
||||||
|
return TypesContainer.getOrRegisterSingletonInstance(className);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue