使用了spring security之后,网页的显示速度明显变慢,看来spring security的使用还是需要优化配置的。 ...

在引入Spring Security后,发现网页加载速度显著下降。本文探讨如何通过调整Spring Security的配置,如过滤器、访问决策管理器和拦截URL策略,来优化性能,解决速度变慢的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

使用了spring security之后,网页的显示速度明显变慢,看来spring security的使用还是需要优化配置的。  
 
 
 
在web.xml中配置  
 
 
 
 <!--  配置spring acegi 使用的  和com.work.core.QxglConstants.USE_ACEGI=true 配合使用  
 
 <filter> 
 
  <filter-name>springSecurityFilterChain</filter-name> 
 
  <filter-class> 
 
   org.springframework.web.filter.DelegatingFilterProxy  
 
  </filter-class> 
 
 </filter> 
 
 
 
 <filter-mapping> 
 
  <filter-name>springSecurityFilterChain</filter-name> 
 
  <url-pattern>/*</url-pattern> 
 
 </filter-mapping> 
 
 
 
 <listener> 
 
 
 
 <listener> 
 
  <listener-class> 
 
   org.springframework.web.context.ContextLoaderListener  
 
  </listener-class> 
 
 </listener> 
 
  <listener-class> 
 
   org.springframework.security.ui.session.HttpSessionEventPublisher  
 
  </listener-class> 
 
 </listener> 
 
 --> 
 
 
 
然后配置applicationContext-spring-security-2.0.2.xml  
 
 
 
<?xml version="1.0" encoding="UTF-8"?> 
 
<beans:beans xmlns="http://www.springframework.org/schema/security
 
 xmlns:beans="http://www.springframework.org/schema/beans
 
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
 
 xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.xsd"> 
 
    
 
 <authentication-manager alias="authenticationManager" /> 
 
 <beans:bean id="accessDecisionManager" 
 
  class="org.springframework.security.vote.AffirmativeBased"> 
 
  <beans:property name="allowIfAllAbstainDecisions" value="false" /><!-- allowIfAllAbstainDecisions : 设定是否允许:“没人反对就通过”的投票策略 --> 
 
  <beans:property name="decisionVoters"><!-- 定义投票者 --> 
 
   <beans:list> 
 
    <beans:bean class="org.springframework.security.vote.RoleVoter" /> 
 
    <beans:bean class="org.springframework.security.vote.AuthenticatedVoter" /> 
 
   </beans:list> 
 
  </beans:property> 
 
 </beans:bean> 
 
 <beans:bean id="filterInvocationInterceptor" 
 
  class="org.springframework.security.intercept.web.FilterSecurityInterceptor"> 
 
  <!--  配置上之后secureResourceFilter 没有被执行!不知道其他朋友们有没有碰到这个问题。如果也碰到了,请问您是如何解决的?--> 
 
  <beans:property name="a

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值