Online debugging method of application program, computer program product, equipment and medium

By introducing Spring context and Groovy Binding when the application starts, online debugging is implemented, which solves the problem of difficult fault location in the application production environment, improves debugging efficiency and security, and is suitable for complex network environments.

CN120763031APending Publication Date: 2025-10-10CHONGQING JINKANG NEW ENERGY VEHICLE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510715256.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-30
Publication Date
2025-10-10

AI Technical Summary

Technical Problem

Existing technologies make it difficult to locate faults in application production environments, resulting in a degraded user experience and serious losses. In addition, log maintenance costs are high, making it difficult to quickly and accurately locate the root cause of the fault.

Method used

When the application starts, the Spring application context is introduced, the beans are obtained and registered in the Groovy binding, the Groovy test script is received through the configured service endpoint, parsed and executed to obtain the test results, and online debugging is implemented.

Benefits of technology

Without shutting down or restarting, it improves the efficiency of online debugging, reduces resource consumption, is suitable for complex network environments, supports large-scale concurrent access, and implements fine-grained permission control.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120763031A_ABST
    Figure CN120763031A_ABST
Patent Text Reader

Abstract

The invention relates to an online debugging method of an application program, a computer program product, equipment and a medium, and the method comprises the steps: responding to the starting of the application program, and introducing a Spring application context; acquiring Bean of the application program based on the application context; the method comprises the following steps of: registering Bean in a Binding of a Grouping; and in response to the test request received by the configured service endpoint, analyzing the Grouping test script in the test request, and accessing the Bean through Binding in the execution process to obtain a test result. According to the method, the application context of Spring is introduced when the application program is started, all Bean of the application program is obtained through the application context, and the Bean is registered in the Binding of the Grouping, so that the Grouping test script can be received and directly executed through the configured service endpoint under the condition that the application program is not shut down or restarted, and the test efficiency of the Grouping test script is improved. The online debugging efficiency is improved while resource consumption during debugging is reduced, the method is suitable for various complex network environments, large-batch concurrent access support can be achieved, and subsequent fine-grained permission control is facilitated.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer, in particular to an online debugging method of application program, computer program product, device and medium. BACKGROUND

[0002] Application programs usually need to be put into production environment for use after testing in test environment. The production environment is the environment accessed by users, and the data in the production environment is real and has important value, so the production environment has very high stability requirements.

[0003] If the application program fails in the production environment, the printed log is usually analyzed to determine the root cause of the failure, but the log maintenance cost is high, and the demand for printing logs will change according to the performance of the failure, and the configuration and code of log printing need to be constantly modified to adapt to various problem troubleshooting scenarios, resulting in that it is difficult to quickly and accurately locate the root cause of the failure in the production environment, thereby affecting the user experience and causing serious losses. SUMMARY

[0004] In order to solve the above technical problems, the present application provides an online debugging method of application program, computer program product, device and medium.

[0005] In a first aspect, the present application provides an online debugging method of application program, the online debugging method comprising:

[0006] In response to the start of the application program, an application context of Spring is introduced;

[0007] Based on the application context, a Bean of the application program is obtained;

[0008] The Bean is registered in the Binding of Groovy;

[0009] In response to the test request received by the configured service endpoint, a Groovy test script in the test request is parsed, and the Bean is accessed through the Binding in the process of executing the Groovy test script to obtain a test result.

[0010] In one embodiment, the parsing of the Groovy test script in the test request and the accessing of the Bean through the Binding in the process of executing the Groovy test script to obtain a test result comprises:

[0011] Inherit the current instance of the GroovyController class using the Groovy class loader;

[0012] Configure the Groovy compiler according to preset information;

[0013] Initialize the GroovyShell object according to the Binding, the Groovy class loader and the Groovy compiler;

[0014] Parsing the Groovy test script based on the GroovyShell object to obtain Java bytecode;

[0015] During the execution of the Java bytecode, the Bean is accessed through the Binding to obtain the test result.

[0016] In one embodiment, configuring the Groovy compiler according to the preset information includes:

[0017] Setting the encoding mode of the Groovy compiler according to the encoding mode corresponding to the Groovy test script;

