Aop-based business enhancement method and device, computer device and storage medium

By using AOP-based business enhancement methods, dynamic hot-plugging technology, and storage center management to enhance configuration information, the problems of large code size and difficult maintenance in information systems are solved. This enables dynamic enhancement and hot start/stop of business functions, and optimizes program structure and management efficiency.

CN115373653BActive Publication Date: 2026-01-06ZHONGKE YUNGU TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211021750.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-24
Publication Date
2026-01-06
Estimated Expiration
2042-08-24

AI Technical Summary

Technical Problem

In existing information systems, when the same function is implemented in different business scenarios according to different needs, a large amount of business branch logic code needs to be written. This results in excessively large and difficult-to-understand code, and it is impossible to dynamically start and stop new business functions and customize their management, which increases the complexity and maintenance difficulty of the program.

Method used

A service enhancement method based on AOP is adopted. By using the implementation class annotated with AOP as the entry point, dynamic hot-plugging technology and storage center management enhance configuration information are used to realize dynamic enhancement and hot start/stop of service functions.

Benefits of technology

The program structure was optimized, improving the flexibility and responsiveness of business methods and reducing development and maintenance costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115373653B_ABST
    Figure CN115373653B_ABST
Patent Text Reader

Abstract

The application relates to an AOP-based business enhancement method and device, computer equipment and a storage medium. The method comprises the following steps: obtaining an implementation class marked with an AOP annotation in a system main program, which is used as a pointcut to connect a branch program corresponding to a business function; obtaining enhancement configuration information defined by each pointcut and persisting the enhancement configuration information to a first storage center; loading the enhancement configuration information of the pointcut in the first storage center into a second storage center according to business function requirements; performing dynamic configuration management on the loaded enhancement configuration information; loading an AOP interceptor when the system main program is running, intercepting the pointcut, extracting enhancement configuration information associated with at least one pointcut corresponding to a business function in the second storage center, connecting a branch program corresponding to the business function according to the extracted enhancement configuration information, and enhancing the business function. The method can dynamically enhance and hot start and stop the business function under the same system main program.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a service enhancement method, apparatus, computer device, and storage medium based on AOP. Background Technology

[0002] With the rapid development of information technology, the requirements for information technology construction are getting higher and higher. In application development, when enterprises make adjustments to related business, they often expect the corresponding information systems to also be changed to respond to the related business.

[0003] In the process of improving the information system, the inventors of this application discovered at least the following technical problems in the prior art:

[0004] (1) When the same function is implemented in different business scenarios according to different needs, a large amount of business branch logic code needs to be written and a large amount of code needs to be adjusted, resulting in excessively large and difficult-to-understand code, which brings a lot of workload to later expansion and maintenance, for example in SAAS software architecture.

[0005] (2) Currently, program refactoring is commonly used to accommodate the expansion and adjustment of various business functions. During the refactoring process, the logic of each business branch is extracted into methods or abstracted into interfaces for unified management and modification. However, these methods cannot avoid the continuous addition of business branches to the main process code, cannot realize the custom dynamic start and stop of new business functions, are highly intrusive, increase the complexity of the program, make the program difficult to understand, and are not conducive to system operation and maintenance.

[0006] (3) Add branch logic to the corresponding part of the main process code according to business needs. For example, extract the branch logic into methods or abstract it into multiple implementations of the interface. However, these methods are prone to causing the main process to be bloated due to the large number of business branches, the logical structure is not clear enough, it is not easy to manage and maintain the code, and it is also impossible to realize the dynamic start and stop of the function as needed. Summary of the Invention

[0007] Therefore, it is necessary to provide an AOP-based service enhancement method, apparatus, computer device, and storage medium to address the aforementioned technical problems. This method can dynamically enhance and hot-start / stop service functions under the same system main program according to the service enhancement configuration.

[0008] Firstly, this application provides a service enhancement method based on AOP, the method comprising:

[0009] Obtain at least one implementation class annotated with AOP in the main program of the system, and use the implementation class as the entry point to connect the branch program of the corresponding business function;

[0010] Retrieve the enhanced configuration information of each entry point's custom settings and persist it to the primary storage center;

[0011] Based on business function requirements, the enhanced configuration information of at least one entry point in the first storage center is loaded and cached in the second storage center;

[0012] Dynamic configuration management of the enhanced configuration information loaded into the cache is performed using dynamic hot-plug technology;

[0013] When the main program of the system is running, an AOP interceptor is loaded to intercept the entry point in order to extract the enhanced configuration information associated with at least one entry point of the corresponding business function in the second storage center.

