WO2019136844A1 - Aop代理框架的实现方法、存储介质、电子设备及系统 - Google Patents

Aop代理框架的实现方法、存储介质、电子设备及系统 Download PDF

Info

Publication number
WO2019136844A1
WO2019136844A1 PCT/CN2018/081290 CN2018081290W WO2019136844A1 WO 2019136844 A1 WO2019136844 A1 WO 2019136844A1 CN 2018081290 W CN2018081290 W CN 2018081290W WO 2019136844 A1 WO2019136844 A1 WO 2019136844A1
Authority
WO
WIPO (PCT)
Prior art keywords
business
interception
interceptor
item
aop
Prior art date
Application number
PCT/CN2018/081290
Other languages
English (en)
French (fr)
Inventor
支猛
陈少杰
张文明
Original Assignee
武汉斗鱼网络科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 武汉斗鱼网络科技有限公司 filed Critical 武汉斗鱼网络科技有限公司
Publication of WO2019136844A1 publication Critical patent/WO2019136844A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • G06F8/24Object-oriented
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation

Definitions

  • the present invention relates to the field of AOP proxies, and in particular to an implementation method of AOP proxy framework, a storage medium, an electronic device and a system.
  • AOP Application Orient Programming
  • object-oriented programming It is widely used to handle system-level services with cross-cutting properties such as transaction management, security checking, caching, object pool management, and so on.
  • AOP can be used to intercept business items (business classes including constructors and business methods, business methods including static methods and dynamic methods), so that the degree of coupling between the various parts of the business class is reduced, and the program can be improved. Reusability while improving the efficiency of development.
  • the key to AOP implementation is the AOP proxy class (that is, interceptor) automatically created by the AOP framework.
  • the AOP proxy class can be divided into two categories: static proxy and dynamic proxy:
  • Static proxy refers to compiling with commands provided by the AOP framework, so that AOP proxy classes and business classes are jointly generated at compile stage, so it is also called compile-time enhancement.
  • Dynamic proxy is a "temporary" co-generation of AOP proxy classes and business classes in memory by means of JDK (Java Language Software Development Kit) dynamic proxy, CGLIB (Code Generation Library), etc. at runtime. It is also known as runtime enhancement.
  • JDK Java Language Software Development Kit
  • CGLIB Code Generation Library
  • AspectJ a face-oriented framework
  • Spring AOP both of which provide a complete set of AOP mechanisms.
  • AspectJ and Spring AOP have the following defects:
  • AspectJ generates AOP proxy classes for business applications in a compile-time enhanced way. Since AOP proxy classes are generated at compile time, if you need to modify the interception function of AOP proxy classes, you must recompile the business classes to apply the new AOP proxy classes. The process of recompiling the business class is more complicated and less flexible.
  • Spring AOP generates AOP proxy classes for business applications in a runtime-enhanced manner.
  • the logic of the AOP proxy classes generated by Spring AOP is in the same application as the business logic. Therefore, if you need to modify the interception function of the AOP proxy class, you need to recompile.
  • the business class, that is, the operational process is also more complicated and less flexible.
  • the technical problem solved by the present invention is how to simplify the operation process of the AOP interception service class.
  • the invention does not need to recompile the service class, thereby significantly improving the flexible performance of the AOP.
  • the method for implementing the AOP proxy framework provided by the present invention includes the following steps:
  • S1 In the AOP proxy framework, register the business class and go to S2;
  • S2 AOP proxy framework monitors that the service class registered in S1 is loaded, and goes to S3;
  • S3 traversing each constructor and business method of the business class, defining the traversed constructor or business method as the to-be-intercepted item, and each of the to-be-intercepted items includes at least two business items, and proceeds to S4;
  • S5 intercepting the current business item to be intercepted according to the interception chain of the current interception item.
  • the process of configuring and loading all the service classes registered by the interceptor in S1 after completion of the compilation in S4 includes: after all the business classes are compiled, the interceptor is configured, and the rules for configuring the interceptor are
  • the interceptor includes a construct interceptor corresponding to the constructor of the business class, and a method interceptor corresponding to the business method of the business class; each interceptor is associated with a business item of the corresponding constructor or business method;
  • the configured interceptor is loaded into the AOP proxy framework.
  • the service method in S3 includes a static method and a dynamic method of a service class.
  • the process of S5 includes: associating each interceptor in the interception chain of the current to-be-intercepted item with the current to-be-intercepted item, and performing interception according to the interception of the current business item in the current to-be-intercepted item An interceptor corresponding to the executed business item in the chain intercepts the business item.
  • the invention provides a storage medium on which a computer program is stored, and when the computer program is executed by a processor, the implementation method of the AOP proxy framework described above is implemented.
  • the electronic device comprises a memory and a processor, wherein the memory stores a computer program running on the processor, and the processor implements the AOP proxy framework implementation method when executing the computer program.
  • the implementation system of the AOP proxy framework comprises a service class registration module, a service class load monitoring module, a service class traversal module, an interception chain generation module and a service item interception module;
  • the business class registration module is used to: register a business class in the AOP proxy framework;
  • the service class loading monitoring module is configured to: when the AOP agent framework monitors that the service class registered in the service class registration module is loaded, send a service class traversal signal to the service class traversal module;
  • the service class traversal module is configured to: after receiving the service class traversal signal, traverse each constructor and business method of the business class, and define the traversed constructor or business method as the to-be-intercepted item, and each of the to-be-intercepted items includes at least 2 business items, sending interception chain generation signals to the interception chain generation module;
  • the interception chain generation module is configured to: after receiving the interception chain generation signal, in all the interceptors of the AOP proxy framework, all the interceptors corresponding to the current business item of the current interception project form an interception chain of the current interception project, and the interceptor All the business classes registered in the business class registration module are configured and loaded after being compiled, and the business project interception signal is sent to the business project interception module;
  • the business project interception module is configured to: after receiving the interception signal of the business project, intercept the business item of the current interception project according to the interception chain of the current interception project.
  • the system further includes an interceptor configuration module, configured to: after all the service classes are compiled, configure an interceptor, and the rules for configuring the interceptor are: the interceptor includes a constructor corresponding to the service class. Constructing an interceptor, and a method interceptor corresponding to the business method of the business class; associating each interceptor with a business item of the corresponding constructor or business method; loading the configured interceptor into the AOP proxy framework.
  • the service method in the service class traversal module includes a static method and a dynamic method of the service class.
  • the workflow of the business item interception module includes: associating each interceptor in the interception chain of the current to-be-intercepted item with the current to-be-intercepted item, and the service in the current to-be-intercepted item
  • the business item is intercepted according to the interceptor corresponding to the executed business item in the interception chain.
  • the present invention is capable of separately configuring and loading the interceptor according to the rules of the self-designed configuration interceptor.
  • all the interceptors of the present invention are configured and loaded after the business class is compiled; therefore, the present invention does not need to re-modify the interceptor intercept function. Compiling the business class significantly simplifies the operation of the AOP interception business class and greatly improves the flexible performance of AOP.
  • FIG. 1 is a flowchart of a method for implementing an AOP proxy framework in an embodiment of the present invention
  • FIG. 2 is a block diagram showing the connection of an electronic device in an embodiment of the present invention.
  • an implementation method of an AOP proxy framework in an embodiment of the present invention includes the following steps:
  • S1 In the AOP proxy framework (SkyEye AOP), register the business class and go to S2.
  • S2 The AOP proxy framework monitors that the JVM (Java Virtual Machine) loads the business class registered in S1 and goes to S3.
  • JVM Java Virtual Machine
  • S3 Traversing each constructor and business method of the business class (the static method and the dynamic method of the business class), defining the traversed constructor or business method as the to-be-intercepted item, and each of the to-be-intercepted items includes at least two services. Project, go to S4.
  • the interceptor includes a construct interceptor corresponding to the constructor of the business class, and a method corresponding to the business method of the business class.
  • Interceptor associates the interception logic of each interceptor with a corresponding business entity of a constructor or business method (ie, the interceptor acts to intercept the associated business item), and loads the configured interceptor to AOP Agent framework.
  • S5 intercepting the current business item to be intercepted according to the interception chain of the current interception item.
  • the process of S5 includes: associating each interceptor in the interception chain of the current to-be-intercepted item with the current to-be-intercepted item (ie, intercepting logic of the interceptor in the current to-be-intercepted item), in the current to-be-intercepted item
  • the business project is executed, the business item is intercepted according to an interceptor corresponding to the executed business item in the interception chain.
  • the embodiment of the invention further provides a storage medium, where the computer program is stored on the storage medium, and the implementation method of the AOP proxy framework is implemented when the computer program is executed by the processor.
  • the storage medium includes a U disk, a mobile hard disk, a ROM (Read-Only Memory), a RAM (Random Access Memory), a disk or an optical disk, and the like. The medium of the code.
  • an embodiment of the present invention further provides an electronic device, including a memory and a processor.
  • the memory stores a computer program running on the processor, and the implementation method of the AOP proxy framework is implemented when the processor executes the computer program. .
  • the implementation system of the AOP proxy framework in the embodiment of the present invention includes a service class registration module, a service class loading monitoring module, a service class traversal module, an interceptor configuration module, an interception chain generation module, and a service item interception module.
  • the business class registration module is used to: register the business class in the AOP proxy framework.
  • the service class loading monitoring module is configured to: when the AOP proxy framework monitors the service class registered in the JVM loading service class registration module, send a service class traversal signal to the service class traversal module.
  • the service class traversal module is configured to: after receiving the service class traversal signal, traverse each constructor and business method of the business class, and define the constructor or business method (the business method includes the static method and the dynamic method of the business class) traversed to the business class.
  • each of the items to be intercepted includes at least two business items, and the intercept chain generating signal is sent to the interception chain generating module.
  • the interceptor configuration module is configured to: after all the business classes are compiled, configure an interceptor, and the rules for configuring the interceptor are: the interceptor includes a construct interceptor corresponding to the constructor of the service class, and a service method corresponding to the business class Method interceptor; associates each interceptor with a business item of the corresponding constructor or business method; loads the configured interceptor into the AOP proxy framework.
  • the interception chain generation module is configured to: after receiving the interception chain generation signal, in all the interceptors of the AOP proxy framework, all the interceptors corresponding to the current business item of the current interception project form an interception chain of the current interception project, and the interceptor All business classes registered in the business class registration module are configured and loaded after compilation, and the business project interception signal is sent to the business project interception module.
  • the business project interception module is configured to: after receiving the interception signal of the business project, intercept the business item of the current to-be-intercepted item according to the interception chain of the current interception item; the specific work process includes: intercepting the current interception item Each interceptor is associated with the current to-be-intercepted item, and when the business item in the current to-be-intercepted item is executed, the business item is intercepted according to an interceptor corresponding to the executed business item in the interception chain.

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