[0018] Set the GroovyService class as the script base class for the Groovy compiler.

[0019] In one embodiment, obtaining the Bean of the application based on the application context includes:

[0020] Get all beans in the application context;

[0021] Generate a Map instance based on the Bean;

[0022] Registering the Bean into the Groovy Binding includes:

[0023] The beans are registered in batches to the binding based on the map instance.

[0024] In one embodiment, before parsing the Groovy test script in the test request and accessing the Bean through the Binding during execution of the Groovy test script to obtain the test result, the method includes:

[0025] Parsing the test request to obtain user identity information and Groovy test script;

[0026] Performing identity authentication based on the identity information to obtain an identity authentication result;

[0027] If the identity authentication result indicates that the identity authentication is passed, the step of parsing the Groovy test script in the test request and accessing the Bean through the Binding during the execution of the Groovy test script to obtain the test result.

[0028] In one embodiment, performing identity authentication based on the identity information to obtain an identity authentication result includes:

[0029] Determine the scope of authority of the user based on the identity information;

[0030] Determine whether the scope of authority includes testing authority;

[0031] If so, generate the identity authentication result indicating that the identity authentication is successful.

[0032] In one embodiment, the process of executing the Java bytecode includes:

[0033] Get the annotation content of the method to be called;

[0034] If the annotation content includes the first annotation, verify the user authority according to the annotation content to obtain an authority verification result, and if the authority verification result indicates that the authority verification is passed, call the method to be called;

[0035] If the annotation content includes a second annotation, the method to be called is called to obtain a first return value, the first return value is filtered according to the annotation content, a second return value is determined, and the second return value is returned to the caller of the method to be called.

[0036] In a second aspect, the present application provides a computer program product, comprising a computer program / instruction, which implements the steps of the method described in the first aspect when executed by a processor.

[0037] In a third aspect, the present application provides a computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method described in the first aspect when executing the computer program.

[0038] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program / instruction stored thereon, which implements the steps of the method described in the first aspect when the computer program / instruction is executed by a processor.

[0039] On the basis of conforming to the common sense in this field, the above-mentioned preferred conditions can be arbitrarily combined to obtain the preferred embodiments of the present application.

[0040] The aforementioned online debugging method, computer program product, device, and medium for an application can achieve the following beneficial effects: introducing a Spring application context at application startup, obtaining all application beans through the application context, and registering them in a Groovy binding. This allows Groovy test scripts to be received and directly executed through the configured service endpoint without shutting down or restarting the application. This reduces resource consumption during debugging while improving online debugging efficiency. The method is applicable to various complex network environments and can support large-scale concurrent access. Furthermore, because this application implements online debugging at the application layer, it facilitates subsequent fine-grained permission management. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 1 is a flow chart of an online debugging method for an application program in one embodiment;

[0042] Figure 2 A schematic diagram of a module of an online debugging system for an application program in one embodiment;

[0043] Figure 3 is a first internal structure diagram of a computer device in one embodiment;

[0044] Figure 4 FIG. 4 is a second internal structure diagram of a computer device in one embodiment. DETAILED DESCRIPTION

[0045] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.

[0046] It should be noted that the diagrams provided in this embodiment are only schematic illustrations of the basic concept of the present application. The diagrams only show the components related to the present application and are not drawn according to the number, shape, and size of the components in actual implementation. The form, quantity, and proportion of each component in actual implementation can be changed at will, and the component layout form may also be more complex. The structures, proportions, sizes, etc. illustrated in the drawings of this specification are only used to match the content disclosed in the specification for people familiar with this technology to understand and read. They are not used to limit the limiting conditions for the implementation of this application and therefore have no technical significance. Any modification of the structure, change in the proportional relationship, or adjustment of the size should still fall within the scope of the technical content disclosed in this application without affecting the efficacy and purpose of the application. At the same time, the terms such as "upper", "lower", "left", "right", "middle", and "one" quoted in this specification are only for the convenience of description and are not used to limit the scope of the implementation of this application. Changes or adjustments in their relative relationships should also be considered as the scope of the implementation of this application without substantially changing the technical content.