[0014] Based on the extracted enhanced configuration information, connect the branch programs corresponding to the business functions to enhance those functions.

[0015] In one embodiment, before obtaining at least one implementation class annotated with AOP in the system main program, the process includes:

[0016] Create an AOP aspect for the system's main program, and annotate the implementation classes that enhance business logic on the AOP aspect to define the pointcut.

[0017] In one embodiment, the step of obtaining the enhanced configuration information of each of the custom settings for the entry points and persisting it to the first storage center includes:

[0018] Obtain the enhanced configuration information for the custom settings of each of the aforementioned entry points;

[0019] Determine whether each of the aforementioned entry points has been persistently stored in the first storage center;

[0020] If the cut-off point is not persistently stored in the first storage center, then the cut-off point and the corresponding enhanced configuration information are persistently stored in the first storage center.

[0021] If the cut-off point has been persistently stored in the first storage center, then the response is not to persist the cut-off point to the first storage center.

[0022] In one embodiment, the step of obtaining the enhanced configuration information of each cut-off point's custom settings and persisting it to the first storage center includes:

[0023] The configuration of each entry point in the first storage center is displayed through a visual interactive interface.

[0024] If no enhanced configuration information is set in the configuration of the entry point, the enhanced configuration information of the custom settings of the corresponding entry point will be obtained by using the tag information of the pre-stored configuration form.

[0025] In one embodiment, the step of loading and caching the enhanced configuration information of at least one of the entry points in the first storage center to the second storage center according to business function requirements, and dynamically managing the enhanced configuration information using dynamic hot-plug technology includes:

[0026] The business function requirements are obtained using the visual interactive interface.

[0027] Based on business function requirements, select at least one entry point from the primary storage center;

[0028] Load the enhanced configuration information of the selected entry point into the second storage center;

[0029] Dynamic hot-plugging technology is used to dynamically manage the enhanced configuration information of the call entry point.

[0030] In one embodiment, the enhanced configuration information includes business dimension, entry point location, class to which the business function belongs, business function name, whether to skip the main method option, whether to use an independent transaction option, sequence number, and whether to enable the option.

[0031] In one embodiment, the step of connecting the system main program to the branch program corresponding to the business function includes:

[0032] Based on the business dimension, the entry point is connected to the branch program corresponding to the business function, so that the selected entry point is connected to at least one branch program in the same business dimension.

[0033] When the selected entry point corresponds to multiple branch programs in the same business dimension, the branch programs are executed sequentially according to the sequence number.

[0034] In a first aspect, this application provides a service enhancement device based on AOP, the device comprising:

[0035] The annotation acquisition module is used to obtain at least one implementation class of the AOP annotation in the main program of the system, and use the implementation class as the entry point to connect the branch program of the corresponding business function;

[0036] The first storage module is used to obtain the enhanced configuration information customized by each entry point and persist it to the first storage center;

[0037] The second storage module is used to load and cache the enhanced configuration information of at least one entry point in the first storage center to the second storage center according to business function requirements.

[0038] The configuration management module is used to dynamically manage the loaded cached enhanced configuration information using dynamic hot-plug technology.

[0039] The program interception module is used to load the AOP interceptor when the system main program is running, and intercept the entry point to extract the enhanced configuration information associated with at least one entry point of the corresponding business function in the second storage center.

[0040] The business enhancement module is used to connect to the branch programs of the corresponding business functions based on the extracted enhancement configuration information, so as to enhance the business functions.

[0041] Thirdly, this application provides a computer device including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to perform the following steps:

[0042] Obtain at least one implementation class annotated with AOP in the main program of the system, and use the implementation class as the entry point to connect the branch program of the corresponding business function;

[0043] Retrieve the enhanced configuration information of each entry point's custom settings and persist it to the primary storage center;

[0044] Based on business function requirements, the enhanced configuration information of at least one entry point in the first storage center is loaded and cached in the second storage center;

[0045] Dynamic hot-plugging technology is used to dynamically manage the enhanced configuration information loaded from the cache.

[0046] When the main program of the system is running, an AOP interceptor is loaded to intercept the entry point in order to extract the enhanced configuration information associated with at least one entry point of the corresponding business function in the second storage center.

[0047] Based on the extracted enhanced configuration information, connect the branch programs corresponding to the business functions to enhance those functions.

[0048] Fourthly, this application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, performs the following steps:

[0049] Obtain at least one implementation class annotated with AOP in the main program of the system, and use the implementation class as the entry point to connect the branch program of the corresponding business function;

[0050] Retrieve the enhanced configuration information of each entry point's custom settings and persist it to the primary storage center;

