配置中 init-method 调用了一次,创建bean的时候调用无参构造调用了一次
<bean id="shiroFilter" class="MyShiroFilterFactoryBean" init-method="initMap()">
<property name="securityManager" ref="securityManager"></property>
<property name="unauthorizedUrl" value="/error/403.html"></property>
<property name="successUrl" value="/" />
<property name="loginUrl" value="/auth/login.html" />
</bean>
public class MyShiroFilterFactoryBean extends ShiroFilterFactoryBean {
MyShiroFilterFactoryBean(){
initMap();
}
void initMap(){
Map<String,String> map = new LinkedHashMap<>();
map.put("/error/**","anon");
map.put("/res/**","anon");
map.put("/index.html*","anon");
map.put("/auth/**","");
map.put("/auth/logout.html","logout");
}
}