当使用 JRebel 时,启动项目后自动清理缓存
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
package com.jeesite.modules.sys.web;
|
package com.jeesite.modules.sys.web;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
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.cache.CacheUtils;
|
||||||
import com.jeesite.common.config.Global;
|
import com.jeesite.common.config.Global;
|
||||||
|
import com.jeesite.common.lang.StringUtils;
|
||||||
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;
|
||||||
|
|
||||||
@@ -33,4 +36,13 @@ public class CacheController extends BaseController {
|
|||||||
return renderResult(Global.TRUE, "清理缓存成功!");
|
return renderResult(Global.TRUE, "清理缓存成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void postConstruct(){
|
||||||
|
String rebel = System.getProperty("rebel.base");
|
||||||
|
if (StringUtils.isNotBlank(rebel)){
|
||||||
|
logger.debug("JRebel: 清理系统缓存...");
|
||||||
|
CacheUtils.clearCache();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user