当使用 JRebel 时,启动项目后自动清理缓存

This commit is contained in:
thinkgem
2019-07-15 14:12:34 +08:00
parent 7919ede2f0
commit ae06748457

View File

@@ -1,5 +1,7 @@
package com.jeesite.modules.sys.web;
import javax.annotation.PostConstruct;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -7,6 +9,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import com.jeesite.common.cache.CacheUtils;
import com.jeesite.common.config.Global;
import com.jeesite.common.lang.StringUtils;
import com.jeesite.common.web.BaseController;
import com.jeesite.modules.sys.utils.UserUtils;
@@ -32,5 +35,14 @@ public class CacheController extends BaseController {
Global.clearCache();
return renderResult(Global.TRUE, "清理缓存成功!");
}
@PostConstruct
public void postConstruct(){
String rebel = System.getProperty("rebel.base");
if (StringUtils.isNotBlank(rebel)){
logger.debug("JRebel: 清理系统缓存...");
CacheUtils.clearCache();
}
}
}