本发明公开了一种AOP代理框架的实现方法、存储介质、电子设备及系统,涉及AOP代理领域。该方法的步骤为:在AOP代理框架中,注册业务类,AOP代理框架监测到已注册的业务类被加载时,遍历业务类的每个构造器和业务方法,将遍历到的构造器或业务方法定义为待拦截项目;在AOP代理框架的所有拦截器中,将与当前待拦截项目的业务项目对应的所有拦截器,形成当前待拦截项目的拦截链;根据当前待拦截项目的拦截链,对当前待拦截项目的业务项目进行拦截。本发明在修改拦截器的拦截功能时,不需要重新编译业务类,进而显著简化了AOP拦截业务类的操作流程,大幅度提高了AOP的灵活性能。

Description

AOP代理框架的实现方法、存储介质、电子设备及系统 技术领域
本发明涉及AOP代理领域,具体涉及一种AOP代理框架的实现方法、存储介质、电子设备及系统。
背景技术
AOP(Aspect Orient Programming,面向切面编程)是作为面向对象编程的一种补充,广泛应用于处理一些具有横切性质的系统级服务,如事务管理、安全检查、缓存、对象池管理等。利用AOP可以对业务类(业务类包括构造器和业务方法,业务方法包括静态方法和动态方法)的各个业务项目进行拦截,从而使得业务类的各部分之间的耦合度降低,提高程序的可重用性,同时提高了开发的效率。AOP实现的关键就在于AOP框架自动创建的AOP代理类(即拦截器),AOP代理类可分为静态代理和动态代理两大类:
静态代理是指使用AOP框架提供的命令进行编译,从而在编译阶段就共同生成AOP代理类和业务类,因此也称为编译时增强;
动态代理则是在运行时借助于JDK(Java语言的软件开发工具包)动态代理、CGLIB(Code Generation Library,一个Code生成类库)等在内存中“临时”共同生成AOP代理类和业务类,因此也被称为运行时增强。
在Java语言领域,成熟且功能强大的AOP实现有AspectJ(一个面向切面的框架)和Spring AOP,它们都提供了整套AOP机制的实现。但是AspectJ和Spring AOP分别存在以下缺陷:
AspectJ采用编译时增强的方式为业务应用生成AOP代理类,由于AOP代理类是在编译时生成的,因此若需要修改AOP代理类的拦截功能,则必须重新编译业务类以应用新的AOP代理类;重新编译业务类的操作流程比较复杂,灵活性较差。
Spring AOP采用运行时增强的方式为业务应用生成AOP代理类,即Spring AOP生成的AOP代理类的逻辑与业务逻辑位于同一个应用中,因此若需要修改AOP代理类的拦截功能,也需要重新编译业务类,即操作流程同样比较复杂,灵活性较差。
发明内容
针对现有技术中存在的缺陷,本发明解决的技术问题为:如何简化AOP拦截业务类的操作流程。本发明修改拦截器的拦截功能时,不需要重新编译业务类,进而显著的提高了AOP的灵活性能。
为达到以上目的,本发明提供的AOP代理框架的实现方法,包括以下步骤:
S1:在AOP代理框架中,注册业务类,转到S2;
S2:AOP代理框架监测S1中注册的业务类被加载时,转到S3;
S3:遍历业务类的每个构造器和业务方法,将遍历到的构造器或业务方法定义为待拦截项目,每个待拦截项目中包括至少2个业务项目,转到S4;
S4:在AOP代理框架的所有拦截器中,将与当前待拦截项目的业务项目对应的所有拦截器,形成当前待拦截项目的拦截链,拦截器在S1中注册的所有业务类编译完成后配置和加载,转到S5;
S5:根据当前待拦截项目的拦截链,对当前待拦截项目的业务项目进行拦截。
在上述技术方案的基础上,S4中所述拦截器在S1中注册的所有 业务类编译完成后配置和加载的流程包括:在所有业务类编译完成后,配置拦截器,配置拦截器的规则为:拦截器包括与业务类的构造器对应的构造拦截器、以及与业务类的业务方法对应的方法拦截器;将每个拦截器与对应的构造器或业务方法的1个业务项目关联;将配置好的拦截器加载至AOP代理框架。
在上述技术方案的基础上,S3中所述业务方法包括业务类的静态方法和动态方法。
在上述技术方案的基础上,S5的流程包括:将当前待拦截项目的拦截链中的每个拦截器,均与当前待拦截项目关联,在当前待拦截项目中的业务项目执行时,根据拦截链中与执行的业务项目对应的拦截器,对该业务项目进行拦截。
本发明提供的存储介质,该存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现上述AOP代理框架的实现方法。
本发明提供的电子设备,包括存储器和处理器,存储器上储存有在处理器上运行的计算机程序,处理器执行计算机程序时实现上述AOP代理框架的实现方法。
本发明提供的AOP代理框架的实现系统,包括业务类注册模块、业务类加载监测模块、业务类遍历模块、拦截链生成模块和业务项目拦截模块;
业务类注册模块用于:在AOP代理框架中,注册业务类;
业务类加载监测模块用于:在AOP代理框架监测到业务类注册模块中注册的业务类被加载时,向业务类遍历模块发送业务类遍历信号;
业务类遍历模块用于:收到业务类遍历信号后,遍历业务类的每个构造器和业务方法,将遍历到的构造器或业务方法定义为待拦截项 目,每个待拦截项目中包括至少2个业务项目,向拦截链生成模块发送拦截链生成信号;
拦截链生成模块用于:收到拦截链生成信号后在AOP代理框架的所有拦截器中,将与当前待拦截项目的业务项目对应的所有拦截器,形成当前待拦截项目的拦截链,拦截器在业务类注册模块中注册的所有业务类编译完成后配置和加载,向业务项目拦截模块发送业务项目拦截信号;
业务项目拦截模块用于:收到业务项目拦截信号后,根据当前待拦截项目的拦截链,对当前待拦截项目的业务项目进行拦截。
在上述技术方案的基础上,该系统还包括拦截器配置模块,其用于:在所有业务类编译完成后,配置拦截器,配置拦截器的规则为:拦截器包括与业务类的构造器对应的构造拦截器、以及与业务类的业务方法对应的方法拦截器;将每个拦截器与对应的构造器或业务方法的1个业务项目关联;将配置好的拦截器加载至AOP代理框架。
在上述技术方案的基础上,所述业务类遍历模块中的业务方法包括业务类的静态方法和动态方法。
在上述技术方案的基础上,所述业务项目拦截模块的工作流程包括:将当前待拦截项目的拦截链中的每个拦截器,均与当前待拦截项目关联,在当前待拦截项目中的业务项目执行时,根据拦截链中与执行的业务项目对应的拦截器,对该业务项目进行拦截。
与现有技术相比,本发明的优点在于:
参见S1至S5可知,本发明能够根据自主制定的配置拦截器的规则,单独配置和加载拦截器。与现有技术中的共同生成AOP代理类和业务类相比,本发明的所有拦截器均在业务类编译完成后配置和加载;因此,本发明在修改拦截器的拦截功能时,不需要重新编译业务 类,进而显著简化了AOP拦截业务类的操作流程,大幅度提高了AOP的灵活性能。
附图说明
图1为本发明实施例中的AOP代理框架的实现方法的流程图;
图2为本发明实施例中电子设备的连接框图。
具体实施方式
以下结合附图及实施例对本发明作进一步详细说明。
参见图1所示,本发明实施例中的AOP代理框架的实现方法,包括以下步骤:
S1:在AOP代理框架(SkyEye AOP)中,注册业务类,转到S2。
S2:AOP代理框架监测到JVM(Java Virtual Machine,Java虚拟机)加载S1中注册的业务类时,转到S3。
S3:遍历业务类的每个构造器和业务方法(业务类的静态方法和动态方法),将遍历到的构造器或业务方法定义为待拦截项目,每个待拦截项目中包括至少2个业务项目,转到S4。
S4:在AOP代理框架的所有拦截器中(拦截器在S1中注册的所有业务类编译完成后配置和加载,实际应用中在S4之前配置和加载拦截器即可),将与当前待拦截项目的业务项目对应的所有拦截器,形成当前待拦截项目的拦截链,即拦截链中包括所有与当前待拦截项目业务项目对应的拦截器,转到S5。
S4之前包括以下步骤:在所有业务类编译完成后,配置拦截器,配置拦截器的规则为:拦截器包括与业务类的构造器对应的构造拦截器、以及与业务类的业务方法对应的方法拦截器;将每个拦截器的拦 截逻辑,与对应的构造器或业务方法的1个业务项目关联(即该拦截器的作用为拦截关联的业务项目),将配置好的拦截器加载至AOP代理框架。
S5:根据当前待拦截项目的拦截链,对当前待拦截项目的业务项目进行拦截。
S5的流程包括:将当前待拦截项目的拦截链中的每个拦截器,均与当前待拦截项目关联(即在当前待拦截项目中织入拦截器的拦截逻辑),在当前待拦截项目中的业务项目执行时,根据拦截链中与执行的业务项目对应的拦截器,对该业务项目进行拦截。
本发明实施例还提供一种存储介质,存储介质上存储有计算机程序,计算机程序被处理器执行时实现上述AOP代理框架的实现方法。需要说明的是,所述存储介质包括U盘、移动硬盘、ROM(Read-Only Memory,只读存储器)、RAM(Random Access Memory,随机存取存储器)、磁碟或者光盘等各种可以存储程序代码的介质。
参见图2所示,本发明实施例还提供一种电子设备,包括存储器和处理器,存储器上储存有在处理器上运行的计算机程序,处理器执行计算机程序时实现上述AOP代理框架的实现方法。
本发明实施例中的AOP代理框架的实现系统,包括业务类注册模块、业务类加载监测模块、业务类遍历模块、拦截器配置模块、拦截链生成模块和业务项目拦截模块。
业务类注册模块用于:在AOP代理框架中,注册业务类。
业务类加载监测模块用于:在AOP代理框架监测到JVM加载业务类注册模块中注册的业务类时,向业务类遍历模块发送业务类遍历信号。
业务类遍历模块用于:收到业务类遍历信号后,遍历业务类的每 个构造器和业务方法,将遍历到的构造器或业务方法(业务方法包括业务类的静态方法和动态方法)定义为待拦截项目,每个待拦截项目中包括至少2个业务项目,向拦截链生成模块发送拦截链生成信号。
拦截器配置模块用于:在所有业务类编译完成后,配置拦截器,配置拦截器的规则为:拦截器包括与业务类的构造器对应的构造拦截器、以及与业务类的业务方法对应的方法拦截器;将每个拦截器与对应的构造器或业务方法的1个业务项目关联;将配置好的拦截器加载至AOP代理框架。
拦截链生成模块用于:收到拦截链生成信号后在AOP代理框架的所有拦截器中,将与当前待拦截项目的业务项目对应的所有拦截器,形成当前待拦截项目的拦截链,拦截器在业务类注册模块中注册的所有业务类编译完成后配置和加载,向业务项目拦截模块发送业务项目拦截信号。
业务项目拦截模块用于:收到业务项目拦截信号后,根据当前待拦截项目的拦截链,对当前待拦截项目的业务项目进行拦截;其具体工作流程包括:将当前待拦截项目的拦截链中的每个拦截器,均与当前待拦截项目关联,在当前待拦截项目中的业务项目执行时,根据拦截链中与执行的业务项目对应的拦截器,对该业务项目进行拦截。
需要说明的是:本发明实施例提供的系统在进行模块间通信时,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将系统的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。
进一步,本发明不局限于上述实施方式,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也视为本发明的保护范围之内。本说明书中 未作详细描述的内容属于本领域专业技术人员公知的现有技术。