[0051] Based on business function requirements, the enhanced configuration information of at least one entry point in the first storage center is loaded and cached in the second storage center;

[0052] Dynamic hot-plugging technology is used to dynamically manage the enhanced configuration information loaded from the cache.

[0053] When the main program of the system is running, an AOP interceptor is loaded to intercept the entry point in order to extract the enhanced configuration information associated with at least one entry point of the corresponding business function in the second storage center.

[0054] Based on the extracted enhanced configuration information, connect the branch programs corresponding to the business functions to enhance those functions.

[0055] The aforementioned AOP-based service enhancement method, apparatus, computer equipment, and storage medium can dynamically enhance and hot-start / stop service functions under the same system main program.

[0056] By annotating the implementation classes (interfaces) of the system's main program with AOP annotations, AOP technology is effectively integrated, enabling the rapid scanning of implementation classes that can connect to branch programs, serving as AOP entry points. Since the implementation classes in the main program are fixed, but the branch programs connecting them are not, any required business functionality can be extended around the same main program. Persisting each entry point and its enhanced configuration information to the first storage center is equivalent to the first storage center operating on a unit basis, with each entry point and its enhanced configuration information as a separate unit. Caching the entry points and their enhanced configuration information required by the business function to the second storage center can be understood as the second storage center loading and calling the entry points and their enhanced configuration information involved in the business function as a whole. Since any business function's required entry points and their enhanced configuration centers can be called from the first storage center, dynamically configured, and then cached in the second storage center, the entry points and their enhanced configuration centers in the first storage center can be reused. For the dynamically configured enhanced configuration centers associated with the entry points in the second storage center, dynamic hot-swapping technology allows for flexible hot-start and hot-stop of any business function. It helps to streamline the main business process, optimize the program structure, and achieve flexible management of business methods. The configuration-based dynamic loading and execution method can also improve the response speed to business changes and improve development and operation efficiency. Attached Figure Description

[0057] Figure 1 This is an application environment diagram of an AOP-based service enhancement method in one embodiment.

[0058] Figure 2 This is a block diagram illustrating the principle of a service enhancement method in one embodiment.

[0059] Figure 3 This is an application scenario diagram of an AOP-based service enhancement method in one embodiment.

[0060] Figure 4 This is a structural block diagram of an AOP-based service enhancement device in one embodiment; Detailed Implementation

[0061] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0062] The business enhancement method based on Aspect-Oriented Programming (AOP) provided in this application, such as... Figure 1 As shown, the method includes the following steps:

[0063] Step S100: Obtain at least one implementation class marked with AOP annotation in the main program of the system, and use the implementation class as the entry point to connect the branch program of the corresponding business function.

[0064] Step S200: Obtain the enhanced configuration information of each entry point's custom settings and persist it to the first storage center.

[0065] Step S300: Based on business function requirements, load and cache the enhanced configuration information of at least one entry point in the first storage center to the second storage center.

[0066] Step S400: Dynamic configuration management of the enhanced configuration information loaded from the cache is performed using dynamic hot-plug technology.

[0067] Step S500: When the system main program is running, load the AOP interceptor to intercept the entry point in order to extract the enhanced configuration information associated with at least one entry point corresponding to the business function in the second storage center.

[0068] Step S600: Based on the extracted enhanced configuration information, connect the branch program corresponding to the business function to enhance the business function.

[0069] In one implementation, step S100 is predicated on at least one implementation class in the system main program being annotated with AOP so that the implementation class can be used as a pointcut to connect to branch programs that extend business functions. That is, based on the extension requirements of business functions, it is necessary to pre-plan and define the implementation class as the pointcut, annotate the implementation class with AOP, and then annotate it at the location of the implementation class in the system main program. Therefore, in one implementation, before executing step S100: obtaining at least one implementation class annotated with AOP in the system main program, the following steps are included:

[0070] Create an AOP aspect for the system's main program, and annotate the implementation classes that enhance business logic on the AOP aspect to define the pointcut.

[0071] Specifically, for example, if the annotation for the entry point can be defined as @MomReplenish, then the annotation needs to be added to the main business process method of the product decomposition order where depOrder(params) is located.

[0072] In this context, AOP stands for Aspect-Oriented Programming, used to enhance business functionality without modifying the source code; join point represents all running methods (join points include pointcuts); pointcut represents the join point that needs to be enhanced; aspect describes the correspondence between advice and pointcut; advice represents the enhanced operation, that is, the functionality that the pointcut needs to enhance; advice class represents the class where the advice method is located; and implementation class represents the content agreed upon in the interface.

