NutzCN Logo
问答 Nutz 动作链Processor里怎么注入Bean
发布于 2020天前 作者 FirstXiaoMaGe 1731 次浏览 复制 上一个帖子 下一个帖子
标签: nutzwk

动作链配置如下:

var chain={
  "default": {
    "ps": [
      "cn.wizzer.app.web.commons.processor.LogTimeProcessor",
      "cn.wizzer.app.web.commons.processor.GlobalsSettingProcessor",
      "org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor",
      "org.nutz.mvc.impl.processor.EncodingProcessor",
      "org.nutz.mvc.impl.processor.ModuleProcessor",
      "cn.wizzer.app.web.commons.processor.NutShiroProcessor",
      "cn.wizzer.app.web.commons.processor.XssSqlFilterProcessor",
      "org.nutz.mvc.impl.processor.ActionFiltersProcessor",
      "org.nutz.mvc.impl.processor.AdaptorProcessor",
      "org.nutz.mvc.impl.processor.MethodInvokeProcessor",
      "org.nutz.mvc.impl.processor.ViewProcessor"
    ],
    "error": 'org.nutz.mvc.impl.processor.FailProcessor'
  }
};
public class NutShiroProcessor extends AbstractProcessor {

    protected NutShiroMethodInterceptor interceptor;

    @Inject
    protected WeixinUserService weixinUserService;

注入失败,要怎么处理

2 回复

不建议用注入,覆盖init方法,ai参数能得到ioc容器对象,从ioc容器取想要的服务,然后放入实例变量

如果的确要注入,配置文件里面写ioc:类名(首字母小写),不写类全名,文档有介绍

添加回复
请先登陆
回到顶部