[0047] References herein to "embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various places herein does not necessarily refer to the same embodiment, nor does it constitute an independent or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0048] As used herein, unless the context clearly indicates otherwise, the words "a," "an," "an," and / or "the" are not intended to refer to the singular and may include the plural. Generally speaking, the terms "include" and "comprise" only indicate the inclusion of the steps and elements specifically identified, and these steps and elements do not constitute an exclusive list. A method or apparatus may also include other steps or elements.

[0049] The definition of "include" herein, such as the terms "having", "may have", "include" or "may include" used herein, indicates the existence of the corresponding functions, operations, elements, etc. herein, and does not limit the existence of one or more other functions, operations, elements, etc. In addition, it should be understood that the terms "include" or "have" used herein refer to the existence of the features, numbers, steps, operations, elements, components or their combination described in the specification, and do not exclude the existence or addition of one or more other features, numbers, steps, operations, elements, components or their combination.

[0050] In the embodiments of the present application, prefixes such as "first" and "second" are used only to distinguish different description objects and have no limiting effect on the position, order, priority, quantity or content of the described objects. The use of prefixes such as ordinal numbers to distinguish description objects in the embodiments of the present application does not constitute a restriction on the described objects. For the statement of the described objects, please refer to the description in the context of the claims or embodiments, and the use of such prefixes should not constitute an unnecessary restriction. In addition, in the description of this embodiment, unless otherwise specified, the meaning of "plurality" is two or more.

[0051] The following is an explanation of the professional terms involved in this application:

[0052] Spring is an open source lightweight Java development framework that reduces the coupling between components through technologies such as dependency injection (DI) and aspect-oriented programming (AOP), providing a comprehensive and modular way to build enterprise-level applications.

[0053] Bean is an object instance managed by the Spring container, which controls the creation, initialization, and destruction of the Bean.

[0054] Groovy is a dynamic language based on the JVM (Java Virtual Machine). It combines many powerful features of Python, Ruby, and Smalltalk, enabling programmers to work more efficiently. Groovy can directly use Java class libraries, has strong interoperability with Java code, and can even dynamically compile Java classes at runtime. Its syntax is concise and supports dynamic typing (like Python) to improve development efficiency, as well as static typing (like Java) to improve performance. It also has a rich set of built-in tools, providing powerful APIs for string processing, collection operations, file I / O, and other functions to reduce boilerplate code.

[0055] Binding in Groovy is used to store variables and pass context when the script is executed, similar to Map in Java, providing runtime context for Groovy scripts.

[0056] This application introduces Spring's application context when the application starts, obtains all the application's beans through the application context, and registers them in the Groovy binding, so that the Groovy test scripts can be received and directly executed through the configured service endpoint without shutting down or restarting the application.

[0057] Compared with the prior art, the online debugging scheme provided in the application has less code amount, and when facing various debugging needs in the future, no additional log printing or service re-publishing is needed, and only a test personnel needs to write a Groovy test script according to a test requirement and upload the Groovy test script to a service endpoint, so that a test result can be obtained. Moreover, the online debugging scheme provided in the application has better universality, can be used in various complex network environments, and can support greater concurrent access and batch execution of Groovy test scripts, so that the universality and efficiency of online debugging can be significantly improved.

[0058] In one embodiment, the online debugging method of the application program provided in the application includes steps S101-S104 as shown in the following table: Figure 1

[0059] S101, in response to application program startup, introducing a Spring application context.

[0060] The Spring application context (ApplicationContext) is the core of the Spring framework, and is responsible for managing the life cycle and dependency injection of a Bean. When the application program starts, the Spring framework is first initialized, various resources are loaded according to a configuration file, properties in the configuration file are parsed, and the properties are converted into objects that can be recognized and processed by the Spring. Then, classes marked by annotations such as @Component, @Service, @Repository, and @Controller are searched, an instance of a BeanDefinition object is created for these classes, and the instance of the BeanDefinition object is registered in the Spring application context, so as to realize the definition and registration of the Bean. The BeanDefinition is an interface for describing metadata information of a Bean in the Spring container, and is used to store and retrieve metadata information of the Bean, such as class information, attribute information, behavior characteristics, dependency relationships, and various configuration information.