[0073] Step S200, which involves obtaining the enhanced configuration information customized for each entry point and persisting it to the first storage center, includes:

[0074] Obtain the enhanced configuration information for the custom settings of each of the aforementioned entry points;

[0075] Determine whether each of the aforementioned entry points has been persistently stored in the first storage center;

[0076] If the cut-off point is not persistently stored in the first storage center, then the cut-off point and the corresponding enhanced configuration information are persistently stored in the first storage center.

[0077] If the cut-off point has been persistently stored in the first storage center, then the response is not to persist the cut-off point to the first storage center.

[0078] Therefore, this step can be understood as follows: when the implementation class is used as the entry point and has been persistently stored in the first storage center, the first storage center will not be updated when the main program of the system starts scanning.

[0079] In this embodiment, the first storage center can be a database server, and the second storage center can be a cache server; there are no particular limitations on this. In this embodiment, the first storage center stores entry points and their enhanced configuration information using persistent storage technology, based on entry points themselves; the second storage center stores entry points and their enhanced configuration information using caching technology, based on business functions.

[0080] The persistent storage pointcut and its enhanced configuration information refer to saving the pointcut and its enhanced configuration information to a storage device that can be permanently stored (such as a disk). Persistence technology is a mechanism for converting program data between persistent and transient states. Caching technology, compared to the storage devices required by persistent technology, uses a "faster" storage device to store frequently used data for quick access, without needing to interact with a "slower" device each time, thereby improving access efficiency.

[0081] To further explain, when the system main program starts, it scans the implementation classes annotated with AOP. When an implementation class annotated with AOP is scanned for the first time as a pointcut, this first scanned implementation class is persisted to the first storage center as a pointcut. When an implementation class annotated with AOP is scanned for a pointcut other than the first time, the first storage center will not be updated for the non-first scanned implementation classes. That is, for existing pointcuts, the first storage center does not add or replace pointcuts. It is equivalent to once a pointcut is persisted to the first storage center, it will be permanently stored in the first storage center, and then various enhancement configuration information is added to the first storage center. In this embodiment, the first storage center stores pointcuts and their enhancement configuration information uniformly. Any pointcut and its enhancement configuration information required by any business function can be called from the first storage center, thereby reusing the stored pointcut configurations.

[0082] In one embodiment, step S200: obtaining the enhanced configuration information of the custom settings of each entry point and persisting it to the first storage center may include steps S210-S220.

[0083] Step S210: Display the configuration of each entry point of the first storage center through a visual interactive interface.

[0084] The configuration status of the entry point of the first storage center includes whether the enhanced configuration information has been set or not. When the configuration status is that the enhanced configuration information has not been set, proceed to step S220.

[0085] Step S220: If no enhanced configuration information is set in the configuration of the entry point, the enhanced configuration information of the custom settings of the corresponding entry point is obtained by using the tag information of the pre-stored configuration form.

[0086] In one embodiment, for the entry point identified in the initial scan, the user can manage enhanced configuration information through a visual interactive interface, such as filling in the enhanced configuration information for that entry point. Therefore, in one embodiment, the enhanced configuration information for the custom settings of the corresponding entry point is obtained by utilizing the tag information of the pre-stored configuration form, including: receiving the input enhanced configuration information for the entry point through the visual interactive interface.

[0087] Specifically, the visual interactive interface displays the configuration status of each entry point in the current system's main program using a list of entry points. When the configuration status corresponding to an entry point in the list is empty, selecting "Add Configuration Form" retrieves a preset unified configuration form related to the entry point. The configuration form includes label information and corresponding input boxes, allowing users to obtain customized enhanced configuration information through the corresponding label information input boxes.

[0088] The enhanced configuration information in this embodiment includes at least the business dimension, entry point location, class to which the business function belongs, business function name, whether to skip the main method option, whether to use an independent transaction option, sequence number, and whether to enable the option.

[0089] To further explain, the business dimension can be a factory, which in the program represents a class responsible for creating objects of other types. In this embodiment, the business dimension is used to define business functions. For example, two different business dimensions may use the same entry point, and the different business functions can be distinguished by the business dimension. If the business dimension is not used for definition, it would be impossible to reuse the entry point to execute different business functions. In this embodiment, the entry point position can be one of before, after, around, afterRunning, or afterThrowing. The class to which the business function belongs represents associating the business function or rule with the implementation class. The enhanced configuration information of any entry point is set with a sequence number, which is used to reasonably arrange the execution order of business functions corresponding to different entry points under the same business dimension.

