---
title: "acegi 方法拦截配置"
author: "east_java"
date: "2009-08-08T01:22:39Z"
tags: []
slug: "acegi"
draft: false
lastmod: "2009-08-08T01:22:39Z"
id: 442715
url: "https://japi.iteye.com/blog/442715"
---

最近在测试acegi的方法拦截时候，竟然发现不成功。
对于url的拦截是成功的。
acegi中
对于方法级的安全认证需要使用的拦截器为MethodSecurityInterceptor，而应用于URL资源的安全拦截器为FilterSecurityInterceptor   。其中，MethodSecurityInterceptor拦截器是借助于Spring   Aop实现的，而FilterSecurityInterceptor拦截器是借助于Servlet   Filter   实现的。

查看了下配置文件，竟然发现没有配置methodsecurityinterceptor的aop。
aop的配置可以看看<http://www.java1995.org/article/753.html>

proxyTargetClass属性的意义
<http://www.java1995.org/article/752.html>


```java
<bean id="autoProxyCreator"
		class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
		<!-- property name="proxyTargetClass" value="true" /-->
		<property name="beanNames">
			<list>
				<value>*Service</value>
			</list>
		</property>

		<property name="interceptorNames">
			<list>
				<value>methodSecurityInterceptor</value>
			</list>
		</property>
	</bean>
```