@@ -0,0 +1,1480 @@
+package com.lance.shiro.config;%0A%0Aimport org.apache.shiro.cache.ehcache.EhCacheManager;%0Aimport org.apache.shiro.mgt.SecurityManager;%0Aimport org.apache.shiro.spring.LifecycleBeanPostProcessor;%0Aimport org.apache.shiro.spring.web.ShiroFilterFactoryBean;%0Aimport org.apache.shiro.web.mgt.DefaultWebSecurityManager;%0Aimport org.apache.shiro.web.session.mgt.DefaultWebSessionManager;%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.context.annotation.Bean;%0Aimport org.springframework.stereotype.Component;%0A%0A@Component%0Apublic class ShiroConfig %7B%0A%09@Autowired%0A%09private UserRealm userRealm;%0A%0A%09/**%0A%09 * @see org.apache.shiro.spring.web.ShiroFilterFactoryBean%0A%09 * @return%0A%09 */%0A%09@Bean%0A%09public ShiroFilterFactoryBean shiroFilterFactoryBean()%7B%0A%09%09ShiroFilterFactoryBean bean = new ShiroFilterFactoryBean();%0A%09%09bean.setLoginUrl(%22/login%22);%0A%09%09bean.setSecurityManager(securityManager());%0A%09%09return bean;%0A%09%7D%0A%09%0A%09/**%0A%09 * @see org.apache.shiro.mgt.SecurityManager%0A%09 * @return%0A%09 */%0A%09@Bean(name=%22securityManager%22)%0A%09public SecurityManager securityManager() %7B%0A%09%09DefaultWebSecurityManager manager = new DefaultWebSecurityManager();%0A%09%09manager.setRealm(userRealm);%0A%09%09manager.setCacheManager(new EhCacheManager());%0A%09%09manager.setSessionManager(new DefaultWebSessionManager());%0A%09%09return manager;%0A%09%7D%0A%09%0A%09/**%0A%09 * %E4%BF%9D%E8%AF%81%E5%AE%9E%E7%8E%B0%E4%BA%86Shiro%E5%86%85%E9%83%A8lifecycle%E5%87%BD%E6%95%B0%E7%9A%84bean%E6%89%A7%E8%A1%8C%0A%09 * @return%0A%09 */%0A%09@Bean%0A%09public LifecycleBeanPostProcessor lifecycleBeanPostProcessor() %7B%0A%09%09return new LifecycleBeanPostProcessor();%0A%09%7D%0A%7D

add shiro config bean