[0090] For further explanation, please refer to the appendix. Figure 2 The diagram shown illustrates the principle block of a business enhancement method in this embodiment. For the same entry point, the enhancement configuration information corresponding to different business dimensions can be different. For example, when executing the `depOrder(params)` method, it is necessary to execute the business function `depByOrderParts(params)` on users of factory A and the business function `depByOrderBom(params)` on users of factory B. Since the entire process must be within a single transaction, the corresponding business dimension enhancement configuration can be added at the `around` point.

[0091] For example, for the same entry point, the enhancement configuration information corresponding to different business dimensions is the same. For factory A and factory B, the business function is configured at the entry point around of the enhancement point depOrder(params). When the order decomposition operation is performed, if it is a user of factory A, in addition to generating orders by decomposing according to the host product, the order depByOrderParts(params) will also be decomposed according to the virtual component relationship of the host product.

[0092] Furthermore, by scanning the entry points on the main program of the system, the entry points scanned for the first time are persisted to the first storage center; the configuration status of the entry points currently persisted in the first storage center is reflected by the visual interactive interface; after determining that the entry point has no enhanced configuration information configured, the enhanced configuration information of the custom settings for the entry point is obtained by using the label information of the pre-stored configuration form, and persisted to the first storage center.

[0093] Furthermore, the system's main program's entry points and their configurations are displayed through a visual interactive interface. The system also obtains the operator's execution instructions through the visual interactive interface and manages the entry points' configurations. This entry point configuration management includes customizing the enhanced configuration information of the entry points and persisting it to the first storage center, as well as dynamically loading the enhanced configuration information of the entry points from the first storage center and caching it to the second storage center.

[0094] In step S300, the step of loading and caching the enhanced configuration information of at least one of the entry points in the first storage center to the second storage center according to the business function requirements includes:

[0095] Step S310: Obtain business function requirements using a visual interactive interface;

[0096] Step S320: Select at least one of the entry points from the first storage center according to the business function requirements;

[0097] Step S330: Load the enhanced configuration information of the selected entry point into the second storage center.

[0098] The second storage center stores at least one entry point and its enhanced configuration information, organized by business function. Different business functions can pre-select the entry points involved, and then retrieve the entry points and their enhanced configuration information from the first storage center. The enhanced configuration information of the involved entry points is dynamically configured according to the logical flow of the business function to form a complete business logic. It can be seen that the AOP-based business enhancement method in this embodiment enhances and extends the business functions of the implementation classes annotated with AOP in the system's main program.

[0099] To further explain, the business functions in this embodiment correspond to business dimensions; that is, the same entry point will have different business dimension information in different business functions. In this embodiment, for newly added business functions, the relevant entry points and their enhanced configuration information are invoked. Although the entry points and their enhanced configuration information are invoked at this time, the connection between the system main program and branch programs has not yet been established. Dynamic hot-plugging of the configuration is required before it can be used. Therefore, this embodiment also includes step S400: using dynamic hot-plugging technology to dynamically manage the loaded cached enhanced configuration information.

[0100] Dynamic configuration management can be understood as adjusting the enhanced configuration information for the call entry point. For example, redefining the "yes" or "no" options for skipping the main method, independent transactions, and enabling / disabling the configuration. Using dynamic hot-plugging technology, after redefining the enhanced configuration information, the corresponding business branch program can be directly loaded onto the main program without restarting the main program.

[0101] The business functions can be managed and configured through dynamic hot-swappable technology. For example, the implementation class marked with AOP annotation in the main program of the system is depOrder(params), and the corresponding connectable branch programs can be depByOrderParts(params) and depByOrderBom(params).

[0102] The `depByOrderParts(params)` function decomposes orders based on the virtual component relationships of the orders; the `depByOrderBom(params)` function decomposes orders based on the BOM hierarchical structure of the orders, thus enabling the implementation of two business functions at the same entry point.

[0103] In this embodiment, all scanned entry points and their enhanced configuration information are first persisted to the first storage center. For the enhancement and extension needs of different business functions, the enhanced configurations of each entry point involved in each business function are dynamically loaded. Therefore, for any enhancement and extension need of a business function, the enhanced configuration information of the involved entry points is dynamically managed and loaded into the second storage center through a visual interactive interface and dynamic hot-swapping technology. This allows the corresponding business function's branch program to be directly retrieved from the second storage center during system operation.

[0104] The dynamic hot-swap technology in this embodiment can be understood as the enhanced configuration information of the entry point being dynamically configured during the operation of the main program. This allows the branch program of the corresponding business function to be connected to the main program through the entry point without restarting the main program.

