mirror of
https://gitee.com/nutz/nutzboot.git
synced 2024-11-30 02:38:28 +08:00
fix: uflo2如果没有定义EnvironmentProvider实现类,提醒用户
This commit is contained in:
parent
93c4802329
commit
bed8be9870
@ -3,11 +3,15 @@ package org.nutz.boot.starter.uflo;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.nutz.boot.AppContext;
|
||||
import org.nutz.ioc.Ioc;
|
||||
import org.nutz.log.Log;
|
||||
import org.nutz.log.Logs;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
|
||||
import com.bstek.uflo.env.EnvironmentProvider;
|
||||
|
||||
public class UfloEnvironmentProvider implements EnvironmentProvider {
|
||||
|
||||
private static final Log log = Logs.get();
|
||||
|
||||
protected SessionFactory sessionFactory;
|
||||
protected PlatformTransactionManager platformTransactionManager;
|
||||
@ -16,14 +20,14 @@ public class UfloEnvironmentProvider implements EnvironmentProvider {
|
||||
|
||||
public String getCategoryId() {
|
||||
checkOrigin();
|
||||
if (origin != null)
|
||||
if (origin != null && origin != this)
|
||||
return origin.getCategoryId();
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getLoginUser() {
|
||||
checkOrigin();
|
||||
if (origin != null)
|
||||
if (origin != null && origin != this)
|
||||
return origin.getLoginUser();
|
||||
return "anonymous";
|
||||
}
|
||||
@ -35,6 +39,9 @@ public class UfloEnvironmentProvider implements EnvironmentProvider {
|
||||
origin = ioc.get(EnvironmentProvider.class, "uflo.environmentProvider");
|
||||
}
|
||||
}
|
||||
if (origin == this) {
|
||||
log.warn("you have to define a class implements EnvironmentProvider and mask @IocBean(name='uflo.environmentProvider')");
|
||||
}
|
||||
}
|
||||
|
||||
public PlatformTransactionManager getPlatformTransactionManager() {
|
||||
|
Loading…
Reference in New Issue
Block a user