NutzCN Logo
问答 在使用nb中使用时发现Uflo中的UfloEnvironmentProvider类中的代码是不是有递归问题
发布于 2202天前 作者 lj7788 1343 次浏览 复制 上一个帖子 下一个帖子
标签:

在使用nb中使用时发现Uflo中的UfloEnvironmentProvider类中的代码是不是有递归问题
一直报错误

HTTP ERROR 500
Problem accessing /uflo/handlerlist. Reason:

    Server Error
Caused by:
java.lang.StackOverflowError
	at org.nutz.boot.starter.uflo.UfloEnvironmentProvider.checkOrigin(UfloEnvironmentProvider.java:32)
	at org.nutz.boot.starter.uflo.UfloEnvironmentProvider.getLoginUser(UfloEnvironmentProvider.java:25)
	at org.nutz.boot.starter.uflo.UfloEnvironmentProvider.getLoginUser(UfloEnvironmentProvider.java:27)
	at org.nutz.boot.starter.uflo.UfloEnvironmentProvider.getLoginUser(UfloEnvironmentProvider.java:27)
	at org.nutz.boot.starter.uflo.UfloEnvironmentProvider.getLoginUser(UfloEnvironmentProvider.java:27)
	at org.nutz.boot.starter.uflo.UfloEnvironmentProvider.getLoginUser(UfloEnvironmentProvider.java:27)
	at org.nutz.boot.starter.uflo.UfloEnvironmentProvider.getLoginUser(UfloEnvironmentProvider.java:27)
	at org.nutz.boot.starter.uflo.UfloEnvironmentProvider.getLoginUser(UfloEnvironmentProvider.java:27)
	at org.nutz.boot.starter.uflo.UfloEnvironmentProvider.getLoginUser(UfloEnvironmentProvider.java:27)

代码如下

    public String getCategoryId() {
        this.checkOrigin();
        return this.origin != null ? this.origin.getCategoryId() : null;
    }

    public String getLoginUser() {
        this.checkOrigin();
        return this.origin != null ? this.origin.getLoginUser() : "anonymous";//应该是在这里递归了
    }

    protected void checkOrigin() {
        if (this.ioc == null) {
            this.ioc = AppContext.getDefault().getIoc();
            if (this.ioc.has("uflo.environmentProvider")) {
                this.origin = (EnvironmentProvider)this.ioc.get(EnvironmentProvider.class, "uflo.environmentProvider");
            }
        }

    }
2 回复

额,改改?

来自炫酷的 NutzCN

nutz的Bean怎么注解为spring的Bean呢?
下面写法行不?

@IocBean(name = "test1EndHandler")
@AsSpringBean
public class Test1EndHandler implements NodeEventHandler {
    @Override
    public void enter(Node node, ProcessInstance processInstance, Context context) {

    }

    @Override
    public void leave(Node node, ProcessInstance processInstance, Context context) {

    }
}

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