Dav*_*ton 7 java spring aspectj
我开始使用Spring AOP进行项目,我对编织有点困惑.我知道Spring AOP依赖于AspectJweaver.jar,但正如文档所说,这不是编织,而只是它使用了这个jar中的一些类.
但我的问题是,如果不使用AspectJ进行编织,Spring AOP是否有自己的编织,是在加载时还是编译时执行?
我的Spring配置XML文件的相关部分是:
<context:annotation-config />
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="get*" read-only="true" />
<tx:method name="*" />
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="myaop" expression="execution(* my.package.*.*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="myaop" />
</aop:config>
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
Run Code Online (Sandbox Code Playgroud)
she*_*tem 15
在8.1.1项目编织下,它说:
编织:将方面与其他应用程序类型或对象链接以创建建议对象.这可以在编译时(例如,使用AspectJ编译器),加载时间或在运行时完成.与其他纯Java AOP框架一样,Spring AOP在运行时执行编织.
Spring不像AspectJ那样进行相同类型的加载时编织,但是在代理上工作,如文档的另一部分所述:
编辑:刚刚看到你的评论,你在这个假设中是正确的.该文档提供了一个相当完整的解释,说明它是如何工作的.:)
| 归档时间: |
|
| 查看次数: |
11801 次 |
| 最近记录: |