[0105] In step S500, when the system main program is running, an AOP interceptor is loaded to intercept the entry point in order to extract the enhanced configuration information associated with at least one entry point corresponding to the business function in the second storage center.

[0106] In AOP (Aspect-Oriented Programming) technology, interceptors are used to intercept requests before a method or field is accessed, and then add certain operations before or after the request. Interceptors are invoked through proxies. For example, in Java programs, Struts2 interceptor implementations are relatively simple. When a request arrives at the Struts2 ServletDispatcher, Struts2 looks up the configuration file, instantiates the corresponding interceptor object according to the configuration, and then chains them into a list. The interceptors in the list are then invoked one by one. Struts2 interceptors are pluggable, and interceptors are an implementation of AOP. The Struts2 interceptor stack is a chain of interceptors connected in a specific order. When an intercepted method or field is accessed, the interceptors in the Struts2 interceptor chain are invoked in the previously defined order.

[0107] This step involves intercepting the entry point using an AOP interceptor while the main system program is running. Then, it extracts the enhanced configuration information associated with at least one entry point corresponding to a business function from the second storage center, so as to connect the branch program through the enhanced configuration information of the entry point.

[0108] Step S600: Based on the enhanced configuration information, connect the branch program corresponding to the business function to enhance the business function.

[0109] The step of connecting the main program of the system to the branch program corresponding to the business function includes:

[0110] Based on the business dimension, the entry point is connected to the branch program corresponding to the business function, so that the selected entry point is connected to at least one branch program in the same business dimension.

[0111] When the entry point corresponds to multiple branch programs in the same business dimension, the branch programs are executed sequentially according to the sequence number.

[0112] To further explain, once the enhanced configuration information for the entry points corresponding to the business functions is dynamically configured and cached in the second storage center, when the main program of the system runs, the AOP interceptor is loaded to intercept the entry points annotated (e.g., MomReplenish). Based on the business dimension to which the login object belongs, all enabled configuration items at the corresponding entry point position (before, after, around) are retrieved from the second storage center. Each configuration item is retrieved and executed in ascending order of its sequence number. This includes setting transactions and skipping the main method, as well as executing the business functions in the class to which the business functions in the configuration information belong through Java reflection to achieve the purpose of business extension.

[0113] According to the aforementioned AOP-based business enhancement method, annotating the implementation classes (interfaces) of the system main program with AOP annotations is equivalent to combining AOP technology to quickly scan for implementation classes that can connect to branch programs, serving as AOP entry points. Since the implementation classes in the system main program are fixed, but the branch programs connecting them are not, it can be seen that any required business function can be extended around the same system main program. Persisting each entry point and its enhancement configuration information to the first storage center is equivalent to the first storage center being a unit based on individual entry points and their enhancement configuration information; caching the entry points and their enhancement configuration information required by the business function to the second storage center is equivalent to the second storage center being a unit based on the entry points and their enhancement configuration centers involved in the business function. Since any entry point and its enhancement configuration center required by any business function can be called from the first storage center, dynamically configured, and then cached in the second storage center, the entry points and their enhancement configuration centers in the first storage center can be reused; for the dynamically configured enhancement configuration centers associated with the entry points in the second storage center, dynamic hot-swapping technology allows for flexible hot-start and hot-stop of any business function. It helps to streamline the main business process, optimize the program structure, and achieve flexible management of business methods. The configuration-based dynamic loading and execution method can also improve the response speed to business changes and improve development and operation efficiency.

[0114] This application also provides an application scenario in which the above-mentioned AOP-based service enhancement method is applied. Specifically, the application of the AOP-based service enhancement method in this scenario is as follows:

[0115] Reference Appendix Figure 3 The application environment shown includes: a first server 10, a second server 20, a third server 30, an execution terminal 40, a cache server 50, and a database server 60. The first server 10 is connected to the second server 20, the third server 30, the execution terminal 40, the cache server 50, and the database server 60.

[0116] The first server 10, acting as a configuration center, stores computer programs that execute AOP-based business enhancement methods. The second server 20 stores the main system program. The third server stores branch programs for different business functions. The database server 60, acting as the first storage center, persists entry points and their enhanced configuration information on a per-entry-point basis. The cache server 50, acting as the second storage center, stores the entry points involved in the business functions and the enhanced configuration information dynamically loaded. The execution terminal 40 uses a visual interactive interface to map the entry points and their enhanced configuration information in the first and second storage centers, performing configuration management for each entry point. The execution terminal 40 communicates with the first server 10 via a network. The execution terminal 40 can be, but is not limited to, a personal computer, laptop, smartphone, tablet, or portable wearable device. The first server 10, second server 20, third server 30, cache server 50, and database server 60 can be implemented using independent servers or a server cluster composed of multiple servers.

