zoukankan      html  css  js  c++  java
  • Spring 基于注解的AOP实现

    在本文开始之前,我要引入一张图,这张图的来源  https://blog.csdn.net/chenyao1994/article/details/79708496  ,版权归原作者所有,我借鉴了原作者的一些内容,在此表示感谢。

    我要开始发挥了。

    1)。引入依赖

      1、Spring AOP依赖(略,我不会告诉你其实我把Spring的所有jar包都引进来了)

      2、图中的注解支持的jar包

        aopalliance

          <!--https://mvnrepository.com/artifact/aopalliance/aopalliance-->      

    <dependency>
    <groupId>aopalliance</groupId>
    <artifactId>aopalliance</artifactId>
    <version>1.0</version>
    </dependency>

        aspectjweaver

    <!--https://mvnrepository.com/artifact/org.aspectj/aspectjweaver-->

    <dependency>
    <groupId>org.aspectj</groupId>
    <artifactId>aspectjweaver</artifactId>
    <version>1.9.2</version>
    </dependency>

    2)。定义切面

    3).在配置类中启动AspectJ注解的自动代理,并将切面类添加到Spring容器中


    4)编写Meinv类(如图),并添加到容器中(略)。




    5)、开始测试



          

        

  • 相关阅读:
    队列分类梳理
    停止线程
    Docker和Kubernetes
    Future、Callback、Promise
    Static、Final、static final
    线程池梳理
    TCP四次挥手
    http1.0、http1.x、http 2和https梳理
    重排序
    java内存模型梳理
  • 原文地址:https://www.cnblogs.com/fanqisoft/p/10246674.html
Copyright © 2011-2022 走看看