[0061] For example, the application program is a Java application program, a Groovy core library can be introduced in a configuration file of the application program, and a configuration class can be created, so that the Spring application context (org.springframework.context.ApplicationContextAware) can be introduced when the application program starts.

[0062] S102, obtaining a Bean of the application program based on the application context.

[0063] ​In the Spring framework, a Bean is an instance of an object managed by a Spring container.

[0064] S103, register the Bean to the Binding of Groovy.

[0065] In Groovy, Binding is used to manage the scope of variables and data transmission, and is equivalent to a variable container. It is a bridge connecting the static Java environment and the dynamic Groovy script, and can store and transmit data during the execution of the Groovy script.

[0066] In the above configuration class, all Beans of the application can be obtained based on the imported application context and registered to the Binding of Groovy.

[0067] In step S103, the Beans can be registered to the Binding one by one through binding.setVariable(), or all the Beans can be registered to the Binding in batches through the constructor Binding().

[0068] In one embodiment, step S102 includes:

[0069] S1021, obtain all Beans in the application context;

[0070] S1022, generate a Map instance based on the Beans.

[0071] Correspondingly, step S103 includes: registering the Beans to the Binding in batches based on the Map instance.

[0072] For example, all Beans in the application context are obtained through getBeanOfType(Object.class) and stored in a Map to generate a Map instance, and then the Binding() constructor is used to register all the Beans stored in the Map instance to the Binding in batches, which is more concise and efficient.

[0073] S104, in response to the Groovy test script received by the configured service endpoint, parse the Groovy test script in the test request, and access the Beans through the Binding during the execution of the Groovy test script to obtain the test result.

[0074] The user can upload the Groovy test script to the service endpoint, and after the service end of the application executes the Groovy test script, the test result is returned.

[0075] The service endpoint can be configured as needed, and can be HTTP (Hypertext Transfer Protocol) or other types.

[0076] In one embodiment, step S104 includes:

[0077] S1041. Use the Groovy class loader to inherit the current instance of the GroovyController class;

[0078] S1042. Configure the Groovy compiler according to preset information;

[0079] S1043. Initialize the GroovyShell object according to the Binding, Groovy class loader, and Groovy compiler.

[0080] S1044. Parse the Groovy test script based on the GroovyShell object to obtain Java bytecode;

[0081] S1045. During the execution of the Java bytecode, access the Bean through Binding to obtain the test result.

[0082] For example, the Groovy class loader is first used to inherit the current instance of the GroovyController class through this.getClass().getClassLoader().

[0083] Then, configure the Groovy compiler according to the preset information. For example, use setS ourceEncoding() to set the encoding method of the Groovy compiler according to the encoding method corresponding to the Groovy test script, and use setScriptBaseClass() to set the GroovyService class as the script base class of the Groovy compiler.

[0084] Then the GroovyShell object is initialized using the above Binding, Groovy class loader and Groovy compiler to convert the Groovy test script in the Groovy test script into an abstract syntax tree (AST) based on the GroovyShell object and convert the abstract syntax tree into Java bytecode.

[0085] Finally, the Java bytecode is loaded into the JVM for execution. Since all application beans are registered with Groovy bindings, during the Java bytecode execution process, the application beans managed by Spring can be accessed and called directly through the bindings as needed, simulating a real operating environment and generating and outputting test results.

[0086] Based on this, not only can you execute complex data queries and assertions directly in the Groovy test script, but you can also adjust the test logic by modifying the Groovy test script without recompiling the Java code, thereby improving test efficiency.

[0087] In order to ensure the security of the application during online debugging, this application also implements permission control of the service endpoint.

[0088] In one embodiment, the user may be authenticated before parsing the Groovy test script. That is, the following steps are included before step S1041:

[0089] Parse the test request to obtain the user's identity information and Groovy test script;

[0090] Perform identity authentication based on the identity information and obtain an identity authentication result;

