package cn.itcast.ssm.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import cn.itcast.ssm.shiro.CustomRealm;
@Controller
public class ClearShiroCache {
//注入realm
private CustomRealm customRealm;
@RequestMapping("/clearShiroCache")
public String clearShiroCache(){
//清除缓存,将来正常开发要在service调用customRealm.clearCached()
customRealm.clearCached();
return "success";
}
}
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import cn.itcast.ssm.shiro.CustomRealm;
@Controller
public class ClearShiroCache {
//注入realm
private CustomRealm customRealm;
@RequestMapping("/clearShiroCache")
public String clearShiroCache(){
//清除缓存,将来正常开发要在service调用customRealm.clearCached()
customRealm.clearCached();
return "success";
}
}