NutzCN Logo
问答 NB使用uflo的问题
发布于 2129天前 作者 shuxinyun 1877 次浏览 复制 上一个帖子 下一个帖子
标签:

我引入了starter-uflo,运行没有问题,也实现了如下类

import org.hibernate.SessionFactory;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.springframework.transaction.PlatformTransactionManager;

import com.bstek.uflo.env.EnvironmentProvider;

@IocBean(name="uflo.environmentProvider")
public class EpeiEnvironmentProvider implements EnvironmentProvider {
    
    // uflo所需要的东西, 是spring注入的
    protected SessionFactory sessionFactory;
    protected PlatformTransactionManager platformTransactionManager;

    // nutz的注解可以生效
    @Inject
    protected Dao dao;

    public String getCategoryId() {
        return null;
    }

    public String getLoginUser() {
        return "anonymous"; // TODO 通过shiro获取用户名?
    }

    // 后面的是固定方法, 不要动!
    public PlatformTransactionManager getPlatformTransactionManager() {
        return platformTransactionManager;
    }

    public void setPlatformTransactionManager(PlatformTransactionManager platformTransactionManager) {
        this.platformTransactionManager = platformTransactionManager;
    }

    public SessionFactory getSessionFactory() {
        return sessionFactory;
    }

    public void setSessionFactory(SessionFactory sessionFactory) {
        this.sessionFactory = sessionFactory;
    }
}

但是在新增流程,选择bean的时候,弹出警告提示:

12:40:50.170 DEBUG (LCache.java:96) fire - fire channel=LCache:shiro-activeSessionCache msg=qe39op2va4h6vrtcha7gbo4pvf:osql8ea12ehf6rg1ph440h83cj
12:40:50.518 DEBUG (CachePubSub.java:15) onPMessage - channel=LCache:shiro-activeSessionCache, msg=qe39op2va4h6vrtcha7gbo4pvf:osql8ea12ehf6rg1ph440h83cj
12:40:58.831 DEBUG (NutIoc.java:166) get - Get 'uflo.environmentProvider'<interface com.bstek.uflo.env.EnvironmentProvider>
12:40:58.847 DEBUG (NutIoc.java:192) get - 	 >> Load definition name=uflo.environmentProvider
12:40:58.847 DEBUG (AbstractBeanFactory.java:251) doGetBean - Returning cached instance of singleton bean 'uflo.environmentProvider'
12:40:58.847 DEBUG (ComboIocLoader.java:226) printFoundIocBean - Found IocObject(uflo.environmentProvider) in SpringIocLoader2@1040879617
12:40:58.847 DEBUG (NutIoc.java:223) get - 	 >> Make...'uflo.environmentProvider'<interface com.bstek.uflo.env.EnvironmentProvider>
12:40:58.847 DEBUG (ScopeContext.java:65) save - Save object 'uflo.environmentProvider' to [app] 
12:40:58.847 DEBUG (DefaultMirrorFactory.java:76) getMirror - Load class org.nutz.boot.starter.uflo.UfloEnvironmentProvider without AOP
12:44:11.524 WARN  (UfloEnvironmentProvider.java:43) checkOrigin - you have to define a class implements EnvironmentProvider and mask @IocBean(name='uflo.environmentProvider')

debug跟踪发现,确实不是自定义的实现类【uflo.environmentProvider】,我这里是不是哪儿出现问题,请帮忙指导下!

2 回复

把demo跑一下看看

我的问题,starter没有初始化,已经重新引入解决问题

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