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