官方文档:
The concept of "advisors" is brought forward from the AOP support defined in Spring and does not have a direct equivalent in AspectJ. An advisor is like a small self-contained aspect that has a single piece of advice. The advice itself is represented by a bean, and must implement one of the advice interfaces described in Advice types in Spring. Advisors can take advantage of AspectJ pointcut expressions though.
Spring supports the advisor concept with the <aop:advisor>
element. You will most commonly see it used in conjunction with transactional advice, which also has its own namespace support in Spring. Here’s how it looks:
简言之:advisors的概念来至于Spring aop,但是advisor在aspectj中并没有用一个等价概念。advisor类似一个切面。
<aop:config> <aop:advisor id="tx-advisor" advice-ref="tx-advice" pointcut="execution(public * com.javartisan.sf.*.*(*))"/> </aop:config> <tx:advice id="tx-advice" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="save*" propagation="REQUIRED" timeout="20000" isolation="READ_COMMITTED" rollback-for="java.lang.RuntimeException" no-rollback-for="com.javartisan.CustomException" read-only="false"/> <tx:method name="del*" propagation="REQUIRED" timeout="20000" isolation="READ_COMMITTED" rollback-for="java.lang.RuntimeException" no-rollback-for="com.javartisan.CustomException" read-only="false"/> </tx:attributes> </tx:advice>