Configuration correction method and device, computer device and storage medium
By configuring a path mapping table to automatically compare and correct attribute values in the configuration file, the application exception problem caused by configuration file errors was resolved, improving error correction efficiency and saving human resources.
Patent Information
- Application Number
- CN202210872144.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-22
- Publication Date
- 2026-02-13
- Estimated Expiration
- 2042-07-22
AI Technical Summary
In existing technologies, errors in configuration files can cause application malfunctions, and manual error correction is inefficient and wastes human resources.
By automatically comparing the attribute values of configuration items through the configuration path mapping table, the configuration file is accurately located and automatically corrected, including generating the configuration path mapping table, finding matching configuration items, and correcting the attribute values in the configuration file.
It improves the efficiency of configuration item error correction, saves human resources, and realizes automatic correction of configuration items.
Smart Images

Figure CN115220781B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, in particular to a configuration correction method and device, computer equipment and storage medium. BACKGROUND
[0002] In computer science, a configuration file is a computer file that can be used to record the configuration parameters and initial settings of an application program. The configuration file can include multiple configuration items, such as a database connection configuration item, a development tool version configuration item, an application program function interface configuration item, a running environment configuration item, etc. If the configuration file is incorrect, it may cause the application program to run abnormally. For example, if the running environment in the configuration item does not match the actual running environment, it will cause the program to be difficult to run.
[0003] Therefore, in order to ensure the accuracy of the configuration item, the developer often needs to find the configuration file in the software development package to check the correctness of the configuration item one by one, or test the functions of the application program one by one, so as to determine the correctness of the configuration item. If the configuration item is incorrect, the configuration item is manually changed and corrected.
[0004] However, the above-mentioned manual correction method of the configuration item will result in low correction efficiency of the configuration item and waste of human resources. SUMMARY
[0005] The embodiments of the present application provide a configuration correction method and device, computer equipment and storage medium, which aims to improve the correction efficiency of the configuration item and reduce the consumption of human resources.
[0006] In one aspect, the present application provides a configuration correction method, which comprises:
[0007] Obtaining a configuration path mapping table of an application development package to be corrected, wherein the configuration path mapping table comprises a mapping relationship between a configuration item in the application development package and a file path of the configuration item;
[0008] Obtaining target configuration information of the application development package;
[0009] In the configuration path mapping table, finding a configuration item matched with the target configuration information;
[0010] If the configuration attribute value in the matched configuration item is inconsistent with the target configuration attribute value in the target configuration information, finding a first file path mapped with the matched configuration item in the configuration path mapping table;
[0011] Determining a first configuration file in which the matched configuration item is located in the application development package according to the first file path;
[0012] In the first configuration file, the configuration attribute value of the configuration item is corrected to a target configuration attribute value in the target configuration information.
[0013] In another aspect, the present application provides a configuration correction device, which comprises:
[0014] an obtaining module, configured to obtain a configuration path mapping table of an application development package to be corrected, wherein the configuration path mapping table comprises a mapping relationship between a configuration item in the application development package and a file path of the configuration item, and target configuration information of the application development package;
[0015] a searching module, configured to search, in the configuration path mapping table, a configuration item matching the target configuration information, and if a configuration attribute value in the matching configuration item is inconsistent with a target configuration attribute value in the target configuration information, search, in the configuration path mapping table, a first file path mapped to the matching configuration item;
[0016] a correcting module, configured to determine, according to the first file path, a first configuration file in which the matching configuration item is located in the application development package, and correct, in the first configuration file, the configuration attribute value of the configuration item to the target configuration attribute value in the target configuration information.
[0017] In another aspect, the present application further provides a computer device, which comprises:
[0018] one or more processors;
[0019] a memory; and
[0020] one or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the processor to implement the configuration correction method in any one of the first aspect.
[0021] In a fourth aspect, the present application further provides a computer readable storage medium, which stores a computer program, and the computer program is loaded by a processor to execute the steps in the configuration correction method in any one of the first aspect.
[0022] In the embodiments of the present application, the configuration item in the configuration path mapping table reflects the configuration item in the application development package, and therefore, the configuration attribute value of the configuration item in the table is compared with the target configuration attribute value in the target configuration information, so that the correct or incorrect check of the configuration item in the current software development package is automatically implemented. If the attribute values are inconsistent, it is proved that the configuration attribute value of the configuration item is incorrect, and the configuration file can be accurately located through the mapped file path, and is automatically modified, thereby saving human resources and improving the error correction efficiency of the configuration item. BRIEF DESCRIPTION OF DRAWINGS
[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without any creative effort on the basis of these drawings.
[0024] Figure 1 is a scene schematic diagram of the configuration correction system provided by the embodiments of the present application;
[0025] Figure 2 is an embodiment flow schematic diagram of the configuration correction method provided by the embodiments of the present application;
[0026] Figure 3 is an embodiment flow schematic diagram of the configuration correction method provided by the embodiments of the present application;
[0027] Figure 4 is an embodiment flow schematic diagram of the configuration correction method provided by the embodiments of the present application;
[0028] Figure 5 is an embodiment structure schematic diagram of the configuration correction device provided by the embodiments of the present application;
[0029] Figure 6 is an embodiment structure schematic diagram of the computer device provided by the embodiments of the present application. DETAILED DESCRIPTION
[0030] The technical solutions in the embodiments of the present application will be described clearly and completely in the following description with reference to the drawings of the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without any creative effort belong to the scope of protection of the present application.
[0031] In the description of the present application, it needs to be understood that the terms "center", "longitudinal", "transverse", "length", "width", "thickness", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer" and the like indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the device or element referred to must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be understood as a limitation on the present application. In addition, the terms "first", "second" are only for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first", "second" can explicitly or implicitly include one or more of the features. In the description of the present application, the meaning of "multiple" is two or more, unless otherwise explicitly specified.
[0032] In the present application, the word "exemplary" is used to mean "serving as an example, instance, or illustration." Any implementation described as "exemplary" in the present application is not necessarily to be construed as preferred or advantageous over other implementations. The following description is presented to enable any person skilled in the art to make and use the present application. In the following description, for the purposes of explanation, details are set forth in order to provide a thorough understanding of the present application. It should be appreciated that one of ordinary skill in the art will realize that the present application can be practiced without the use of these specific details. In other instances, well-known structures and processes are not elaborated in detail in order not to obscure the description of the present application with unnecessary detail. Thus, the present application is not intended to be limited by the embodiments shown, but is to be accorded the widest scope consistent with the principles and features disclosed herein.
[0033] It should be noted that the method of the present application is executed in a computer device, such as a server, and the processing object of each computer device exists in the form of data or information, such as time, which is essentially time information. It can be understood that in subsequent embodiments, if the size, quantity, position, etc. are mentioned, they all exist in the form of corresponding data for processing by the electronic device, and the specific details are not described here.
[0034] The present application provides a configuration correction method and device, computer device and storage medium, which are described in detail below.
[0035] Please refer to Figure 1 , Figure 1 The scene schematic diagram of the configuration correction system provided by the present application can include a computer device 100, and the computer device 100 is integrated with a configuration correction device, such as the computer device in Figure 1 .
[0036] In this embodiment of the application, the computer device 100 is mainly used to obtain the configuration path mapping table of the application development kit to be configured and corrected, wherein the configuration path mapping table includes: the mapping relationship between the configuration items in the application development kit and the file paths of the configuration items;
[0037] Obtain the target configuration information of the application development kit;
[0038] In the configuration path mapping table, find the configuration item that matches the target configuration information;
[0039] If the configuration attribute value in the matched configuration item is inconsistent with the target configuration attribute value in the target configuration information, then the first file path mapped to the matched configuration item is searched in the configuration path mapping table.
[0040] The first configuration file in the application development package is located based on the first file path;
[0041] In the first configuration file, the configuration attribute values of the configuration items are corrected to the target configuration attribute values in the target configuration information.
[0042] In this embodiment, the computer device 100 can be a standalone server, a server network, or a server cluster. For example, the computer device 100 described in this embodiment includes, but is not limited to, a computer, a network host, a single network server, a set of multiple network servers, or a cloud server composed of multiple servers. The cloud server is composed of a large number of computers or network servers based on cloud computing.
[0043] Those skilled in the art will understand that Figure 1 The application environment shown is merely one application scenario of the solution in this application and does not constitute a limitation on the application scenario of the solution in this application. Other application environments may include those that are more specific to this application. Figure 1 The number of computer devices shown is more or less, for example Figure 1 Only one computer device is shown in the diagram. It is understood that the configuration correction system may also include one or more other services, which are not limited here.
[0044] In addition, such as Figure 1 As shown, the configuration correction system may also include a memory 200 for storing data, such as application development kits, configuration files, configuration path mapping tables, etc.
[0045] It should be noted that, Figure 1The schematic diagram of the configuration correction system shown is merely an example. The configuration correction system and scenario described in this application are intended to more clearly illustrate the technical solutions of this application and do not constitute a limitation on the technical solutions provided in this application. As those skilled in the art will know, with the evolution of configuration correction systems and the emergence of new business scenarios, the technical solutions provided in this application are also applicable to similar technical problems.
[0046] First, this application provides a configuration correction method, wherein the execution subject of the configuration correction method is a configuration correction device, the configuration correction device is applied to a computer device, and the configuration correction method includes:
[0047] Obtain the configuration path mapping table of the application development package to be configured and corrected, wherein the configuration path mapping table includes: the mapping relationship between configuration items in the application development package and the file paths of the configuration items;
[0048] Obtain the target configuration information of the application development kit;
[0049] In the configuration path mapping table, find the configuration item that matches the target configuration information;
[0050] If the configuration attribute value in the matched configuration item is inconsistent with the target configuration attribute value in the target configuration information, then the first file path mapped to the matched configuration item is searched in the configuration path mapping table.
[0051] The first configuration file in the application development package is located based on the first file path;
[0052] In the first configuration file, the configuration attribute values of the configuration items are corrected to the target configuration attribute values in the target configuration information.
[0053] In this embodiment of the application, the configuration items in the configuration path mapping table reflect the configuration items in the application development kit. Therefore, by comparing the configuration attribute values of the configuration items in the table with the target configuration attribute values in the target configuration information, the correctness of the configuration items in the current software development kit can be automatically verified. If the attribute values are inconsistent, it proves that the configuration attribute values of the configuration items are incorrect. The configuration file can be accurately located through the mapped file path and automatically modified, saving manpower and improving the error correction efficiency of configuration items.
[0054] The implementation details of the configuration correction method in this application embodiment are described below. The following content is only for the convenience of understanding the implementation details and is not necessary for implementing this solution.
[0055] like Figure 2 The diagram shown is a flowchart of an embodiment of the configuration correction method in this application. The configuration correction method includes:
[0056] In step 201, a configuration path mapping table of an application development package to be configured is obtained.
[0057] The configuration path mapping table includes a mapping relationship between a configuration item in the application development package and a file path of the configuration item.
[0058] The file path of the configuration item can include an application development package name in which the configuration item is located and a configuration file name in which the configuration item is located.
[0059] The application development includes, but is not limited to, a jar package, a war package, and the like. The application development includes a configuration file, which is a computer file that can be used to record configuration parameters and initial settings of an application program. The configuration file includes a plurality of configuration items, each of which includes a configuration attribute and a corresponding configuration attribute value, such as an environment variable and a corresponding environment variable value, a development framework version, a value of the development framework version, and the like.
[0060] In some embodiments, step 201 further includes:
[0061] determining an application development package to be configured;
[0062] obtaining a class file in the application development package and a file path of the class file according to a package structure of the application development package;
[0063] filtering a configuration file from the class file;
[0064] determining a file path corresponding to the filtered configuration file from the file path of the class file;
[0065] generating the configuration path mapping table according to the filtered configuration file and the corresponding file path.
[0066] The package structure can also be referred to as a file directory structure defined in the application development package. The application development package includes a custom class file (class) and other application development packages called by the application development package. The other application development packages called by the application development package can be referred to as sub-application development packages.
[0067] In the application development package, the custom class file is often in the form of source code, and the other application development packages called are often in the form of a name declaration or a specific storage address declaration, and do not appear in the form of complete source code.
[0068] For example, in the application development package A, class files classA1 and classA2 are included, and application development packages jarB and jarC are called. In the application development package A, only the source code of classA1 and classA2 can exist, and the source code of jarB and jarC does not exist.
[0069] In the embodiment of the present application, the class files in the application development package can be only the class files determined by the package structure of the application development package and the source code thereof. For example, the class files in the application development package A include classA1 and classA2.
[0070] In other embodiments, the class files in the application development package are obtained according to the package structure of the application development package, and include:
[0071] The class files in the source code of the application development package are obtained according to the package structure of the application development package, and the class files in the source code of the sub-application development package called by the application development package are obtained.
[0072] The class files in the source code of the sub-application development package are obtained according to the package structure of the sub-application development package.
[0073] The class files in the application development package are obtained according to the class files in the source code of the application development package and the class files in the source code of the sub-application development package.
[0074] For example, if the class files classB1 and classB2 are included in the sub-application development package jarB, even if the source code of jarB is not presented in the application development package calling jarB, the source code of jarB is obtained in the embodiment of the present application, and classB1 and classB2 are obtained therefrom. That is, the class files in the application development package A include classA1, classA2, classB1 and classB2.
[0075] In the embodiment, not only the source code of the application development package, but also the class files are determined according to the source code of the sub-application development package, so that the data of the configuration path mapping table is more comprehensive, and the configuration file in the application development package can be corrected more comprehensively.
[0076] It is worth mentioning that the class files can also exist in the sub-application development package, and the application development package called by the sub-application development package. Based on this, the embodiment of the present application further provides an embodiment of obtaining the class files in the application development package according to the package structure of the application development package, which can be referred to as Figure 3 As shown, it includes:
[0077] In step 301, the class files in the source code of the application development package are obtained according to the package structure of the current application development package, and the class files in the source code of the sub-application development package called by the current application development package are obtained.
[0078] When step 301 is performed for the first time, the current application development package is the application development package to be configured and corrected.
[0079] Step 302: store the class files in the class file set in the application development package.
[0080] Step 303: determine whether the preset application development package parsing completion condition is met. If the preset application development package parsing completion condition is not met, perform step 304; if the preset application development package parsing completion condition is met, perform step 305.
[0081] In some embodiments, the application development package parsing completion condition can be that the number of times of parsing of the application development package is equal to a preset number of times, and the number of times of parsing of the application development package is a preset number of times of execution of step 301. For example, if the preset number of times is 2, if the number of times of execution of step 301 has reached 2, it indicates that the parsing of the application development package is completed.
[0082] In other embodiments, the application development package parsing completion condition can be that the sub-application development package does not call other application development packages.
[0083] In other embodiments, the application development package parsing completion condition can be that the sub-application development package does not call other application development packages, or the number of times of parsing of the application development package is equal to a preset number of times.
[0084] If the above application development package parsing completion condition is not met, step 304 is entered.
[0085] Step 304: take the sub-application development package in the current round as the current application development package, and enter step 301.
[0086] That is, the class files in the sub-application development package in the current round and the application development packages called by the sub-application development package in the current round are parsed.
[0087] Step 304 is a step performed when the above application development package parsing completion condition is not met. If the above application development package parsing completion condition is met, step 305 can be performed.
[0088] Step 305: store the parsed class files in the sub-application development package in the current round in the class file set.
[0089] After step 305 is performed, each class file in the obtained class file set can be used as the application development package to be configured and corrected.
[0090] Through the above method, the configuration files can be screened out from the obtained class files, and the configuration path mapping table can be generated based on the configuration files.
[0091] In the embodiments of the present application, in addition to parsing the sub-application development package of the application development package to be configured and corrected, the application development package is parsed until the application development package calling the sub-application development package meets the application development package parsing completion condition, so that the parsed class files are more comprehensive.
[0092] In addition to obtaining the configuration path mapping table, the target configuration information of the application development package needs to be obtained, that is, step 202 is entered.
[0093] In step 202, the target configuration information of the application development package is obtained.
[0094] The target configuration information can include the identifier of the configuration item to be corrected and the target configuration attribute value of the configuration item to be corrected.
[0095] In step 203, the configuration item matching the target configuration information is searched in the configuration path mapping table.
[0096] The configuration path mapping table includes the configuration item attribute name. If the identifier of the configuration item to be corrected in the target configuration information represents a configuration item attribute name recorded in the configuration path mapping table, the configuration item is the configuration item matching the target configuration information.
[0097] In step 204, if the configuration attribute value in the matched configuration item is inconsistent with the target configuration attribute value in the target configuration information, the first file path mapped with the matched configuration item is searched in the configuration path mapping table.
[0098] For example, if the configuration item attribute in the matched configuration item is an environment variable, the configuration item attribute value of the environment variable in the configuration path mapping table is environment variable A, and the target configuration attribute value is environment variable B, which represents that the two are inconsistent.
[0099] In step 205, the first configuration file in which the matched configuration item is located in the application development package is determined according to the first file path.
[0100] Specifically, the first file path represents the specific position of the first configuration file in the application development package.
[0101] In step 206, the configuration attribute value of the configuration item is corrected to the target configuration attribute value in the target configuration information in the first configuration file.
[0102] For example, if the configuration attribute value of the configuration item is environment variable A and the target configuration attribute value is environment variable B, the configuration attribute value of the environment variable is changed to B.
[0103] The above steps 201 to 206 are the process of finding the configuration item matching the target configuration information and correcting it. In other embodiments, the above steps can be referred toFigure 4 If no configuration item matching the target configuration information is found in the configuration path mapping table, the following steps are performed
[0104] In step 401, a configuration item to be added is generated according to the target configuration information.
[0105] Specifically, the configuration item to be added is generated according to the identifier of the configuration item to be corrected in the target configuration information and the attribute value of the target configuration item.
[0106] After the configuration item to be added is generated, the configuration item to be added is added to the configuration file of the application development package, that is, step 402 is performed. In the case of missing configuration items, the embodiment can automatically add the configuration items to the configuration file to realize automatic correction of the configuration file.
[0107] In some embodiments, step 402 can refer to steps 4021 to 4024 shown in Figure 4
[0108] In step 4021, the configuration type tags of each configuration file in the application development package are obtained.
[0109] The configuration type tag can represent the type of the configuration item attribute in the configuration file, for example, the configuration of the main database connection, and can be set according to user needs.
[0110] In step 4022, a configuration type tag matching the configuration item to be added is searched for in the configuration type tags of each configuration file.
[0111] In some embodiments, the configuration type tag can be searched according to semantics. If the semantic similarity between the configuration item and the semantic of the configuration type tag exceeds a preset threshold, it is considered that the configuration type tag matching the configuration item to be added is found.
[0112] In another embodiment, the configuration type tag has a mapping relationship with the configuration item attribute that needs to be configured in the configuration file. If the attribute of the configuration item to be added is the same as the attribute of the configuration item mapped by the configuration type tag, it is considered that the configuration type tag matching the configuration item to be added is found.
[0113] In step 4023, a target configuration file is determined according to the matched configuration type tag.
[0114] That is, the configuration file corresponding to the matched configuration type tag is the target configuration file.
[0115] In step 4024, the configuration item to be added is added to the target configuration file.
[0116] The configuration type label matching the configuration item to be added can be found through the configuration type label of the configuration file. In some embodiments, if the configuration type label matching the configuration item to be added is not found in the configuration type label of each configuration file, a new configuration file is created; and the configuration item to be added is added to the new configuration file.
[0117] In other embodiments, if the configuration type label matching the configuration item to be added is not found in the configuration type label of each configuration file, a configuration item omission alarm can be generated to remind the user to manually add the omitted configuration item.
[0118] In some cases, the configuration item of the configuration file can not conform to the format rule. Based on this, in some embodiments, the format rule of the configuration item in the application development package can be obtained; the configuration item not conforming to the format rule and the second file path of the configuration item not conforming to the format rule are found in the configuration path mapping table; the second configuration file in which the configuration item not conforming to the format rule is located in the application development package is determined according to the second file path; and the configuration item not conforming to the format rule is corrected to a format rule conforming configuration item in the second configuration file according to the rule.
[0119] The format rule can be specified by a regular expression or other forms, which is not limited in the embodiments of the present application. The embodiments can automatically check and correct the format rule of the configuration item.
[0120] In the embodiments of the present application, the correctness of the configuration item of the current software development package can be automatically checked. If the attribute values are inconsistent, it proves that the configuration attribute value of the configuration item is incorrect. The configuration file can be accurately located through the mapped file path, and automatically modified. If the configuration item is omitted, it can also be automatically added. When the configuration item format is incorrect, it can also be automatically corrected, saving human resources and improving the error correction efficiency of the configuration item.
[0121] The embodiments of the present application also provide a configuration correction device, which can refer to FIG. 5. Figure 5 As shown in FIG. 5, the configuration correction device includes:
[0122] The obtaining module 501 is configured to obtain a configuration path mapping table of an application development package to be configured and corrected, wherein the configuration path mapping table includes a mapping relationship between a configuration item in the application development package and a file path of the configuration item, and target configuration information of the application development package.
[0123] The searching module 502 is configured to search, in the configuration path mapping table, a configuration item matching the target configuration information, and search, in the configuration path mapping table, a first file path mapped with the matching configuration item if a configuration attribute value in the matching configuration item is inconsistent with a target configuration attribute value in the target configuration information.
[0124] The correcting module 503 is configured to determine, according to the first file path, a first configuration file in which the matching configuration item is located in the application development package, and correct, in the first configuration file, the configuration attribute value of the configuration item to the target configuration attribute value in the target configuration information.
[0125] In some embodiments, the obtaining module 501 is further configured to determine an application development package to be configured and corrected, obtain, according to a package structure of the application development package, class files in the application development package and file paths of the class files, filter configuration files from the class files, determine, from the file paths of the class files, file paths corresponding to the filtered configuration files, and generate the configuration path mapping table according to the filtered configuration files and the corresponding file paths.
[0126] In some embodiments, the obtaining module 501 is further configured to obtain, according to a package structure of the application development package, class files in source code of the application development package and a sub-application development package called by the application development package, obtain, according to a package structure of the sub-application development package, class files in source code of the sub-application development package, and obtain class files in the application development package according to the class files in the source code of the application development package and the class files in the source code of the sub-application development package.
[0127] In some embodiments, the correcting module 503 is further configured to generate a configuration item to be added according to the target configuration information if no matching configuration item is found in the configuration path mapping table, and add the configuration item to be added in a configuration file of the application development package.
[0128] In some embodiments, the correcting module 503 is further configured to obtain configuration type tags of each configuration file in the application development package, search, in the configuration type tags of each configuration file, a configuration type tag matching the configuration item to be added, determine a target configuration file according to the matching configuration type tag, and add the configuration item to be added in the target configuration file.
[0129] In some embodiments, the correcting module 503 is further configured to create a new configuration file if no matching configuration type tag is found in the configuration type tags of each configuration file, and add the configuration item to be added in the new configuration file.
[0130] In some embodiments, the correction module 503 is further configured to acquire a format rule of the configuration item in the application development package; in the configuration path mapping table, find a configuration item that does not conform to the format rule, and a second file path of the configuration item that does not conform to the format rule; determine a second configuration file in which the configuration item that does not conform to the format rule is located in the application development package according to the second file path; and correct the configuration item that does not conform to the format rule to a configuration item that conforms to the format rule according to the rule in the second configuration file.
[0131] Embodiments of the present application also provide a computer device integrating any of the configuration correction apparatuses provided by embodiments of the present application. The computer device comprises:
[0132] one or more processors;
[0133] a memory; and
[0134] one or more application programs, wherein the one or more application programs are stored in the memory and are configured to perform the steps of the configuration correction method in any of the configuration correction method embodiments described above by the processor.
[0135] Embodiments of the present application also provide a computer device integrating any of the configuration correction apparatuses provided by embodiments of the present application. As shown in Figure 6 the structure schematic diagram of the computer device related to embodiments of the present application is shown, specifically:
[0136] The computer device can include a processor 601 with one or more processing cores, a memory 602 with one or more computer readable storage media, a power supply 603, and an input unit 604, and the like. Those skilled in the art can understand that the computer device structure shown in Figure 6 does not constitute a limitation on the computer device, and can include more or fewer components than those shown, or combine certain components, or different component arrangements. Among them:
[0137] The processor 601 is the control center of the computer device, connects the various parts of the computer device through various interfaces and lines, and performs various functions of the computer device and processes data by running or executing software programs and / or modules stored in the memory 602 and calling data stored in the memory 602, thereby overall monitoring the computer device. Optionally, the processor 601 can include one or more processing cores; preferably, the processor 601 can integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application program, etc., and the modem processor mainly processes wireless communication. It can be understood that the above-mentioned modem processor can also not be integrated into the processor 601.
[0138] The memory 602 can be used to store software programs and modules, and the processor 601 executes various functions and data processing by running the software programs and modules stored in the memory 602. The memory 602 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application program required by a function (such as a sound playing function, an image playing function, etc.), etc.; the data storage area can store data created according to the use of the computer device, etc. In addition, the memory 602 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state memory device. Accordingly, the memory 602 can also include a memory controller to provide access for the processor 601 to the memory 602.
[0139] The computer device further includes a power supply 603 for powering various components, and preferably the power supply 603 can be logically connected to the processor 601 through a power management system, so as to realize functions such as management of charging, discharging, and power consumption management through the power management system. The power supply 603 can also include one or more than one direct current or alternating current power supply, a recharging system, a power failure detection circuit, a power converter or inverter, a power state indicator, etc. Any component.
[0140] The computer device can also include an input unit 604, which can be used to receive input digital or character information, and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
[0141] Although not shown, the computer device can also include a display unit, etc., which will not be described here. Specifically, in the present embodiment, the processor 601 in the computer device will load the executable file corresponding to the process of one or more than one application program into the memory 602 according to the following instructions, and run the application program stored in the memory 602 by the processor 601, thereby realizing various functions, as follows:
[0142] obtain a configuration path mapping table of the application development package to be configured, wherein the configuration path mapping table comprises a mapping relationship between a configuration item in the application development package and a file path of the configuration item;
[0143] obtain target configuration information of the application development package;
[0144] find, in the configuration path mapping table, a configuration item matching the target configuration information;
[0145] if a configuration attribute value in the matching configuration item is inconsistent with a target configuration attribute value in the target configuration information, find, in the configuration path mapping table, a first file path mapped with the matching configuration item;
[0146] determine, according to the first file path, a first configuration file in which the matching configuration item is located in the application development package;
[0147] correct, in the first configuration file, the configuration attribute value of the configuration item to the target configuration attribute value in the target configuration information.
[0148] Those skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructions, or by related hardware controlled by the instructions, which can be stored in a computer readable storage medium and loaded and executed by a processor.
[0149] To this end, the embodiments of the present application provide a computer readable storage medium, which can include a read only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc. A computer program is stored on the storage medium, and the computer program is loaded by a processor to execute the steps in any configuration correction method provided by the embodiments of the present application. For example, the computer program loaded by the processor can execute the following steps:
[0150] obtain a configuration path mapping table of the application development package to be configured, wherein the configuration path mapping table comprises a mapping relationship between a configuration item in the application development package and a file path of the configuration item;
[0151] obtain target configuration information of the application development package;
[0152] find, in the configuration path mapping table, a configuration item matching the target configuration information;
[0153] If the configuration attribute value in the matched configuration item is inconsistent with the target configuration attribute value in the target configuration information, a first file path mapped with the matched configuration item is searched in the configuration path mapping table;
[0154] A first configuration file in which the matched configuration item is located in the application development package is determined according to the first file path.
[0155] In the first configuration file, the configuration attribute value of the configuration item is corrected to the target configuration attribute value in the target configuration information.
[0156] In the above embodiments, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the detailed description of other embodiments above, which will not be repeated here.
[0157] In the implementation, each unit or structure above can be implemented as an independent entity, or can be combined as the same or several entities, and the specific implementation of each unit or structure can be referred to the method embodiments above, which will not be repeated here.
[0158] The specific implementation of each operation above can be referred to the embodiments above, which will not be repeated here.
[0159] The configuration correction method, device, computer device and storage medium provided by the embodiments of the present application are described in detail above, and the principle and implementation mode of the present application are described by applying specific examples; the above embodiment is only used to help understand the method and its core idea; meanwhile, for those skilled in the art, according to the idea of the present application, the specific implementation mode and application range will be changed, and the above description should not be understood as the limitation of the present application.
Claims
1. A configuration correction method, characterized in that, The configuration correction method includes: Obtain the configuration path mapping table of the application development package to be configured and corrected, wherein the configuration path mapping table includes: the mapping relationship between configuration items in the application development package and the file paths of the configuration items; Obtain the target configuration information of the application development kit; In the configuration path mapping table, find the configuration item that matches the target configuration information; If the configuration attribute value in the matched configuration item is inconsistent with the target configuration attribute value in the target configuration information, then the first file path mapped to the matched configuration item is searched in the configuration path mapping table. The first configuration file in the application development kit containing the matched configuration item is determined based on the first file path; In the first configuration file, the configuration attribute values of the configuration items are corrected to the target configuration attribute values in the target configuration information; The step of obtaining the configuration path mapping table of the application development package to be configured includes: Identify the application development packages that require configuration correction; Based on the package structure of the application development kit, the class files in the application development kit and the file paths of the class files are obtained; Select configuration files from the class files; Determine the file path corresponding to the filtered configuration file from the file path of the class file; Based on the selected configuration files and their corresponding file paths, a configuration path mapping table is generated.
2. The configuration correction method according to claim 1, characterized in that, The step of obtaining the class files in the application development package based on the package structure of the application development package includes: Based on the package structure of the application development package, the class files in the source code of the application development package and the sub-application development packages called by the application development package are obtained. Based on the package structure in the sub-application development package, obtain the class files in the source code of the sub-application development package; The class files in the application development package are obtained from the class files in the source code of the application development package and the sub-application development package.
3. The configuration correction method according to any one of claims 1 to 2, characterized in that, The method further includes: If no configuration item matching the target configuration information is found in the configuration path mapping table, a configuration item to be added is generated based on the target configuration information. Add the configuration items to be added to the configuration file of the application development kit.
4. The configuration correction method according to claim 3, characterized in that, Adding the configuration item to be added to the application development kit configuration file includes: Retrieve the configuration type tags of each configuration file in the application development kit; In the configuration type tags of each configuration file, find the configuration type tag that matches the configuration item to be added; The target configuration file is determined based on the matched configuration type tag; Add the configuration items to be added to the target configuration file.
5. The configuration correction method according to claim 4, characterized in that, The method further includes: If no configuration type tag matching the configuration item to be added is found in the configuration type tags of the configuration files, a new configuration file is created. Add the configuration items to be added to the new configuration file.
6. The configuration correction method according to claim 1, characterized in that, After obtaining the configuration path mapping table of the application development package to be configured and corrected, the method further includes: Obtain the format rules of the configuration items in the application development kit; In the configuration path mapping table, find the configuration item that does not conform to the format rules, and the second file path of the configuration item that does not conform to the format rules; The second configuration file containing the configuration item that does not conform to the format rules is located in the application development kit based on the second file path; In the second configuration file, configuration items that do not conform to the format rules are corrected to configuration items that conform to the format rules according to the rules.
7. A configuration calibration device, characterized in that, include: The acquisition module is used to acquire the configuration path mapping table of the application development package to be configured and corrected, wherein the configuration path mapping table includes: the mapping relationship between configuration items in the application development package and the file path of the configuration items, and the target configuration information of the application development package; The lookup module is used to search for a configuration item that matches the target configuration information in the configuration path mapping table. If the configuration attribute value in the matching configuration item is inconsistent with the target configuration attribute value in the target configuration information, then the first file path mapped to the matching configuration item is searched in the configuration path mapping table. The correction module is used to determine the first configuration file in the application development package where the matching configuration item is located based on the first file path, and correct the configuration attribute value of the configuration item in the first configuration file to the target configuration attribute value in the target configuration information. The acquisition module is further configured to: Identify the application development packages that require configuration correction; Based on the package structure of the application development kit, the class files in the application development kit and the file paths of the class files are obtained; Select configuration files from the class files; Determine the file path corresponding to the filtered configuration file from the file path of the class file; Based on the selected configuration files and their corresponding file paths, a configuration path mapping table is generated.
8. A computer device, characterized in that, The computer device includes: One or more processors; Memory; and One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to implement the configuration correction method of any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, It stores a computer program, which is loaded by a processor to perform the steps in the configuration correction method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Configuration updating method, device, equipment and storage medium
CN111240763A
Software development kit configuration method and device and storage medium
CN112035163A