[0091] If the identity authentication result indicates that the identity authentication is successful, step S1041 is executed again.

[0092] In one embodiment, performing identity authentication based on the identity information to obtain an identity authentication result includes:

[0093] Determine the scope of user authority based on user information;

[0094] Determine whether the permission scope includes testing permissions;

[0095] If so, an authentication result is generated to indicate that the authentication is successful.

[0096] Among them, identity authentication and permission control can be implemented based on Spring Security, JWT (JSON Web Token) and OAuth (Open Authorization).

[0097] Spring Security is a framework that provides authentication, authorization, and security features, supporting multiple authentication methods (such as form authentication, JWT, and OAuth). JWT is a token format used to securely transmit claims (such as user identity and permissions) between clients and servers, and is often used as the authentication medium in Spring Security. OAuth is an authorization protocol used by third-party applications to obtain access rights from resource owners. Spring Security provides implementations of OAuth clients and resource servers.

[0098] For example, after a user logs in to an application client, the application server generates a JWT and returns it to the client. This JWT serves as the user's client identity information. The client then sends a test request with the JWT to facilitate server authentication. On the server side, after receiving the test request, it extracts the JWT from it. Spring Security authenticates the JWT using the JwtAuthenticationFilter and performs permission control based on the claims in the JWT (such as roles and scopes).

[0099] For example, based on the statement in the JWT, it can be determined whether the user has a role with testing permissions. If so, an authentication result is generated to indicate that the authentication is successful. If not, the user can be prompted that he does not have testing permissions.

[0100] In another embodiment, permission control can also be performed during the execution of Java bytecode. That is, during the execution of Java bytecode, the following steps are included:

[0101] Get the annotation content of the method to be called;

[0102] If the annotation content includes the first annotation @PreAuthorize, the user's permissions are verified according to the annotation content to obtain the permission verification result. If the permission verification result indicates that the permission verification is passed, the method to be called is called;

[0103] If the annotation content includes the second annotation @PostAuthorize, the method to be called is called to obtain the first return value, the first return value is filtered according to the annotation content, the second return value is determined, and the second return value is returned to the caller of the method to be called.

[0104] The first annotation, @PreAuthorize, performs permission verification before the target method is executed. If the verification result fails, the method will not be executed. The second annotation, @PostAuthorize, performs permission verification after the target method is executed. Even if the method has been executed, if the verification fails, access to its return result will be prohibited.

[0105] For example, when the annotation content of the method to be called includes "@PreAuthorize("hasRol e('TEST')")", it means that before calling the calling method, it is necessary to check the permissions first, that is, to determine whether the user has the TEST role and whether the scope of his permissions includes the permission to perform online debugging. If so, the method to be called can continue to be called. If not, access is directly denied and the corresponding exception information is thrown.

[0106] When the annotation content of the method to be called includes "@PostAuthorize("returnObject.owne r==employee.id")", if the method to be called is used to obtain everyone's pending tasks, the method to be called is first called to obtain the first return value, that is, everyone's pending tasks. According to the user's employee.id, the user's pending tasks are filtered out from the first return value, that is, the second return value. Finally, only the second return value is returned to the caller of the method to be called, ensuring that the user can only see his or her own data, thereby realizing data filtering and permission control.

[0107] To summarize, this application introduces the Groovy core library into the application's configuration file to add support for the Groovy language, introduces Spring's application context when the application starts, obtains all the beans of the application through the application context, and registers them in the Groovy Binding, so that the Groovy test scripts can be received and directly executed through the configured service endpoint without shutting down or restarting the application, which can reduce resource consumption during debugging while improving the efficiency of online debugging.

[0108] Compared with existing technical solutions, the online debugging solution provided by this application has a smaller amount of code. When facing various debugging needs in the future, there is no need to print additional logs or republish services. Testers only need to write Groovy test scripts according to test requirements and upload them to the service endpoint to obtain test results.

