首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

Pointcut命名有可能导致异常

2012-11-05 
Pointcut命名有可能导致错误使用Spring @AspectJ方式的AOP,代码@Around(get(id))java.lang.IllegalArgum

Pointcut命名有可能导致错误
使用Spring @AspectJ方式的AOP,代码

@Around("get(id)")java.lang.IllegalArgumentException: Pointcut is not well-formed: expecting 'name pattern' at character position 6

?翻阅文档发现问题所在:

写道其他的切入点类型

完整的AspectJ切入点语言支持额外的切入点指定者,但是Spring不支持这个功能。 他们分别是call, initialization, preinitialization,staticinitialization, get, set, handler, adviceexecution, withincode,cflow, cflowbelow, if, @this 和 @withincode。 在SpringAOP中使用这些指定者将会导致抛出IllegalArgumentException异常。

Spring AOP支持的切入点指定者可能在将来的版本中得到扩展,不但支持更多的AspectJ 切入点指定者(例如"if"),还会支持某些Spring特有的切入点指定者,比如"bean"(用于匹配bean的名字)。
?所以在使用spring AOP的时候不能以上面的诸如call,get等命名,不然就会报异常。

热点排行