hibernate openSessionInViewerFilter与shiro shiroFilter在web.xml中的配置顺序问题

应把openSessionInViewerFilter配置放到shiroFilter前边,要不然就没法在自定义releam中使用延迟加载策略,会抛异常could not initialize proxy - no Session

配置:
	<filter>
		<filter-name>openSessionInViewerFilter</filter-name>
		<filter-class>org.springframework.orm.hibernate4.support.OpenSessionInViewFilter</filter-class>
	</filter>
	<filter-mapping>
		<filter-name>openSessionInViewerFilter</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>
	
    <filter>  
        <filter-name>shiroFilter</filter-name>  
        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>  
        <init-param>
            <param-name>targetFilterLifecycle</param-name>  
            <param-value>true</param-value>  
        </init-param>  
    </filter>  
    <filter-mapping>  
        <filter-name>shiroFilter</filter-name>  
        <url-pattern>/*</url-pattern>  
    </filter-mapping>

你可能感兴趣的:(hibernate shiro)