ServiceLoader
使用步骤
初始化ServiceLoader
1ServiceLoader.lazyInit();定义接口以及实现类,并添加@RouterService注解
1234public interface IEmvParamService {}true)(interfaces = IEmvParamService.class,key = ConfigServiceConstant.CONFIGSERVICE_EMVPARAM,singleton =public class EmvParamService implements IEmvParamService {}使用对应服务
1IEmvParamService service = Router.getService(IEmvParamService.class, ConfigServiceConstant.CONFIGSERVICE_EMVPARAM);