开发者

AspectJ vs. Spring AOP vs. JBoss AOP for exception handling

I'm writing a webservice to an external system.

My service wrapper class has a number of methods which call all the soap interface of the webservice. The call can throw an exception which should then automatically trigger a reconnect to the webservice.

To handle that scenario I'd like to use AOP such that all methods which call the SOAP interface should be "wrapped" by an try开发者_JAVA百科/catch block. In the catch block the reconnect is done.

I'm not using Spring at the moment, so I'm thinking about introducing JBoss AOP. I need some advice if AspectJ or Spring AOP would be a better alternative.

Thanks.


Your requirements are pretty basic, so either AspectJ, JBoss AOP or Spring AOP would work for you. That would suggest that going with the simplest option would work best.

  • I believe that AspectJ works using byte-code manipulation, either at compile-time or load-time, which (depending on your setup) is either simple, or a nightmare. It's highly flexible in what you can do, but can be a bit intimidating.
  • Spring AOP is limited (which isn't a problem here, since so are your requirements), but is a purely run-time solution. Its lack of flexibility may be a bonus here, since it's easy to understand
  • JBoss AOP I'm not very familiar with, but it's closer to Spring AOP than it is to AspectJ
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