org.nutz.ioc.Ioc.getByType()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(151)

本文整理了Java中org.nutz.ioc.Ioc.getByType()方法的一些代码示例,展示了Ioc.getByType()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ioc.getByType()方法的具体详情如下:
包路径:org.nutz.ioc.Ioc
类名称:Ioc
方法名:getByType

Ioc.getByType介绍

暂无

代码示例

代码示例来源:origin: nutzam/nutz

public Object getByType(Ioc ioc, IocContext ctx) {
    if (ioc instanceof Ioc2)
      return ((Ioc2)ioc).getByType(type, ctx);
    else
      return ioc.getByType(type);
  }
}

代码示例来源:origin: nutzam/nutz

return ((Ioc2)ioc).getByType(type, ctx);
else
  return ioc.getByType(type);

代码示例来源:origin: org.nutz/nutz

public Object getByType(Ioc ioc, IocContext ctx) {
    if (ioc instanceof Ioc2)
      return ((Ioc2)ioc).getByType(type, ctx);
    else
      return ioc.getByType(type);
  }
}

代码示例来源:origin: nutzam/nutzboot

public void init() {
    if (appContext != null) {
      log.debug("PreventDuplicateSubmitStarter init ....");
      try {
        PreventDuplicateSubmitProcessor.redisService = appContext.getIoc().getByType(RedisService.class);
      } catch (Exception e) {
        log.debug("PreventDuplicateSubmitStarter 没有开启Redis采用,将采用session存储");
        //如果没有开启Redis就采用session存储,忽略错误
      }
    }
  }
}

代码示例来源:origin: nutzam/nutzboot

protected Object createTest() throws Exception {
  if (hasIocBean)
    return getIoc().get(getTestClass().getJavaClass());
  Object obj = getTestClass().getJavaClass().newInstance();
  for (Field field : fields) {
    field.set(obj, getIoc().getByType(field.getType()));
  }
  return obj;
}

代码示例来源:origin: nutzam/nutzboot

public void start() throws Exception {
    // 从ioc容器中找出所有实现了IJobHandler接口的对象,注册到XxlJobExecutor
    for (IJobHandler jobHandler : appContext.getBeans(IJobHandler.class)) {
      // 看看有没有@JobHandler注解
      JobHandler annoJobHandler = jobHandler.getClass().getAnnotation(JobHandler.class);
      // 得到jobHandlerName
      String jobHandlerName = jobHandler.getClass().getSimpleName();
      if (annoJobHandler != null && !Strings.isBlank(annoJobHandler.value()))
        jobHandlerName = annoJobHandler.value();
      // 注册到XxlJobExecutor上下文
      XxlJobExecutor.registJobHandler(jobHandlerName, jobHandler);
    }
    // 获取XxlJobExecutor,从而触发XxlJobExecutor的初始化
    appContext.getIoc().getByType(XxlJobExecutor.class);
  }
}

代码示例来源:origin: nutzam/nutzboot

public void start() throws Exception {
  log.debug("init AioServer ...");
  tioServer = appContext.getIoc().getByType(TioServer.class);
  String ip = appContext.getServerHost(PROP_IP);
  int port = appContext.getServerPort(PROP_PORT, 9420);
  tioServer.start(ip, port);
}

代码示例来源:origin: org.nutz/nutz

return ((Ioc2)ioc).getByType(type, ctx);
else
  return ioc.getByType(type);

相关文章

微信公众号

最新文章

更多