Claims (10)

  1. 一种AOP代理框架的实现方法,其特征在于,该方法包括以下步骤:
    S1:在AOP代理框架中,注册业务类,转到S2;
    S2:AOP代理框架监测到S1中注册的业务类被加载时,转到S3;
    S3:遍历业务类的每个构造器和业务方法,将遍历到的构造器或业务方法定义为待拦截项目,每个待拦截项目中包括至少2个业务项目,转到S4;
    S4:在AOP代理框架的所有拦截器中,将与当前待拦截项目的业务项目对应的所有拦截器,形成当前待拦截项目的拦截链,拦截器在S1中注册的所有业务类编译完成后配置和加载,转到S5;
    S5:根据当前待拦截项目的拦截链,对当前待拦截项目的业务项目进行拦截。
  2. 如权利要求1所述的AOP代理框架的实现方法,其特征在于,S4中所述拦截器在S1中注册的所有业务类编译完成后配置和加载的流程包括:在所有业务类编译完成后,配置拦截器,配置拦截器的规则为:拦截器包括与业务类的构造器对应的构造拦截器、以及与业务类的业务方法对应的方法拦截器;将每个拦截器与对应的构造器或业务方法的1个业务项目关联;将配置好的拦截器加载至AOP代理框架。
  3. 如权利要求1或2所述的AOP代理框架的实现方法,其特征在于:S3中所述业务方法包括业务类的静态方法和动态方法。
  4. 如权利要求1或2所述的AOP代理框架的实现方法,其特征在于,S5的流程包括:将当前待拦截项目的拦截链中的每个拦截器, 均与当前待拦截项目关联,在当前待拦截项目中的业务项目执行时,根据拦截链中与执行的业务项目对应的拦截器,对该业务项目进行拦截。
  5. 一种存储介质,该存储介质上存储有计算机程序,其特征在于:所述计算机程序被处理器执行时实现权利要求1至4任一项所述的方法。
  6. 一种电子设备,包括存储器和处理器,存储器上储存有在处理器上运行的计算机程序,其特征在于:处理器执行计算机程序时实现权利要求1至4任一项所述的方法。
  7. 一种AOP代理框架的实现系统,其特征在于:该系统包括业务类注册模块、业务类加载监测模块、业务类遍历模块、拦截链生成模块和业务项目拦截模块;
    业务类注册模块用于:在AOP代理框架中,注册业务类;
    业务类加载监测模块用于:在AOP代理框架监测到业务类注册模块中注册的业务类被加载时,向业务类遍历模块发送业务类遍历信号;
    业务类遍历模块用于:收到业务类遍历信号后,遍历业务类的每个构造器和业务方法,将遍历到的构造器或业务方法定义为待拦截项目,每个待拦截项目中包括至少2个业务项目,向拦截链生成模块发送拦截链生成信号;
    拦截链生成模块用于:收到拦截链生成信号后在AOP代理框架的所有拦截器中,将与当前待拦截项目的业务项目对应的所有拦截器,形成当前待拦截项目的拦截链,拦截器在业务类注册模块中注册的所有业务类编译完成后配置和加载,向业务项目拦截模块发送业务项目拦截信号;
    业务项目拦截模块用于:收到业务项目拦截信号后,根据当前待拦截项目的拦截链,对当前待拦截项目的业务项目进行拦截。
  8. 如权利要求7所述的AOP代理框架的实现系统,其特征在于:该系统还包括拦截器配置模块,其用于:在所有业务类编译完成后,配置拦截器,配置拦截器的规则为:拦截器包括与业务类的构造器对应的构造拦截器、以及与业务类的业务方法对应的方法拦截器;将每个拦截器与对应的构造器或业务方法的1个业务项目关联;将配置好的拦截器加载至AOP代理框架。
  9. 如权利要求7或8所述的AOP代理框架的实现系统,其特征在于:所述业务类遍历模块中的业务方法包括业务类的静态方法和动态方法。
  10. 如权利要求7或8所述的AOP代理框架的实现系统,其特征在于:所述业务项目拦截模块的工作流程包括:将当前待拦截项目的拦截链中的每个拦截器,均与当前待拦截项目关联,在当前待拦截项目中的业务项目执行时,根据拦截链中与执行的业务项目对应的拦截器,对该业务项目进行拦截。
