设置缓存

This commit is contained in:
fjy8018@qq.com
2018-07-06 16:11:34 +08:00
parent 399cdbeab1
commit 80309d4ee5

View File

@@ -1,5 +1,6 @@
package top.fjy8018.shiro.config;
import org.apache.shiro.cache.MemoryConstrainedCacheManager;
import org.apache.shiro.mgt.SecurityManager;
import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor;
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
@@ -72,6 +73,10 @@ public class ShiroConfiguration {
@Bean("authRealm")
public AuthRealm authRealm(@Qualifier("credentialsMatcher") CredentialsMatcher matcher) {
AuthRealm authRealm = new AuthRealm();
// 设置缓存,内存缓存
authRealm.setCacheManager(new MemoryConstrainedCacheManager());
authRealm.setCredentialsMatcher(matcher);
return authRealm;
}