Spring 接口代理 类代理
1.Question Description :
when you use @Transactional annotation and @RequiresPermissions annotation (about shiro) together,
you will find the @RequiresPermissions annotation donot work, why?
2. Explain:
It's caused by the Proxy Mechanism of Spring, because the Spring framework preference for Interface Proxy than Class Proxy,
the method of the class ExampleServiceImpl was agented several times.
Let's look the two kinds of Interface.
2.1 @Transactional Annotation:
It was based on the Interface Proxy default, so it will produce Proxy Object One just like ExampleServiceImpl$$;
2.2 @RequiresPermissions :
It was based on the Interface Proxy default too, but it produces Proxy Object Two based on Proxy Object One just like ExampleServiceImpl$$$$,
that is a really Class Proxy.
2.3 when the two kinds of Proxy way exist together, the Classs Proxy will out of action.
3. Solution:
we should change its Proxy Way, as follows:

and the same time, change the Proxy Way of Spring, as follows:

then @RequiresPermissions Annotation works!
Spring 接口代理 类代理的更多相关文章
- 如何获取hibernate代理类代理的实际对象实例?
在hibernate中,通过sql语句查询带clob字段的记录,查出来的结果集是List<HashMap<String,Object>>类型,在调用jackson的接口转为js ...
- AOP 代理类的创建
AOP 代理类的创建 入口:AnnotationAwareAspectJAutoProxyCreator#postProcessAfterInitialization 和 AnnotationAwar ...
- Spring学习之动态代理的简单实现
先说一下代理模式的好处 1.可以使真实角色的操作更加纯粹,不用去关注一些公共的业务 2.公共的交给代理角色,实现了业务的分工 3.公共业务发生扩展的时候,方便集中管理 静态代理模式的缺点 1.一个真实 ...
- .net 代理类(WebService代理类的详解 )
http://hi.baidu.com/654085966/item/53ee8c0f108ad78202ce1b1d -----------转自 客户端调用Web Service的方式我现在知道 ...
- 啰里吧嗦式讲解java静态代理动态代理模式
一.为啥写这个 文章写的比较啰嗦,有些东西可以不看,因为想看懂框架, 想了解SSH或者SSM框架的设计原理和设计思路, 又去重新看了一遍反射和注解, 然后看别人的博客说想要看懂框架得先看懂设计模式,于 ...
- Spring只定义接口自动代理接口实现类
能够扫描到包 @ComponentScan("org.zxp.esclientrhl") ESCRegistrar类主要实现ImportBeanDefinitionRegistra ...
- 在spring中获取代理对象代理的目标对象工具类
昨天晚上一哥们需要获取代理对象的目标对象,查找了文档发现没有相应的工具类,因此自己写了一个分享给大家.能获取JDK动态代理/CGLIB代理对象代理的目标对象. 问题描述:: 我现在遇到个棘手的问题,要 ...
- spring 依赖注入时,什么时候会创建代理类
问题来源 以前一直有个疑惑,为什么我创建的controller中注入的service类有时候是代理类,有时候是普通javabean,当时能力不够,现在已经有了点经验就大胆跟了跟源码,看看到底咋回事. ...
- spring AbstractBeanDefinition创建bean类型是动态代理类的方式
1.接口 Class<?> resourceClass 2.获取builder BeanDefinitionBuilder builder = BeanDefinitionBuilder. ...
随机推荐
- Tomcat and solr 环境配置
Tomcat and solr tomcat 安装 下载安装tomcat8.0 http://tomcat.apache.org/download-80.cgi wget http://apache. ...
- 没有 RunInstallerAttribute.Yes 的公共安装程序。在 C:/Program/xx.exe 程序集中可能可以找到
今天在装服务的时候,装了半天总是提示 没有 RunInstallerAttribute.Yes 的公共安装程序.在 C:/Program/xx.exe 程序集中可能可以找到“Yes”属性. 才发现同事 ...
- 深入解析Oracle 10g中SGA_MAX_SIZE和SGA_TARGET参数的区别和作用
原文链接:http://m.blog.csdn.net/blog/aaron8219/40037005 SGA_MAX_SIZE是从9i以来就有的作为设置SGA大小的一个参数,而SGA_TARGET则 ...
- [原创]Andorid DexClassLoader的创建过程解析(基于5.0)
做Android插件框架时,经常会用到dex的动态加载,就要直接或间接的使用DexClassLoader,在new DexClassLoader的时候Android系统做了很多工作,下面我们详细分析一 ...
- Java Web 工作技巧总结 16.10
摘要: 原创出处:www.bysocket.com 泥瓦匠BYSocket 希望转载,保留摘要,谢谢! 在你成为领导者以前,成功只同自己的成长有关.当你成为领导者以后,成功都同别人的成长有关. 1.聊 ...
- Xcode 安装插件手误选择了「Skip Bundle」后需要重新允许「Load Bundle」的解决方法
在 Mac 终端输入命令: # 这里的7.1代表 Xcode 的版本号 defaults delete com.apple.dt.Xcode DVTPlugInManagerNonApplePlugI ...
- 如何准备PMP考试?
东西在精,而不在多.话不多说,干货如下: 1.参加培训,不要持续时间太长,通常情况下3个月时间足够了:许多和我一起参加培训的学员,有时候准备6个月时间,反而没有3个月冲刺的时间考试结果好. 2.培训老 ...
- Objective-C之类和对象
http://www.cnblogs.com/kenshincui/p/3861302.html
- protobuf-net
protobuf是google的一个开源项目,可用于以下两种用途: (1)数据的存储(序列化和反序列化),类似于xml.json等: (2)制作网络通信协议. 源代码下载地址:https://gith ...
- Testing - Selenium
Selenium http://www.seleniumhq.org/ User Guide http://www.seleniumhq.org/docs/ Webdriver中文社区 http:// ...