PCT/CN2018/081290 2018-01-09 2018-03-30 Aop代理框架的实现方法、存储介质、电子设备及系统 WO2019136844A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810017909.6A CN108196833B (zh) 2018-01-09 2018-01-09 Aop代理框架的实现方法、存储介质、电子设备及系统
CN201810017909.6 2018-01-09

Publications (1)

Publication Number Publication Date
WO2019136844A1 true WO2019136844A1 (zh) 2019-07-18

Family

ID=62588731

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/081290 WO2019136844A1 (zh) 2018-01-09 2018-03-30 Aop代理框架的实现方法、存储介质、电子设备及系统

Country Status (2)

Country Link
CN (1) CN108196833B (zh)
WO (1) WO2019136844A1 (zh)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110780883A (zh) * 2018-07-30 2020-02-11 网宿科技股份有限公司 方法调用链跟踪方法、电子装置及计算机可读存储介质
CN110895468A (zh) * 2018-08-22 2020-03-20 北京京东尚科信息技术有限公司 实现业务增强的方法和装置
CN109947415A (zh) * 2019-02-28 2019-06-28 东软集团股份有限公司 拦截器的配置方法、装置、存储介质及电子设备
CN112788075B (zh) * 2019-11-07 2024-04-09 北京京东尚科信息技术有限公司 一种业务服务的监控方法和装置
CN112346778B (zh) * 2020-10-28 2022-02-08 常州微亿智造科技有限公司 一种Java程序编译时自动生成字节码的优化方法
CN112926049A (zh) * 2021-03-25 2021-06-08 支付宝(杭州)信息技术有限公司 一种信息的风险防控方法、装置及设备
CN113672205B (zh) * 2021-08-25 2022-06-03 广州方舟信息科技有限公司 一种基于业务事件驱动的工作流框架
CN114205156A (zh) * 2021-12-13 2022-03-18 中国农业银行股份有限公司 面向切面技术的报文检测方法、装置、电子设备及介质
CN116049582B (zh) * 2023-03-31 2023-07-04 深圳依时货拉拉科技有限公司 WebView监控方法、计算机设备和计算机可读存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080141335A1 (en) * 2006-12-08 2008-06-12 Novell, Inc. Provisioning software with policy-appropriate capabilities
CN101276271A (zh) * 2007-03-29 2008-10-01 北京邮电大学 一种面向切面编程的拦截器系统及方法
CN103150155A (zh) * 2011-12-07 2013-06-12 金蝶软件(中国)有限公司 数据拦截方法和装置
CN106844153A (zh) * 2017-01-20 2017-06-13 北京奇虎科技有限公司 应用程序运行监控方法、装置以及终端

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102508668B (zh) * 2011-11-11 2014-11-05 西安交通大学 一种基于动态栈的ejb3.0容器aop实现方法
US8997042B2 (en) * 2012-10-15 2015-03-31 Pivotal Software, Inc. Flexible and run-time-modifiable inclusion of functionality in computer code
CN103793232A (zh) * 2014-02-20 2014-05-14 浪潮集团山东通用软件有限公司 一种基于aop的构件调用和扩展框架实现方法
CN107092488B (zh) * 2017-03-31 2020-06-16 武汉斗鱼网络科技有限公司 一种对应用进行无侵入化埋点的实现方法及系统

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080141335A1 (en) * 2006-12-08 2008-06-12 Novell, Inc. Provisioning software with policy-appropriate capabilities
CN101276271A (zh) * 2007-03-29 2008-10-01 北京邮电大学 一种面向切面编程的拦截器系统及方法
CN103150155A (zh) * 2011-12-07 2013-06-12 金蝶软件(中国)有限公司 数据拦截方法和装置
CN106844153A (zh) * 2017-01-20 2017-06-13 北京奇虎科技有限公司 应用程序运行监控方法、装置以及终端

