Giter Site home page Giter Site logo

aopdemo's Introduction

AOPDemo

使用AspectJ实现AOP编程

  1. app:性能检测
  2. thread:线程切换
  3. permission:申请动态权限
  4. proxy:动态代理实现 AOP

AOP介绍

  • 通过预编译方式和运行期动态代理实现程序功能的统一维护
  • 降低耦合度,统一调用,便于维护,对OOP编程是一种十分有益的补充

AOP编程的使用场景

  • 权限验证,100个功能,其中有10个需要登录或会员才能使用,可以在这十个方法执行前使用,如果没有登录跳转到登录或充值界面
  • 操作文件,释放资源,可以在所有方法执行后调用
  • 性能检测,在方法执行前、执行后调用
  • 用户行为统计、线程切换...处理业务多,但是重复的业务,都可以使用到AOP

两种方式

  1. LTW (Load Time Weaver)——加载期间 类加载 动态代理
  2. CTW (Compile Time Weaver)——编译时注入 APT、操作字节码(ASM)

AspectJ介绍

  1. 第一步 .java通过javac编译为.class
  2. 第二步 .class再通过AspectJ(编译器)对.class修改注入、生成

aopdemo's People

Contributors

jamff avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.