[0109] Also, for the solution of debugging by opening the debugging port through Java Agent, since Java Agent's operation on bytecode itself will bring certain performance overhead, if Java Agent is excessively used to perform complex bytecode operations in online applications that process a large number of requests, it may cause system performance to degrade. In an online environment, incorrect use of Java Agent may cause application crashes or security vulnerabilities. Different versions of JVM and applications may have different levels of support for Java Agent. Reserved ports also bring security risks. At the same time, in many restricted environments, in network environments such as K8S, since the service IP (Internet Protocol) is not visible to the outside world, this method cannot be used for debugging.

[0110] In this regard, since the online debugging solution provided by this application has better versatility, it can be used in various complex network environments, and can achieve greater concurrent access and batch execution of Groovy test scripts, which can significantly improve the universality and efficiency of online debugging.

[0111] In addition, the online debugging solution provided by this application performs permission control at the application layer. Compared with the permission control implemented based on the system's underlying API (Application Programming Interface), such as JDWP (Java Debug Wire Protocol), it can achieve more fine-grained permission management and improve the security of online debugging.

[0112] It should be understood that although Figure 1 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. In addition, Figure 1 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily performed at the same time, but can be performed at different times. The order of execution of these sub-steps or stages is not necessarily one by one, but can be performed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.

[0113] To implement the online debugging method of the above-mentioned application, the present application also provides a computer program product, including a computer program / instruction, which implements the steps of the online debugging method of the application in the above-mentioned embodiment when the computer program / instruction is executed by a processor.

[0114] In one embodiment, the computer program product is presented as an online debugging system for an application program. Figure 2 As shown, the online debugging system of the application includes:

[0115] The loading module 201 is used to introduce the Spring application context in response to application startup, obtain the application beans based on the application context, and register the beans in the Groovy binding;

[0116] The test script execution module 202 is configured to parse and execute the Groovy test script in the test request in response to receiving a test request through the configured service endpoint to obtain a test result.

[0117] In one embodiment, the test script execution module 202 is used to:

[0118] Inherit the current instance of the GroovyController class using the Groovy class loader;

[0119] Configure the Groovy compiler according to the preset information;

[0120] Initialize the GroovyShell object based on the Binding, Groovy class loader and Groovy compiler;

[0121] Parse the Groovy test script based on the GroovyShell object to obtain Java bytecode;

[0122] Execute Java bytecode and output test results.

[0123] In one embodiment, configuring the Groovy compiler according to preset information includes:

[0124] Set the encoding mode of the Groovy compiler according to the encoding mode corresponding to the Groovy test script;

[0125] Set the GroovyService class as the script base class for the Groovy compiler.

[0126] In one embodiment, the loading module 201 is used to:

[0127] Get all beans in the application context;

[0128] Generate Map instances based on Bean;

[0129] Register beans in batches to Binding based on Map instances.

[0130] In one embodiment, the test script execution module 202 is used to:

[0131] Parse the test request to obtain the user's identity information and Groovy test script;

[0132] Perform identity authentication based on the identity information and obtain an identity authentication result;

[0133] If the authentication result indicates that the authentication is successful, the Groovy test script in the parsed test request is executed to obtain the test result.

[0134] In one embodiment, performing identity authentication based on the identity information to obtain an identity authentication result includes:

[0135] Determine the scope of user permissions based on identity information;

[0136] Determine whether the permission scope includes testing permissions;

[0137] If so, an authentication result is generated to indicate that the authentication is successful.

[0138] In one embodiment, during the execution of Java bytecode, the test script execution module 202 is further configured to:

[0139] Get the annotation content of the method to be called;

[0140] If the annotation content includes @PreAuthorize, the user's permissions are verified according to the annotation content, and the permission verification result is obtained. If the permission verification result indicates that the permission verification is passed, the method to be called is called;

[0141] If the annotation content includes @PostAuthorize, the method to be called is called to obtain a first return value, the first return value is filtered according to the annotation content, a second return value is determined, and the second return value is returned to the caller of the method to be called.

[0142] The specific definition of the online debugging system for an application can be found in the definition of the online debugging method for an application described above and will not be repeated here. Each module in the online debugging system for an application can be implemented in whole or in part through software, hardware, or a combination thereof. Each of the modules can be embedded in or independent of a processor in a computer device in hardware form, or can be stored in a memory in the computer device in software form, so that the processor can call and execute the corresponding operations of each module.