Also Published As

Publication number Publication date
CN108196833A (zh) 2018-06-22
CN108196833B (zh) 2021-02-02

Similar Documents

Publication Publication Date Title
WO2019136844A1 (zh) Aop代理框架的实现方法、存储介质、电子设备及系统
US8479283B2 (en) Generating security validation code automatically
US8261248B2 (en) System and method of executing a dynamic program in a structured environment
US10303449B2 (en) Compiling non-native constants
US10949220B2 (en) Object-oriented programming system and library
Cohen et al. AspectJ2EE= AOP+ J2EE: Towards an Aspect Based, Programmable, and Extensible Middleware Framework
US20180293058A1 (en) Flow-based scoping
US20060212861A1 (en) Typed intermediate representation for object-oriented languages
Patrignani et al. Secure compilation of object-oriented components to protected module architectures
CN113254317A (zh) 基于字节码的指标自动生成方法及系统
Wada et al. Modeling turnpike frontend system: A model-driven development framework leveraging UML metamodeling and attribute-oriented programming
US10853110B2 (en) Constructor accessibility checks for deserialization
US11886326B2 (en) Configuring test operations on a per-module basis
Briand et al. Instrumenting contracts with aspect-oriented programming to increase observability and support debugging
US10120777B1 (en) Remediating serialization incompatibilities
US8196152B2 (en) Container context information propagation in an aspect-oriented environment
US20110321009A1 (en) Implementing encryption via aspect oriented programming
Saleh et al. A concurrency control mechanism for C++ objects
Ponge et al. Jooflux: Hijacking java 7 invokedynamic to support live code modifications
Bencomo et al. Reflection and aspects meet again: Runtime reflective mechanisms for dynamic aspects
Marty et al. LIO*: Low Level Information Flow Control in F
Luca et al. A Metric-Based Approach to Modelling a Virtual Machine for Smart Contract Execution
CN113419919B (zh) 一种对第三方sdk进行线程监控的方法
Duck et al. Compiling ask constraints
KR101024707B1 (ko) 바이트코드-투-씨 어헤드-오브-타임 컴파일러를 위한 해석기 호출 방법

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18900211

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18900211

Country of ref document: EP

Kind code of ref document: A1