[0117] It should be understood that although the steps in the flowchart are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order constraint on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowchart may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.

[0118] In one embodiment, refer to Appendix Figure 4 As shown, an AOP-based service enhancement device is provided, comprising: a label acquisition module 100, a first storage module 200, a second storage module 300, a configuration management module 400, a program interception module 500, and a service enhancement module 600, wherein:

[0119] The annotation acquisition module 100 is used to acquire at least one implementation class of the AOP annotation in the main program of the system, and use the implementation class as the entry point to connect the branch program of the corresponding business function.

[0120] The first storage module 200 is used to obtain the enhanced configuration information of the custom settings of each entry point and persist it to the first storage center.

[0121] The second storage module 300 is used to load and cache the enhanced configuration information of at least one of the entry points in the first storage center to the second storage center according to the business function requirements.

[0122] The configuration management module 400 is used to dynamically manage the enhanced configuration information loaded and cached using dynamic hot-plug technology.

[0123] The program interception module 500 is used to load an AOP interceptor when the system main program is running, and to intercept the entry point in order to extract the enhanced configuration information associated with at least one entry point corresponding to the business function in the second storage center.

[0124] The business enhancement module 600 is used to connect to the branch program of the corresponding business function based on the extracted enhancement configuration information, so as to enhance the business function.

[0125] Specific limitations regarding the AOP-based service enhancement device can be found in the limitations of the AOP-based service enhancement method described above, and will not be repeated here. Each module in the aforementioned AOP-based service enhancement device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in the computer device in hardware form, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0126] In one embodiment, a computer device is provided, which may be a server. The computer device includes a processor, memory, a network interface, and a database connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage medium. The database stores program data for an AOP-based service enhancement method. The network interface communicates with external terminals via a network connection. When the computer program is executed by the processor, it implements an AOP-based service enhancement method.

[0127] In one embodiment, a computer device is provided, which may be a terminal. The computer device includes a processor, memory, a network interface, a display screen, and an input device connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The network interface is used to communicate with external terminals via a network connection. When the computer program is executed by the processor, it implements an AOP-based service enhancement method. The display screen may be a liquid crystal display (LCD) or an e-ink display. The input device may be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the computer device casing, or an external keyboard, touchpad, or mouse.

[0128] Those skilled in the art will understand that the structure given in this embodiment is only a partial structure related to the solution of this application and does not constitute a limitation on the computer device on which the solution of this application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine some components, or have different component arrangements.

[0129] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:

[0130] Obtain at least one implementation class annotated with AOP in the main program of the system, and use the implementation class as a point of entry to connect the branch program of the corresponding business function;

[0131] Retrieve enhanced configuration information for each entry point's custom settings and persist it to the primary storage center;

[0132] According to the business function requirements, the enhanced configuration information of at least one of the entry points in the first storage center is loaded and cached to the second storage center;

[0133] Dynamic configuration management of the enhanced configuration information loaded into the cache is performed using dynamic hot-plug technology;

[0134] When the main program of the system is running, an AOP interceptor is loaded to intercept the entry point in order to extract the enhanced configuration information associated with at least one entry point of the corresponding business function in the second storage center.

[0135] Based on the extracted enhanced configuration information, connect the branch programs corresponding to the business functions to enhance those functions.

[0136] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:

[0137] Obtain at least one implementation class annotated with AOP in the main program of the system, and use the implementation class as a point of entry to connect the branch program of the corresponding business function;

[0138] Retrieve the enhanced configuration information of each entry point's custom settings and persist it to the primary storage center;

[0139] According to the business function requirements, the enhanced configuration information of at least one of the entry points in the first storage center is loaded and cached to the second storage center;

[0140] Dynamic configuration management of the enhanced configuration information loaded into the cache is performed using dynamic hot-plug technology;

[0141] When the main program of the system is running, an AOP interceptor is loaded to intercept the entry point in order to extract the enhanced configuration information associated with at least one entry point of the corresponding business function in the second storage center.

[0142] Based on the extracted enhanced configuration information, connect the branch programs corresponding to the business functions to enhance those functions.

[0143] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0144] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0145] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.

Claims

