合并 PostConstruct
This commit is contained in:
@@ -49,16 +49,6 @@ public class EmpUserServiceSupport extends CrudService<EmpUserDao, EmpUser>
|
|||||||
this.employeeService = employeeService;
|
this.employeeService = employeeService;
|
||||||
this.employeeOfficeDao = employeeOfficeDao;
|
this.employeeOfficeDao = employeeOfficeDao;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 租户功能验证
|
|
||||||
*/
|
|
||||||
@PostConstruct
|
|
||||||
private void corpModelValid() throws Exception{
|
|
||||||
if (!Global.isUseCorpModel().equals(Global.getPropertyToBoolean("user.useCorpModel", "false"))){
|
|
||||||
throw new Exception("\n\nuser.useCorpModel=true? 你开启了多租户模式,似乎你的当前版本不是JeeSite专业版。\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取单条数据
|
* 获取单条数据
|
||||||
|
|||||||
@@ -1,20 +1,19 @@
|
|||||||
package com.jeesite.modules.sys.web;
|
package com.jeesite.modules.sys.web;
|
||||||
|
|
||||||
import jakarta.annotation.PostConstruct;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import org.apache.shiro.authz.annotation.Logical;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
|
|
||||||
import com.jeesite.common.cache.CacheUtils;
|
import com.jeesite.common.cache.CacheUtils;
|
||||||
import com.jeesite.common.config.Global;
|
import com.jeesite.common.config.Global;
|
||||||
import com.jeesite.common.lang.StringUtils;
|
import com.jeesite.common.lang.StringUtils;
|
||||||
import com.jeesite.common.mybatis.mapper.MapperHelper;
|
import com.jeesite.common.mybatis.mapper.MapperHelper;
|
||||||
import com.jeesite.common.web.BaseController;
|
import com.jeesite.common.web.BaseController;
|
||||||
import com.jeesite.modules.sys.utils.UserUtils;
|
import com.jeesite.modules.sys.utils.UserUtils;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.annotation.PostConstruct;
|
||||||
|
import org.apache.shiro.authz.annotation.Logical;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 缓存管理
|
* 缓存管理
|
||||||
@@ -22,6 +21,7 @@ import com.jeesite.modules.sys.utils.UserUtils;
|
|||||||
* @version 20167-8-27
|
* @version 20167-8-27
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
|
@Lazy(false)
|
||||||
@Tag(name = "Cache - 缓存管理")
|
@Tag(name = "Cache - 缓存管理")
|
||||||
@RequestMapping(value = "${adminPath}/sys/cache")
|
@RequestMapping(value = "${adminPath}/sys/cache")
|
||||||
public class CacheController extends BaseController {
|
public class CacheController extends BaseController {
|
||||||
@@ -39,15 +39,19 @@ public class CacheController extends BaseController {
|
|||||||
UserUtils.clearCache();
|
UserUtils.clearCache();
|
||||||
return renderResult(Global.TRUE, text("清理缓存成功"));
|
return renderResult(Global.TRUE, text("清理缓存成功"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void postConstruct(){
|
public void postConstruct() throws Exception {
|
||||||
String rebel = System.getProperty("rebel.base");
|
// 如果使用了 JRebel 插件,则清理缓存
|
||||||
if (StringUtils.isNotBlank(rebel) && Global
|
if (StringUtils.isNotBlank(System.getProperty("rebel.base")) && Global.getPropertyToBoolean("spring.cache.isClusterMode", "false")){
|
||||||
.getPropertyToBoolean("spring.cache.isClusterMode", "false")){
|
|
||||||
logger.info("JRebel: Cache clear...");
|
logger.info("JRebel: Cache clear...");
|
||||||
CacheUtils.clearCache();
|
CacheUtils.clearCache();
|
||||||
}
|
}
|
||||||
|
// 则开启了租户参数,但无法使用,则给予提示
|
||||||
|
if (!Global.isUseCorpModel().equals(Global.getPropertyToBoolean("user.useCorpModel", "false"))){
|
||||||
|
throw new Exception("\n\nuser.useCorpModel=true? 你开启了多租户模式,似乎你的当前版本不是JeeSite专业版。\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user