how to proxy an interface using spring like spring data jpa?

there is on interface and no implementation.

Interface Test{

@MyAnnotation
pubilc void sayHello();

}

and i want to using spring to proxy that and let it can be autowired in other beans ,like

Class App{

@Autowired Test test;

}

and in some proxy class i will handle invoke of 'sayHello' by some custom actions according to its annotation .

so how to config the spring xml file and how to write some "MethodInvokeHandler" class ?

i want to add some configuration to spring xml and assign "base-package" to scan these interface and generate the auto proxy code into spring context , so i can use @autowired to inject them to other bean .


This function is no standard spring functionality, so you can not configurate, you have to implement it.

But Java supports you with the Dynamic Proxy API, and its core class Proxy .

链接地址: http://www.djcxy.com/p/67724.html

上一篇: 在Fitnesse进行Spring MVC测试

下一篇: 如何使用春季数据jpa代理一个接口?