1. A method for AOP-based business enhancement, characterized in that, The method comprises: obtaining at least one implementation class of AOP annotation in a system main program, and using the implementation class as a pointcut to connect a branch program corresponding to a business function; obtaining enhancement configuration information customized by each pointcut, and persisting the enhancement configuration information to a first storage center; The step of obtaining the enhancement configuration information customized by each pointcut and persisting the enhancement configuration information to the first storage center comprises: obtaining the enhancement configuration information customized by each pointcut; determining whether each pointcut has been persistently stored in the first storage center; if the pointcut has not been persistently stored in the first storage center, persistently storing the pointcut and the corresponding enhancement configuration information in the first storage center; and if the pointcut has been persistently stored in the first storage center, not responding to the pointcut persistently stored in the first storage center. The step of obtaining the enhancement configuration information customized by each pointcut and persisting the enhancement configuration information to the first storage center further comprises: displaying the configuration of each pointcut in the first storage center through a visual interactive interface; and if the enhancement configuration information is not set in the configuration of the pointcut, obtaining the enhancement configuration information customized by the pointcut by using pre-stored label information of a configuration form. According to the business function requirement, the enhancement configuration information of at least one pointcut in the first storage center is loaded into a second storage center. The enhancement configuration information loaded into the cache is dynamically configured and managed by using dynamic hot plug technology. When the system main program is running, an AOP interceptor is loaded to intercept the pointcut to extract the enhancement configuration information associated with at least one pointcut corresponding to the business function in the second storage center. According to the extracted enhancement configuration information, a branch program corresponding to the business function is connected to enhance the business function.

2. The AOP-based business enhancement method of claim 1, wherein, Before obtaining at least one implementation class of AOP annotation in a system main program, the method comprises: An AOP aspect of the system main program is created, and an implementation class for implementing business enhancement is annotated with an AOP annotation on the AOP aspect to define the pointcut.

3. The AOP-based business enhancement method of claim 1, wherein, The step of loading the enhancement configuration information of at least one pointcut in the first storage center into a second storage center according to the business function requirement comprises: The visual interactive interface is used to obtain the business function requirement; According to the business function requirement, at least one pointcut is selected from the first storage center; The enhancement configuration information of the selected pointcut is loaded into the second storage center.

4. The AOP-based business enhancement method of claim 1, wherein, The enhancement configuration information comprises business dimension, pointcut position, business function class, business function name, whether to skip main method option, whether to be an independent transaction option, sequence number, and whether to enable option.

5. The AOP-based business enhancement method of claim 4, wherein, The step of connecting the system main program to a branch program corresponding to the business function comprises: According to the business dimension, the cut-in point is connected to a branch program corresponding to the business function, so that the selected cut-in point is connected to at least one branch program in the same business dimension; When the selected cut-in point is connected to multiple branch programs in the same business dimension, the branch programs are executed in sequence according to the sequence number.

6. An AOP-based service enhancement apparatus, characterized by comprising: The device comprises: The annotation acquisition module is configured to acquire an implementation class of at least one annotation AOP annotation in a system main program, and use the implementation class as a cut-in point to connect a branch program corresponding to a business function; The first storage module is configured to acquire enhancement configuration information customized by each cut-in point, and persist the enhancement configuration information to a first storage center; The first storage module is further configured to acquire the enhancement configuration information customized by each cut-in point, determine whether each cut-in point has been persistently stored in the first storage center, persist the cut-in point and the corresponding enhancement configuration information in the first storage center if the cut-in point has not been persistently stored in the first storage center, and not respond to the cut-in point if the cut-in point has been persistently stored in the first storage center; The first storage module is further configured to display the configuration of each cut-in point in the first storage center through a visual interactive interface, and acquire the enhancement configuration information customized by the cut-in point by using pre-stored label information of a configuration form if the enhancement configuration information is not set in the configuration of the cut-in point; The second storage module is configured to load the enhancement configuration information of at least one cut-in point in the first storage center to a second storage center according to the business function requirement; The configuration management module is configured to perform dynamic configuration management on the loaded enhancement configuration information by using a dynamic hot plug technology; The program interception module is configured to load an AOP interceptor when the system main program is running, intercept the cut-in point, and extract the enhancement configuration information associated with the cut-in point corresponding to the business function in the second storage center; The business enhancement module is configured to connect a branch program corresponding to the business function according to the extracted enhancement configuration information, so as to enhance the business function. 7.A computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the computer device is configured to perform the method according to any one of claims 1-6 when the computer program is executed by the processor. The processor executes the computer program to implement the steps of the method of any one of claims 1 to 5.

8. A computer-readable storage medium having stored thereon a computer program, characterized in that The computer program is executed by the processor to implement the steps of the method of any one of claims 1 to 5.

Citation Information

Patent Citations

  • Method and device for realizing service enhancement

    CN110895468A

  • Method and device for collecting audit logs based on AOP aspect and readable medium

    CN111881102A