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. ...
随机推荐
- windows 程序设计自学:添加图标资源
#include <windows.h> #include "resource.h" LRESULT CALLBACK MyWndProc( HWND hwnd, // ...
- WebDriver兼容SeleniumRC(基于C#)
WebDriver兼容SeleniumRC(基于C#)http://www.automationqa.com/forum.php?mod=viewthread&tid=3535&fro ...
- Eplan中电缆源和目标的确定规则
使用过Eplan的都知道,生成电缆总览时会有源和目标,电缆是怎么定义源和目标的呢,下面给大家讲解.确定源和目标按照下列规则确定电缆的源和目标: 首先考虑结构标识符中标识性的层结构说明.如果两端都是端子 ...
- C#操作FTP报错,远程服务器返回错误:(550)文件不可用(例如,未找到文件,无法访问文件)的解决方法
最近在做项目的时候需要操作ftp进行文件的上传下载,但在调用using (var response = (FtpWebResponse)FtpWebRequest.GetResponse())的时候总 ...
- [iOS]关于视频方向的若干问题
版本: OS X 10.10.5 Xcode 6.4(6E35b) iOS >= 7 一.MOV/MP4视频文件中的Rotation元数据 iOS上内置相机应用录制的mov/mp4视频可能产生 ...
- 构造Lambda表达式
/// <summary> /// 构造Lambda表达式 /// </summary> /// <typeparam name="T">< ...
- 优化LibreOffice如此简单
对于开源软件的支持者和粉丝来说,LibreOffice 无疑是 Microsoft Office 的最佳替代品,而且它已在过去的许多版本迭代中迎来了许多巨大改进.然而,通过用户的手动配置,我们还是有办 ...
- 批量修改Project视图中Prefab的名字
简要代码如下: using UnityEditor; using UnityEngine; using System.IO; using System.Collections; using Syste ...
- c# 无法引用自己创建的类库
今个测试一个项目,居然无法引用自己创建的类库,我很费解,然后各种测试,修改修饰符,更改强类型,各种测试,最后无聊点开类库的属性 发现居然需要引用的项目与被引用的类库的框架不一样,修改了之后就可以正常 ...
- Visual Studio 2013 Preview对C++11的支持
为期3天的微软Build 2013大会结束了,作为微软一年一度的开发者大会,微软也做足了功夫:很多产品(包括Windows 8.1和Visual Studio 2013 Preview)发布,chan ...