[0143] The present application also provides a computer device. In one embodiment, the computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the online debugging method for the application program described in the above embodiment are implemented.

[0144] In one embodiment, the computer device may be a server, and its internal structure diagram may be as follows: Figure 3 As shown. The computer device includes a processor, a memory, a network interface and a database connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The database of the computer device is used to store relevant data for online debugging of application programs. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, the steps of the online debugging method of the application program in the above embodiment are implemented.

[0145] In one embodiment, the computer device may be a terminal, and its internal structure diagram may be as follows: Figure 4 As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, the steps of the online debugging method of the application in the above embodiment are implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad provided on the computer device housing, or an external keyboard, touchpad or mouse, etc.

[0146] Those skilled in the art will understand that Figure 3 and Figure 4 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.

[0147] The present application also provides a computer-readable storage medium having a computer program / instruction stored thereon. When the computer program / instruction is executed by a processor, the steps of the online debugging method of the application program in the above embodiment are implemented.

[0148] Those skilled in the art will understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double 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.

[0149] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, 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.

[0150] The above embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art could make various modifications and improvements without departing from the spirit of the present application, all of which fall within the scope of protection of the present application. Therefore, the scope of protection of the present patent application shall be determined by the appended claims.

Claims

1. A method for online debugging of an application, characterized in that: The online debugging method comprises: In response to the application being started, introducing the Spring application context; Obtaining the application's Bean based on the application context; Register the bean in the Groovy binding; In response to receiving a test request through the configured service endpoint, the Groovy test script in the test request is parsed, and the Bean is accessed through the Binding during the execution of the Groovy test script to obtain a test result.

2. The online debugging method according to claim 1, wherein: The parsing of the Groovy test script in the test request and accessing the Bean through the Binding during execution of the Groovy test script to obtain a test result includes: Inherit the current instance of the GroovyController class using the Groovy class loader; Configure the Groovy compiler according to the preset information; Initialize the GroovyShell object according to the Binding, the Groovy class loader and the Groovy compiler; Parsing the Groovy test script based on the GroovyShell object to obtain Java bytecode; During the execution of the Java bytecode, the Bean is accessed through the Binding to obtain the test result.

3. The online debugging method according to claim 2, wherein: Configuring the Groovy compiler according to the preset information includes: Setting the encoding mode of the Groovy compiler according to the encoding mode corresponding to the Groovy test script; Set the GroovyService class as the script base class for the Groovy compiler.

4. The online debugging method according to claim 1, wherein: The obtaining of the application bean based on the application context includes: Get all beans in the application context; Generate a Map instance based on the Bean; Registering the Bean into the Groovy Binding includes: The beans are registered in batches to the binding based on the map instance.

5. The online debugging method according to claim 1, wherein: Before parsing the Groovy test script in the test request and accessing the Bean through the Binding during the execution of the Groovy test script to obtain the test result, the method includes: Parsing the test request to obtain user identity information and Groovy test script; Performing identity authentication based on the identity information to obtain an identity authentication result; If the identity authentication result indicates that the identity authentication is passed, the step of parsing the Groovy test script in the test request and accessing the Bean through the Binding during the execution of the Groovy test script to obtain the test result.

6. The online debugging method according to claim 5, wherein: The performing identity authentication according to the identity information to obtain an identity authentication result includes: Determine the scope of authority of the user based on the identity information; Determine whether the scope of authority includes testing authority; If so, generate the identity authentication result indicating that the identity authentication is successful.

7. The online debugging method according to claim 2, wherein: The process of executing the Java bytecode includes: Get the annotation content of the method to be called; If the annotation content includes the first annotation, verify the user authority according to the annotation content to obtain an authority verification result, and if the authority verification result indicates that the authority verification is passed, call the method to be called; If the annotation content includes a second annotation, the method to be called is called to obtain a first return value, the first return value is filtered according to the annotation content, a second return value is determined, and the second return value is returned to the caller of the method to be called.

8. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program / instruction stored thereon, characterized in that: When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.