如何在 ColdSpring 2.0 中配置 AOP?
我想在 Coldspring 2.0 中实现一些前后方法顾问,并且我想使用 AOP 的新架构 和新的自动代理功能。不幸的是,Narwhal AOP 文档目前是一个悬念。谁能给我一个使用 AOP 模式的 Coldspring 2.0 配置文件的示例?
I'd like to implement some before and after method advisors in Coldspring 2.0, and I'd like to use the new schema for AOP and the new autoproxying feature. Unfortunently, the Narwhal documentation for AOP is currently a cliffhanger. Can anyone give me an example of a Coldspring 2.0 configuration file that uses the AOP schema?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我刚刚完成了 AOP 文档中的另外 1 部分,但与此同时,这里有一些示例可以帮助您顺利开展工作。
这是围绕建议进行设置的示例。它调用对象 timer 上的方法 timeMethod,该方法与
execution(public * *(..))
的切入点匹配,该方法转换为:方法执行,是公共的,返回任何内容,命名为任何内容,并接受任何类型的任何参数。本质上,它匹配一切。需要注意的重要一点是,虽然 Time.cfc 只是一个普通的 CFC,但为了它执行周围建议,所使用的方法必须将 MethodInitation 作为参数,就像这样:
但是你看,有一个在 CS2 中使用 AOP 的示例。
您仍然可以使用 MethodInterceptors 等,但您将使用
而不是
。但总的来说,我现在正在处理 CS2 AOP 文档,因此应该会在第二天左右完成填写。
I just finished off 1 more section in the AOP documentation, but in the mean time, here are a few examples to get the ball rolling.
This is an example of setting up around advice. It calls the method timeMethod on the object timer, that matches the pointcut of
execution(public * *(..))
, which translated to: a method execution, that is public, that returns anything, that is named anything, and takes any arguments, of any types. Essentially, it matches everything.The important piece to note, is that while Time.cfc is just a plain ol' CFC, for it to do the around advice, the method that is being used has to take a MethodInvocation as an argument, like so:
But there you go, there is an example of using AOP in CS2.
You can still use MethodInterceptors and the like as well, but you will be using
<aop:advisor>
rather than<aop:aspect>
.But overall, I'm working on the CS2 AOP documentation right now, so it should get filled out in the next day or so.
文档已发布! http://sourceforge.net/apps/trac/coldspring/
DOC RELEASED! http://sourceforge.net/apps/trac/coldspring/