Application program maintenance method and device, storage medium and electronic equipment
By automatically obtaining the compilation period information using annotation processor in the Java system, the problem of cumbersome and error-prone application version number maintenance is solved, and more accurate and convenient application maintenance is achieved.
Patent Information
- Application Number
- CN202311663416.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-05
- Publication Date
- 2025-06-13
AI Technical Summary
The existing technology has problems such as cumbersome version number maintenance and error-prone in application maintenance, resulting in inaccurate consistency verification results.
By loading classes marked with specific annotations in the Java system and executing their static code blocks, the annotation processor automatically obtains the compilation period information, including version information, change history, etc., to realize automatic maintenance of the application.
It reduces the probability of errors in version number maintenance, improves the accuracy and convenience of application maintenance, and has no impact on the overall structure of the application.
Smart Images

Figure CN120144168A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of information processing, and in particular, to an application program maintenance method, device, storage medium, and electronic device. Background Art
[0002] Service orientation and containerization are two important trends in modern software development and deployment. Their development is of great significance for improving development efficiency, accelerating application deployment and expansion, and enhancing the maintainability and reliability of systems.
[0003] However, these trends also bring some complexities in operation and maintenance and management. For example, an application program is split into multiple services, and each service may be deployed multiple times to achieve high availability and performance. In a complex production environment, if the application programs deployed on these nodes are inconsistent, it will lead to system instability and functional abnormalities. Therefore, it is necessary to verify the application program versions of each node to improve the stability of the system and reduce the occurrence of functional abnormalities.
[0004] During the process of verifying the application program versions of each node, it is necessary to obtain the version information of the current application program on the node, so as to perform consistency verification based on the obtained information.
[0005] Currently, version numbers are mainly added to application programs in the form of change packages. Each time the application program is changed, the version number needs to be manually changed to form a new change package, and then the information in the change package is obtained later to perform consistency verification on the application program version.
[0006] However, the above method of adding version numbers to application programs through change packages is not only cumbersome to maintain, but also often causes errors in the consistency verification results due to forgetting to change the version number or incorrect writing of the version number for human reasons. Summary of the Invention
[0007] The problem to be solved by the present invention is to improve the accuracy of application program maintenance.
[0008] To solve the above problem, an embodiment of the present invention provides an application program maintenance method, which is applied to a Java system; the method includes:
[0009] Loading a class annotated with a first annotation; the first annotation is used to trigger a corresponding annotation processor to automatically obtain the compilation period information of the application program during the compilation period of the application program;
[0010] Execute the static code block in the class annotated with the first annotation, and load the compilation period information into the Java system variables; the static code block is the static code block after abstract syntax tree enhancement using the compilation period information during the compilation of the application program;
[0011] Collect and expose the compilation period information, and maintain the application program based on the compilation period information.
[0012] Optionally, the first annotation is used to trigger the corresponding annotation processor to obtain the compilation period information through the configured SPI plugin.
[0013] Optionally, the SPI plugin configured by the annotation processor includes at least one of the following:
[0014] A compilation time plugin for obtaining the compilation time information of the application program;
[0015] A GIT plugin for obtaining GIT version information and the most recent commit log of the GIT version;
[0016] An SVN plugin for obtaining SVN version information and the most recent commit log of the SVN version.
[0017] Optionally, the SPI plugin configured by the annotation processor includes: a version tag function list generation plugin, which is used to obtain the differential commit log based on the current version and the most recent tag of the application program, and extract the corresponding historical information according to the preset log format to generate a version tag function list.
[0018] Optionally, the compilation period information obtained by different SPI plugins has different identifiers.
[0019] Optionally, the compilation period information includes: the version information of the application program, the version change history information, the compilation time information, and the compilation parameter information.
[0020] Optionally, the collecting and exposing the compilation period information includes: collecting and exposing the compilation period information through a metrics system.
[0021] Optionally, the maintaining the application program based on the compilation period information includes:
[0022] Performing consistency verification based on the compilation period information, and maintaining the application program based on the consistency verification result.
[0023] An embodiment of the present invention also provides an application program maintenance device, which is applied to a Java system; the device includes:
[0024] A loading unit, adapted to load a class annotated with a first annotation; the first annotation is used to trigger a corresponding annotation processor to automatically obtain compilation period information of the application during compilation of the application;
[0025] An execution unit, adapted to execute a static code block in the class annotated with the first annotation, and load the compilation period information into a Java system variable; the static code block is a static code block after abstract syntax tree enhancement using the compilation period information during compilation of the application;
[0026] A display unit, adapted to collect and expose the compilation period information, and maintain the current application based on the compilation period information.
[0027] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, and the computer program is executed by a processor to implement the steps of any one of the above methods.
[0028] An embodiment of the present invention further provides an electronic device, including a memory and a processor, a computer program capable of running on the processor is stored on the memory, and when the processor runs the computer program, it executes the steps of any one of the above methods.
[0029] Compared with the prior art, the technical solution of the embodiment of the present invention has the following advantages:
[0030] Applying the solution of the present invention, by loading a class annotated with a first annotation and executing a static code block in the class annotated with the first annotation, since the first annotation can trigger a corresponding annotation processor to automatically obtain compilation period information of the application during compilation of the application, and the static code block is a static code block after abstract syntax tree enhancement using the compilation period information during compilation of the application, therefore, after executing the static code block, the compilation period information will be loaded into the Java system variable, achieving the purpose of carrying the compilation period information to the running period. Subsequently, the compilation period information can be collected and exposed, thereby maintaining the current application. Since the compilation period information is automatically obtained by the annotation processor during the compilation device, rather than added manually by changing the package, as long as the first annotation is marked in the class, the corresponding annotation processor will automatically obtain the compilation period information. Compared with adding information manually by changing the package, the error probability can be reduced, and the accuracy of application maintenance can be improved. In addition, by obtaining the compilation period information in the form of annotations, it has no impact on the overall structure of the application, and the maintenance is more convenient. Description of the Drawings
[0031] Figure 1It is a flowchart of an application program maintenance method in an embodiment of the present invention;
[0032] Figure 2 It is a schematic diagram of the processing process of an application program during compilation and runtime in an embodiment of the present invention;
[0033] Figure 3 It is a schematic diagram of the processing process of another application program during compilation in an embodiment of the present invention;
[0034] Figure 4 It is a schematic structural diagram of an application program maintenance device in an embodiment of the present invention. Detailed implementation manners
[0035] In a Java system, there are usually multiple nodes, and the same application program is deployed on each node. However, due to various reasons, such as human errors, network transmission problems, etc., the version of the application program deployed on some nodes may be inconsistent with that on other nodes, and this inconsistency may lead to the instability and functional abnormalities of the Java system.
[0036] Currently, the version number is mainly added to the application program by means of a change package. Each time the application program is changed, the version number needs to be manually changed to form a new change package, and then the information in the change package is obtained to perform consistency verification on the application program version.
[0037] However, the method of adding the version number to the application program through the change package not only has a cumbersome maintenance process, but also often causes errors in the consistency verification result due to forgetting to change the version number or writing the version number incorrectly for human reasons.
[0038] To solve this problem, the present invention provides an application program maintenance method. By loading the class annotated with the first annotation and executing the static code block in the class annotated with the first annotation, since the first annotation can trigger the corresponding annotation processor to automatically obtain the compilation period information of the application program during the compilation period of the application program, and the static code block is the static code block after enhancing the abstract syntax tree using the compilation period information during the compilation period of the application program. As long as the first annotation is marked in this class, the corresponding annotation processor will automatically obtain the compilation period information. Compared with adding information manually through the change package, the error probability can be reduced and the accuracy of application program maintenance can be improved. In addition, obtaining the compilation period information by means of annotations has no impact on the overall structure of the application program and is more convenient to maintain.
[0039] To make the above objects, features, and advantages of the present invention more obvious and understandable, the following will describe the specific embodiments of the present invention in detail with reference to the accompanying drawings.
[0040] Refer toFigure 1 , an embodiment of the present invention provides an application maintenance method, and the method is applied to a Java system.
[0041] Specifically, the method may include the following steps:
[0042] Step 11, load the class annotated with the first annotation; the first annotation is used to trigger the corresponding annotation processor to automatically obtain the compilation period information of the application during the compilation of the application.
[0043] In a specific implementation, the first annotation can be marked in any class that can be loaded during the running process of the application. The identifier of the first annotation can be preset. For example, the identifier of the first annotation can be set to: @UmsVersion. After marking the first annotation, configure the corresponding content (i.e., logic) for the first annotation, and through this logic, the annotation processor will be triggered to automatically obtain the compilation period information.
[0044] Specifically, the content configured by the first annotation may include: the definition of the first annotation, and the identifier information of the annotation processor corresponding to the first annotation. Among them, the first annotation may correspond to a unique annotation processor. When a class is annotated with the first annotation, the pre-customized annotation processor logic will be triggered.
[0045] In a specific implementation, an annotation processor can be written in advance using JSR-269 to automatically generate code, verify code, or perform other annotation-related tasks. JSR-269 (Java Specification Request 269) is part of the Java language specification. JSR-269 defines a mechanism called an annotation processor, which allows developers to process annotations in Java source code during compilation.
[0046] In a specific implementation, the compilation period information may include all information that can be obtained during compilation. Specifically, the compilation period information includes at least one of the following: the version information of the application, the version change history information, the compilation time information, and the compilation parameter information. Among them:
[0047] The version information of the application may include: Git (open source distributed version control system) version information and SVN (open source source code version control system) version information. For any one of the Git version information and the SVN version information, it may include all information related to the version. For example, both may include: the version branch information currently compiled by the application, the author information of the last commit of the current version branch, the time information of the last commit of the current version branch, the version number of the last commit of the current version branch, etc.
[0048] The version change history information may include: the historical information of any version change in the Git version and the SVN version. Specifically, the time information of each version change, the version number information before and after the change, and the change content, etc. Usually, the version change history information is stored in a log.
[0049] The compilation time information may include: the time information of the current compilation of the application program.
[0050] The compilation parameter information may include: the compilation parameters used for compiling the source code. For example, the command-line parameters for compiling, building, and packaging Java source code using a certain tool (such as using the Java project management tool Maven), and the version information of the Java Development Kit (JDK), which is the software development kit for the Java language used for executing Java compilation and building.
[0051] Among them, Maven is a project management tool based on the Project Object Model (POM). It is mainly used for building, releasing, and managing Java projects. Maven simplifies the project building process by providing a set of standardized building specifications and automation tools. The advantages of Maven lie in its automation and standardization features. It can automatically download and update the library files required by the project, reducing the workload of manual dependency management. At the same time, Maven also provides rich report and document generation functions to help developers better understand the building status and dependency relationships of the project.
[0052] Compared with the existing method of only adding version information to the application program, the information during compilation in the embodiments of the present invention can also include information (such as version change history information). Therefore, when a business problem occurs in the application program, it can better feedback which application program version introduced the vulnerability and error, thus being more conducive to maintaining the application program version.
[0053] In specific implementation, the annotation processor can adopt various methods to automatically obtain the information during compilation, which is not limited here as long as it can be automatically obtained.
[0054] In an embodiment of the present invention, for the convenience of extension, the annotation processor can obtain the information during compilation through the configured SPI (Service Provider Interface) plugin.
[0055] Among them, SPI is a service - providing discovery mechanism built into Java, which can be used to enable framework extensions and replace components. It is mainly used by framework developers. For example, the java.sql.Driver interface (the relational database driver abstraction interface in the Java language). Different vendors can provide different implementations for the same interface. Both MySQL and PostgreSQL (widely used relational database management systems) have different implementations for users. And the SPI mechanism in Java can find service implementations for a certain interface. The main idea of the SPI mechanism in Java is to move the control of assembly outside the program, which is particularly important in modular design. Its core idea is decoupling.
[0056] In specific implementation, different SPIs can be set based on different obtained compile - time information to obtain corresponding compile - time information.
[0057] In an embodiment of the present invention, the SPI plug - ins configured by the annotation processor include at least one of the following:
[0058] A compile - time plug - in for obtaining the compile - time information of the application;
[0059] A GIT plug - in for obtaining GIT version information and the most recent commit log of the GIT version;
[0060] An SVN plug - in for obtaining SVN version information and the most recent commit log of the SVN version.
[0061] In specific implementation, the GIT version information and SVN version information may include all information related to the version. For example, they may both include: the version branch information of the current compilation of the application, the author information of the last commit of the current version branch, the time information of the last commit of the current version branch, the version number of the last commit of the current version branch, etc. The GIT version most recent commit log is used to obtain the GIT version change history information. The SVN version most recent commit log is used to obtain the SVN version change history information.
[0062] In specific implementation, in order to improve the generality and extensibility of the SPI plug - in, additional configuration can be performed on the SPI plug - in. The configuration file is located under the application resource file path and is named in a preset manner. For example, the configuration file name of the SPI plug - in can be fixed as ums - version.properties.
[0063] Taking the configuration of the GIT plug - in as an example, by default, the GIT plug - in will obtain 20 log records of the most recent commit of the GIT version. However, through the configuration file, the number of log entries obtained by the GIT plug - in can be specified as 100.
[0064] In a specific implementation, the compilation-time information obtained by the SPI plugin exists in the form of key-value pairs. The compilation-time information obtained by different SPI plugins has different identifiers. To ensure that the information keys obtained by different SPI plugins do not repeat, a unique identifier can be used for each SPI plugin to distinguish. For example, the unique identifier of the GIT plugin is GitInfo. Through this GIT plugin, some information keys can be obtained, including branch (indicating the version branch currently compiled by the Java application), lastCommitAuthor (indicating the author of the last commit of the current version branch), lastCommitTime (indicating the time of the last commit of the current version branch), lastCommitLogs (indicating the log record of the most recent commit of the current version branch), and commitHash (indicating the version number of the last commit of the current version branch). When obtaining these information keys, we will add the prefix of GitInfo to them, such as GitInfo$branch, GitInfo$last CommitAuthor, GitInfo$lastCommitTime, GitInfo$lastCommitLogs, GitInfo$commitHash, etc. This can ensure that the information keys obtained by different plugins do not repeat.
[0065] Step 12: Execute the static code block in the class marked with the first annotation, and load the compilation-time information into the Java system variables.
[0066] Among them, the static code block is the static code block after abstract syntax tree enhancement using the compilation-time information during the compilation of the application.
[0067] In a specific implementation, when the application is running, when loading the class marked with the first annotation, the static code block of this class will be executed, so as to load the compilation-time information into the Java system variables. In this way, the purpose of carrying the compilation-time information to the runtime is achieved.
[0068] Step 13: Collect and expose the compilation-time information, and maintain the application based on the compilation-time information.
[0069] In a specific implementation, when the application is running, the compilation-time information can be collected through a metrics system (such as Prometheus). In this way, the metrics system can aggregate the version information of all nodes deploying this application and display it in a chart component (such as Grafana), so that the application can be conveniently maintained.
[0070] Among them, Prometheus is an open-source monitoring system and time series database. It was initially developed by SoundCloud and released in 2012. The design goal of Prometheus is to address some challenges of traditional monitoring systems, such as complex configuration, storage and query of high-dimensional data, and lack of flexibility. The application scenarios of Prometheus are very extensive and are particularly suitable for containerized environments and microservices architectures. It can monitor various metrics, such as system resource utilization, application performance, network traffic, etc. By using Prometheus, users can monitor and analyze the running status of the system in real time, discover and solve potential problems in a timely manner, and improve the reliability and performance of the system.
[0071] Grafana is an open-source data visualization and monitoring dashboard tool. It was initially developed by Torkel and released in 2014. The design goal of Grafana is to provide a flexible, powerful, and easy-to-use platform for visualizing and analyzing metrics and log data from various data sources. The application scenarios of Grafana are very extensive and are particularly suitable for the fields of monitoring and data analysis. It can be used to monitor system performance metrics, the running status of applications, network traffic, log data, etc. By using Grafana, users can convert complex data into intuitive and easy-to-understand charts and dashboards, thereby better understanding and analyzing the data, discovering and solving problems in a timely manner, and improving the reliability and performance of the system.
[0072] In specific implementation, when maintaining the application based on the compilation period information, consistency verification can be first performed based on the compilation period information, and then the application can be maintained based on the consistency verification result.
[0073] Specifically, after collecting the compilation period information using the metric system, the version information of all nodes deploying the application can be aggregated, so that the version information of the application on different nodes can be conveniently viewed and compared, realizing consistency verification. It should be noted that the version information of the application on the different nodes can be the version of the application providing the same service, or the version of the application on different servers corresponding to the same source code, which can be specifically selected according to actual needs. Subsequently, based on the consistency verification result, the application can be maintained in various ways, such as updating the application version, etc.
[0074] Figure 2 This is a schematic diagram of the processing process of an application during the compilation period and the running period in an embodiment of the present invention. Refer to Figure 2, during compilation, the class annotated with the @UmsVersion annotation (i.e., the first annotation) can be compiled first. When a class is annotated with the @UmsVersion annotation, a custom annotation processor will be triggered. The specific steps are as follows:
[0075] First, the annotation processor will execute all compiler information to obtain all SPI plugins and get several key-value pair information, which includes the acquisition results of all SPI plugins. Specifically, the compilation time plugin can be obtained first to get the compilation time information of the application. Then the GIT plugin is obtained to get the GIT version information and the GIT version's most recent commit log. The GIT version information includes the last commit version number of the GIT version, the most recent commit log, the last commit author, the last commit time, etc. Next, the SVN plugin is obtained to get the SVN version information and the SVN version's most recent commit log. Among them, the SVN version information includes the last commit version number of the SVN version, the most recent commit log, the last commit author, the last commit time, etc. If there are other plugins, other plugins can also be obtained to get the corresponding information, which will not be listed one by one here.
[0076] After obtaining the key-value pair information, use the key-value pair information to perform AST enhancement on the class annotated with @UmsVersion, that is, add an expression statement block to the static code block of the class. For each obtained key-value pair information, an expression statement block will be added, so that the key-value pair information can be set into the Java system variables. To ensure that the set Java system variables are isolated from the existing Java system variables, a fixed prefix (default is UmsVersion, but can be changed on the @UmsVersion annotation) can be added to each key-value pair information. For example, for the key-value pair information obtained through the Git plugin, the key is GitInfo$branch, and when it is set into the Java system variables, the key will be changed to UmsVersion$GitInfo$branch.
[0077] The Abstract Syntax Tree (AST) is a tree-like data structure used to represent the syntactic structure of the source code of a program. It is an intermediate representation generated by compilers and interpreters during the syntax analysis phase. The AST consists of nodes and edges. Each node represents a syntactic construct in the source code, such as an expression, a statement, a function, etc. The edges between nodes represent the relationships between them, such as parent-child relationships, sibling relationships, etc. By constructing the AST, compilers and interpreters can more conveniently analyze and process the source code. It can assist in operations such as syntax checking, semantic analysis, and code optimization. At the same time, the AST can also be used for code generation to convert the source code into target code. The AST plays an important role in the compilation and interpretation processes of programming languages. It provides a structured way to represent the syntactic structure of the source code, enabling compilers and interpreters to process and understand the source code more efficiently.
[0078] During the runtime, the class annotated with @UmsVersion can be loaded first, and then the static code block of the class can be executed. In this way, the information obtained during the compilation period will be loaded into the Java system variables during the application runtime, so that the information that can only be obtained during the compilation period is included in the memory. Then, these information are collected and exposed through the metric system, and finally the consistency check of the application version can be achieved through these information.
[0079] Figure 3 This is a schematic diagram of the processing process of another application during the compilation period in the embodiments of the present invention. Refer to Figure 3 In an embodiment of the present invention, the SPI plug-in configured by the annotation processor may further include: a version tag (label) function list generation plug-in, which is used to obtain the differential commit log according to the current version of the application and the most recent tag function list, and extract the corresponding historical information according to a preset log format to generate the version tag function list.
[0080] For a certain application to be released, during the compilation period, the version tag function list generation plug-in can be obtained, and the version tag function list can be obtained by using the version tag function list generation plug-in. Specifically, the version tag function list generation plug-in can obtain the differential commit log according to the current branch version and the most recent tag (label), and the differential commit log is used to record the commit differences between the current branch version and the most recent commit version. Then, the version tag function list generation plug-in extracts the corresponding historical information from the differential commit log according to a preset log format, and the extracted historical information is usually the important change history of the current branch version relative to the most recent commit version, so as to obtain the version tag function list.
[0081] During compilation, the version tag function list generation plugin can output the generated version tag function list to a specified file (such as a file named TAG-FUNs.md). For example, if the preset log format is TAG-FUN:XXX, then when the information in the differential commit log conforms to this format, XXX is extracted as one of the functions. Thus, a version tag function list can be automatically generated for a Java application, facilitating subsequent application release or other processing. In addition, by standardizing the version tag function list generation plugin to obtain the differential commit log, it is more conducive to the maintenance of the application version.
[0082] In a specific implementation, during compilation, the step of obtaining the version tag function list through the version tag function list generation plugin can be executed simultaneously with the step of obtaining other information through other plugins, or can be executed in sequence. The specific execution order is not limited.
[0083] By adopting the application maintenance method in the embodiment of the present invention, the annotation processor corresponding to the first annotation can automatically obtain the compilation period information during compilation, which can reduce the error probability and improve the accuracy of application maintenance. In addition, by obtaining the compilation period information in the form of annotations, there is no intrusion into the application, so it has no impact on the overall structure of the application, does not involve complex application transformation, is transparent to the applications of the Java system, and is more convenient to maintain.
[0084] To enable those skilled in the art to better understand and implement the present invention, the corresponding devices, test systems, electronic devices, and computer-readable storage media of the above methods are described in detail below.
[0085] Refer to Figure 4 , the embodiment of the present invention also provides an application maintenance device 40, which is applied to the Java system; the device 40 includes: a loading unit 41, an execution unit 42, and a display unit 43.
[0086] Among them:
[0087] The loading unit 41 is adapted to load the class annotated with the first annotation; the first annotation is used to trigger the corresponding annotation processor to automatically obtain the compilation period information of the application during the compilation period of the application;
[0088] The execution unit 42 is adapted to execute the static code block in the class annotated with the first annotation, and load the compilation period information into the Java system variable; the static code block is the static code block after the abstract syntax tree is enhanced using the compilation period information during the compilation period of the application;
[0089] The display unit 43 is adapted to collect and expose the information during compilation, and maintain the current application based on the information during compilation.
[0090] Regarding the loading unit 41, the execution unit 42 and the display unit 43, reference may specifically be made to the descriptions of the corresponding steps in the application method above, which will not be elaborated here.
[0091] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, and the computer program is executed by a processor to implement the steps of any of the above methods.
[0092] In a specific implementation, the computer-readable storage medium may include: ROM, RAM, a magnetic disk, an optical disc, etc.
[0093] An embodiment of the present invention further provides an electronic device, the electronic device includes a memory and a processor, a computer program capable of running on the processor is stored on the memory, and when the processor runs the computer program, it executes the steps of any of the above methods.
[0094] Regarding each module / unit included in each device and product described in the above embodiments, it may be a software module / unit, a hardware module / unit, or may also be partly a software module / unit and partly a hardware module / unit. For example, for each device and product applied to or integrated into a chip, each module / unit included therein may all be implemented in a hardware manner such as a circuit, or at least part of the module / unit may be implemented in a software program manner, and the software program runs on a processor integrated inside the chip, and the remaining (if any) part of the module / unit may be implemented in a hardware manner such as a circuit; for each device and product applied to or integrated into a chip module, each module / unit included therein may all be implemented in a hardware manner such as a circuit, and different modules / units may be located in the same component (such as a chip, a circuit module, etc.) or different components of the chip module, or at least part of the module / unit may be implemented in a software program manner, and the software program runs on a processor integrated inside the chip module, and the remaining (if any) part of the module / unit may be implemented in a hardware manner such as a circuit; for each device and product applied to or integrated into a terminal, each module / unit included therein may all be implemented in a hardware manner such as a circuit, and different modules / units may be located in the same component (such as a chip, a circuit module, etc.) or different components inside the terminal, or at least part of the module / unit may be implemented in a software program manner, and the software program runs on a processor integrated inside the terminal, and the remaining (if any) part of the module / unit may be implemented in a hardware manner such as a circuit.
[0095] Although the present invention is disclosed as above, the present invention is not limited thereto. Any person skilled in the art can make various changes and modifications without departing from the spirit and scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the scope defined by the claims.
Claims
1. An application maintenance method, characterized in that, it is applied to a Java system; the method includes: loading a class annotated with a first annotation; the first annotation is used to trigger a corresponding annotation processor to automatically obtain the compilation period information of the application during the compilation of the application; executing the static code block in the class annotated with the first annotation, and loading the compilation period information into the Java system variable; the static code block is the static code block after the abstract syntax tree is enhanced using the compilation period information during the compilation of the application; collecting and exposing the compilation period information, and maintaining the application based on the compilation period information.
2. The application maintenance method according to claim 1, characterized in that, the first annotation is used to trigger the corresponding annotation processor to obtain the compilation period information through the configured SPI plugin.
3. The application maintenance method according to claim 2, characterized in that, the SPI plugin configured by the annotation processor includes at least one of the following: a compilation time plugin, used to obtain the compilation time information of the application; a GIT plugin, used to obtain GIT version information and the most recent commit log of the GIT version; an SVN plugin, used to obtain SVN version information and the most recent commit log of the SVN version.
4. The application maintenance method according to claim 2 or 3, characterized in that, the SPI plugin configured by the annotation processor includes: a version tag function list generation plugin, used to obtain a differential commit log according to the current version and the most recent tag of the application, and extract corresponding historical information according to a preset log format to generate a version tag function list.
5. The application maintenance method according to claim 2, characterized in that, the compilation period information obtained by different SPI plugins has different identifiers.
6. The application maintenance method according to claim 1, characterized in that, the compilation period information includes: the version information of the application, the version change history information, the compilation time information, and the compilation parameter information.
7. The application maintenance method according to claim 1, characterized in that, the collecting and exposing the compilation period information includes: collecting and exposing the compilation period information through an indicator system.
8. The application maintenance method according to claim 1, characterized in that, the maintaining the application based on the compilation period information includes: performing consistency verification based on the compilation period information, and maintaining the application based on the consistency verification result.
9. An application maintenance device, characterized in that, it is applied to a Java system; the device includes: a loading unit, adapted to load a class annotated with a first annotation; the first annotation is used to trigger a corresponding annotation processor to automatically obtain the compilation period information of the application during the compilation of the application; An execution unit, adapted to execute a static code block in the class annotated with the first annotation, and load the compilation period information into Java system variables; the static code block is a static code block after abstract syntax tree enhancement using the compilation period information during the compilation of the application; a display unit, adapted to collect and expose the compilation period information, and maintain the current application based on the compilation period information.
10. A computer-readable storage medium, on which a computer program is stored, characterized in that, the computer program is executed by a processor to implement the steps of the method according to any one of claims 1 to 8.
11. An electronic device, including a memory and a processor, and a computer program capable of running on the processor is stored on the memory, characterized in that, when the processor runs the computer program, it executes the steps of the method according to any one of claims 1 to 8.