- 浏览: 266547 次
- 性别:
- 来自: 北京
最新评论
-
zwb5370:
为什么 Java 的 cron 规则的 周规则和 linux ...
Quartz的cron表达式 -
zjhdreams:
没说说明L W C,L C #,每个字符的含义呢?补充
Quartz的cron表达式 -
qq359907964:
呵呵,没问题了,能正常运行..
Quartz的cron表达式 -
dongcb678:
biaoming 写道看了一下文档,compass已经提供很方 ...
Compass怎样在指定alias中搜索 -
anttribe:
请问博主,源呢?你是使用哪个源? 怎么还有内核的源?我杂没找到 ...
Debian升级内核
一直使用spring2.x都没有问题,所有service都通过AOP注入。
现在用acegi的ACL,却发现原来的AOP影响而不能使用。以下是我的AOP
<!-- Transactional advice -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<!-- methods starting with 'save', 'update' or 'remove' use the default transaction settings -->
<tx:method name="save*"/>
<tx:method name="delete*"/>
<tx:method name="merge*"/>
<tx:method name="remove*"/>
<!-- other methods are set to read only -->
<tx:method name="*" read-only="true"/>
</tx:attributes>
</tx:advice>
<aop:config proxy-target-class="true">
<aop:advisor pointcut="execution(* cn.biaoming.service..*Service.*(..))" advice-ref="txAdvice"/>
</aop:config>
而TransactionInterceptor是这么定义的:
<bean id="articleService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces" value="cn.biaoming.service.ArticleService"/>
<property name="target"><ref local="articleServiceTager"/></property>
<property name="interceptorNames">
<list>
<idref local="articleServiceSecurity"/>
</list>
</property>
</bean>
<bean id="articleServiceSecurity" class="org.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor">
<property name="authenticationManager"><ref bean="authenticationManager"/></property>
<property name="accessDecisionManager"><ref local="businessAccessDecisionManager"/></property>
<property name="afterInvocationManager"><ref local="afterInvocationManager"/></property>
<property name="objectDefinitionSource">
<value>
</value>
</property>
</bean>
现在只要把spring2.x 的AOP去掉,TransactionInterceptor就能正常工作,要不就报以下错误
WARN Cglib2AopProxy.doValidateClass(250) | Unable to proxy method [public final java.util.List $Proxy29.getLatestArticle(java.lang.String,int)] because it is final: All calls to this method via a proxy will be routed directly to the proxy.
现在用acegi的ACL,却发现原来的AOP影响而不能使用。以下是我的AOP
<!-- Transactional advice -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<!-- methods starting with 'save', 'update' or 'remove' use the default transaction settings -->
<tx:method name="save*"/>
<tx:method name="delete*"/>
<tx:method name="merge*"/>
<tx:method name="remove*"/>
<!-- other methods are set to read only -->
<tx:method name="*" read-only="true"/>
</tx:attributes>
</tx:advice>
<aop:config proxy-target-class="true">
<aop:advisor pointcut="execution(* cn.biaoming.service..*Service.*(..))" advice-ref="txAdvice"/>
</aop:config>
而TransactionInterceptor是这么定义的:
<bean id="articleService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces" value="cn.biaoming.service.ArticleService"/>
<property name="target"><ref local="articleServiceTager"/></property>
<property name="interceptorNames">
<list>
<idref local="articleServiceSecurity"/>
</list>
</property>
</bean>
<bean id="articleServiceSecurity" class="org.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor">
<property name="authenticationManager"><ref bean="authenticationManager"/></property>
<property name="accessDecisionManager"><ref local="businessAccessDecisionManager"/></property>
<property name="afterInvocationManager"><ref local="afterInvocationManager"/></property>
<property name="objectDefinitionSource">
<value>
</value>
</property>
</bean>
现在只要把spring2.x 的AOP去掉,TransactionInterceptor就能正常工作,要不就报以下错误
WARN Cglib2AopProxy.doValidateClass(250) | Unable to proxy method [public final java.util.List $Proxy29.getLatestArticle(java.lang.String,int)] because it is final: All calls to this method via a proxy will be routed directly to the proxy.
评论
11 楼
imp9527
2008-03-29
一个类只能被代理一次 acegi 配置你已经代理一次了 或者是你在事物代理的时候
SPRING在做代理的时候 已经指出 代理后的类是 FINAL 了·
用SPRING2.0的方式去配置代理 与AOP 应该可以解决问题
SPRING在做代理的时候 已经指出 代理后的类是 FINAL 了·
用SPRING2.0的方式去配置代理 与AOP 应该可以解决问题
10 楼
biaoming
2008-03-15
已经找到解决的办法。
<aop:config proxy-target-class="true">
<aop:pointcut id="idempotentOperation1"
expression="execution(* cn.biaoming.service.ArticleService.*(..))" />
<aop:advisor pointcut-ref="idempotentOperation1"
advice-ref="articleServiceSecurity" />
</aop:config>
<aop:config proxy-target-class="true">
<aop:pointcut id="idempotentOperation1"
expression="execution(* cn.biaoming.service.ArticleService.*(..))" />
<aop:advisor pointcut-ref="idempotentOperation1"
advice-ref="articleServiceSecurity" />
</aop:config>
9 楼
biaoming
2008-03-13
没有有知道了吗?
8 楼
biaoming
2008-03-12
a_method_of_articleServiceSecurity这个是articleService的方法,还是articleServiceSecurity的方法呢?如果是articleServiceSecurity,那和objectDefinitionSource定义的拦截方法有冲突吗?
7 楼
movingboy
2008-03-11
兄弟,a_method_of_articleServiceSecurity的意思就是“articleServiceSecurity的一个方法”,你得把它替换成实际的方法呀
6 楼
biaoming
2008-03-11
我试了,在启动tomcat 报以下错误
java.lang.IllegalArgumentException: Unable to locate method [a_method_of_articleServiceSecurity] on bean [articleServiceSecurity]
at org.springframework.aop.config.MethodLocatingFactoryBean.setBeanFactory(MethodLocatingFactoryBean.java:75)
java.lang.IllegalArgumentException: Unable to locate method [a_method_of_articleServiceSecurity] on bean [articleServiceSecurity]
at org.springframework.aop.config.MethodLocatingFactoryBean.setBeanFactory(MethodLocatingFactoryBean.java:75)
5 楼
movingboy
2008-03-11
其实我只是给出了一种声明的方法,看看是否适合你的情况;声明的内容是否正确就不一定了,可能你得多尝试尝试。
就你在帖子里提到的内容来看,估计需要HibernateSession的地方还是要注入。只是估计,最终得以你试验后的结果为准......
就你在帖子里提到的内容来看,估计需要HibernateSession的地方还是要注入。只是估计,最终得以你试验后的结果为准......
4 楼
biaoming
2008-03-11
我现在在公司,晚上回去试一下,不过有些疑问,这个的意思是在执行ArticleService的所有方法之前先执行articleServiceSecurityAspect,是这样吗?不过ArticleService需要HibernateSession,注入进来不?还是继续使用来注入呢?
<aop:config proxy-target-class="true">
<aop:advisor pointcut="execution(* cn.biaoming.service..*Service.*(..))" advice-ref="txAdvice"/>
</aop:config>
<aop:config proxy-target-class="true">
<aop:advisor pointcut="execution(* cn.biaoming.service..*Service.*(..))" advice-ref="txAdvice"/>
</aop:config>
3 楼
movingboy
2008-03-11
试试:
以上代码不保证没错~~~
引用
<aop:config>
<aop:aspect id="articleServiceSecurityAspect" ref="articleServiceSecurity">
<aop:before
pointcut="execution(* cn.biaoming.service.ArticleService.*(..))"
method="a_method_of_articleServiceSecurity"/>
</aop:aspect>
</aop:config>
<bean id="articleServiceTager" class="cn.biaoming.service.ArticleServiceTager" />
<aop:aspect id="articleServiceSecurityAspect" ref="articleServiceSecurity">
<aop:before
pointcut="execution(* cn.biaoming.service.ArticleService.*(..))"
method="a_method_of_articleServiceSecurity"/>
</aop:aspect>
</aop:config>
<bean id="articleServiceTager" class="cn.biaoming.service.ArticleServiceTager" />
以上代码不保证没错~~~
2 楼
biaoming
2008-03-11
现在是用了aop:advice>、<aop:advisor>之后把都给我的方法(运行时)加上了final方法。
楼上的意思是让我尝试articleServiceSecurity也用Spring的<aop:advice>、<aop:advisor>是吗?我也想过这个问题,但是我不知道用哪种方法替换。
楼上的意思是让我尝试articleServiceSecurity也用Spring的<aop:advice>、<aop:advisor>是吗?我也想过这个问题,但是我不知道用哪种方法替换。
1 楼
movingboy
2008-03-10
问题在于使用ProxyFactoryBean时,它代理的类不能有final方法;如果纯粹地使用Spring的<aop:advice>、<aop:advisor>则不会有问题。所以你最好尝试一下修改articleServiceSecurity这个bean的声明方式,看看能否使用后者
发表评论
-
A4J 用户指南
2008-10-13 14:58 5629A4J 用户指南 Copy ... -
解决grails报java.lang.SecurityException:Prohibited问题
2008-08-28 18:06 3679今天有时间挨个找关于影响grails的问题,执行命令grail ... -
单个线程对多个线程的唤醒
2008-07-18 10:00 1222模拟两个线程之间的协作。 Athele 类有两个同步方法 pr ... -
hibernate usertype 如何得知自身实体状态
2008-05-07 09:37 1540hibernate usertype优劣网上有不少说法,下面是 ... -
发现一个在线学习groovy的好网站
2008-04-30 18:00 1240http://www.groovyland.net/groov ... -
今天发现个好东西--Grails
2008-04-03 20:00 1095学习Ruby,Ruby on rails是觉得他是动态语言 ... -
增强acegi ACL的拦截方法参数问题
2008-03-15 10:00 1693如果用acegi acl,你什么 ... -
lucene搜索时如果指定一个域为空呢?
2007-12-12 09:54 1368现在有个需求,搜索一个有父子关系的类别,只想搜索到是父的类别, ... -
请教compass如何映射java.util.Map类型
2007-11-08 16:11 1661现在实体设计有需要用到java.util.Map,但是在这个属 ... -
Compass怎样在指定alias中搜索
2007-11-01 09:24 2637我每个POJO都这有这样的注释 @Searchable(ali ... -
compass中如何配置分词器?
2007-09-29 09:04 4489在spring下的配置 <bean id=" ... -
集群基础知识
2007-08-29 17:37 12481.集群 集 群是提供 ... -
struts.properties详解
2007-08-17 11:53 1523struts.action.extension ... -
EJB集群技术分析
2007-08-16 12:57 7077J2EE平台提供了一个基于组件的方法,用来设计、开发、装配及部 ... -
java如何保护领域对象
2007-06-14 18:58 2193请教个问题,JAVA如何保存WEB程序的领域对象呢,比如某个用 ... -
HttpClient
2007-06-07 02:29 2059一般的情况下我们都是使用IE或者Navigator浏览器来访问 ... -
Spring邮件抽象层和Spring中的定时调度的整合(四)
2007-04-05 18:35 17243) 写类 package exa ... -
Spring邮件抽象层和Spring中的定时调度的整合(二)
2007-04-05 18:28 1424其次: MimeMessagePreparator函数的使用 ... -
Spring邮件抽象层和Spring中的定时调度的整合(一)
2007-04-05 18:24 1959一. Spring邮件抽象层 Spri ... -
Spring邮件抽象层和Spring中的定时调度的整合(三)
2007-04-05 18:19 2121二.Spring的定时调度 Spring的定时调度有两种: ...
相关推荐
acegi-security-1.0.4.jar
标签:acegi-security-0.8.3.jar.zip,acegi,security,0.8.3,jar.zip包下载,依赖包
标签:acegi-security-0.8.2.jar.zip,acegi,security,0.8.2,jar.zip包下载,依赖包
标签:acegi-security.jar.zip,acegi,security,jar.zip包下载,依赖包
Spring源代码解析(十):Spring_Acegi框架授权的实现.doc
标签:acegi-security-0.8.1.1.jar.zip,acegi,security,0.8.1.1,jar.zip包下载,依赖包
======================================================================== <br>第1篇 概述 第1章 Spring概述 第2章 快速入门 第2篇 Spring核心技术 第3章 IoC容器概述 第4章 在IoC容器中...
======================================================================== <br>第1篇 概述 第1章 Spring概述 第2章 快速入门 第2篇 Spring核心技术 第3章 IoC容器概述 第4章 在IoC容器中...
Acegi是一个专门为SpringFramework提供安全机制的项目,全称为Acegi Security System for Spring.
Spring源代码解析(九):Spring_Acegi框架鉴权的实现.doc
acegi与cas集成 <!-- ========= Acegi as a CAS Client的配置============= --> class="org.acegisecurity.ui.cas.CasProcessingFilter"> ref="authenticationManager" /> value="/login.do?...
acegi-security-1.0.6.part2.rar
acegi-security-1.0.4-src.zip acegi-security-1.0.4.jar的源码
标签:acegi-security-0.6.1.jar.zip,acegi,security,0.6.1,jar.zip包下载,依赖包
标签:acegi-security-1.0.7.jar.zip,acegi,security,1.0.7,jar.zip包下载,依赖包
标签:acegi-security-0.8.1.jar.zip,acegi,security,0.8.1,jar.zip包下载,依赖包
标签:acegi-security-1.0.4.jar.zip,acegi,security,1.0.4,jar.zip包下载,依赖包
详细的spring security2.x配置
acegi-security-1.0.7.jar