📗
Notes
  • Introduction
  • Files
  • Android
    • Http
      • Http基础
      • Okhttp理解
    • Jetpack
      • Notes
  • Java ways
    • 101
      • Basis
        • Index
        • Front
          • Angular
            • Angular start 01
            • Angular start 02
          • Typescript
            • Index
            • Ts 01
        • Java
          • Concurrency
          • Frameworks
            • Jdbc与连接池
            • Rxjava基础
            • Spring框架基础
          • Sugar&skill
        • Tool
          • Docker
            • Docker basis
            • Kubernetes play
          • Git
            • Git basic
          • Vim
            • Vim advance
      • Cs
        • Imp
          • Lru
          • Index
    • Snippets
      • Jpa和spring系列注解表
      • Java与oracle数据库各种操作
      • Maven初始化template
      • Nginx配置
      • Nginx反代后配置自动ssl续签
      • 终端033颜色
    • Ways
      • Java ways 01
      • Interview
        • Question
        • Requirements
      • Leetcode101
        • Acwing
          • Index
          • 背包问题
        • Explores
        • Solutions
          • Algorithms
            • Index
          • Concurrency
            • Index
          • Shell
            • Index
          • Sql
            • Index
  • Leecode
    • 牛客
      • 剑指offer
  • Play
    • Youtube离线下载
  • Python basic notes
    • Python days
Powered by GitBook
On this page
  • Spring框架基础
  • AOP 概念
  • XML配置AOP

Was this helpful?

  1. Java ways
  2. 101
  3. Basis
  4. Java
  5. Frameworks

Spring框架基础

   Author: Gentleman.Hu
   Create Time: 2020-10-03 21:25:02
   Modified by: Gentleman.Hu
   Modified time: 2020-10-07 16:39:55
   Email: justfeelingme@gmail.com
   Home: https://crushing.xyz
   Description:

Spring框架基础

AOP 概念

  • Target

  • Proxy

  • JoinPoint

  • PointCut

  • Advice

  • Aspect

  • Weaving

XML配置AOP

写法

execution([修饰符] 返回值类型 包名.类名.方法名 (参数))

  • 修饰符可以省略

  • 返回类型,包名,类名,方法名可以用*代替任意

  • 包名和类名之间有一个点.代表当前包的类,两个点..代表当前包及其子包下的类.

  • 参数列表可以使用两个点..表示任意个数,任意类型的参数列表

execution(public void god.hu.aop.target.method())
execution(void god.hu.aop.target.*(..))
execution(* god.hu.aop.*.*(..))
execution(* god.hu.aop..*.*(..))
execution(* *..*.*(..))

使用xml和注解都可配置

注解开发aop步骤

  1. 使用@aspect表明注解类

  2. 使用@before ,@after,etc等通知注解标注通知方法

  3. 在配置文件中配置aop自动代理

  4. 注解表

名称

表达

含义

前置

@Before

切入点之前执行

后置

@AfterReturning

切入点之后执行

环绕

@Around

之前和之后都执行

异常抛出

@AfterThrowing

在抛出异常后执行

最终通知

@After

都会执行,无论是否异常

break on 2020-10-07 16:39:27

PreviousRxjava基础NextSugar&skill

Last updated 4 years ago

Was this helpful?

continue at

OwnJavaWay