1.引入类库

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>4.1.6.RELEASE</version>
        </dependency>
        <!-- aop 包 -->
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
            <version>1.8.6</version>
        </dependency>

 spring aop 需要额外的jar包:

spring4-3-AOP-AspectJ注解-01-简单使用

2.创建配置文件,加入aop,bean,context 命名空间:

spring4-3-AOP-AspectJ注解-01-简单使用

 3.创建一个接口,及其实现类:

接口:ArithmeticCaculator

package com.l1.spring.aop.impl;

public interface ArithmeticCaculator {
    int add(int i, int j);
    int sub(int i, int j);
    int mul(int i, int j);
    int div(int i, int j);
}
View Code

相关文章:

  • 2021-10-02
  • 2021-12-09
  • 2021-09-19
  • 2021-08-03
  • 2021-12-05
  • 2022-12-23
  • 2021-10-22
  • 2022-12-23
猜你喜欢
  • 2021-09-12
  • 2021-11-21
  • 2021-11-04
  • 2021-10-17
  • 2021-05-29
相关资源
相似解决方案