Does Java – spring AOP compile time weaving or load time weaving?

I started using spring AOP for projects, and I was a little confused about weaving I know that spring AOP relies on aspectjweaver Jar, but as the documentation says, this is not weaving, it just uses some classes in this jar

But my question is, if AspectJ is not used for weaving, does spring AOP have its own weaving, which is executed at load time or compile time?

The relevant parts of my spring configuration XML file are:

<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>

Solution

http://docs.spring.io/spring/docs/4.0.1.RELEASE/spring-framework-reference/htmlsingle/#aop -introduction-defn

In 8.1 Under Item 1, it says:

Spring does not perform the same type of load time weaving as AspectJ, but works on proxies, as described in another part of the document:

http://docs.spring.io/spring/docs/4.0.1.RELEASE/spring-framework-reference/htmlsingle/#aop -understanding-aop-proxies

Editor: I just saw your comment. You are right in this assumption This document provides a fairly complete explanation of how it works

The above is the Java - spring AOP collected by programming house for you. Is it compiled at compile time or loaded at load time? I hope this article can help you solve the problem of whether Java spring AOP is woven at compile time or load time? Program development problems encountered.

If you think the content of the programming home website is good, you are welcome to recommend the programming home website to programmers and friends.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>