Configuration updating method, device, electronic device and storage medium

By adding annotation information to the configuration file and defining update conditions based on attribute types, the problem of updating configuration files under different reading rules is solved, automatic updates are realized, and the update efficiency and consistency of configuration files are improved.

CN118484222BActive Publication Date: 2024-10-29BANK OF NINGBO
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202410943445.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-15
Publication Date
2024-10-29
Estimated Expiration
2044-07-15

AI Technical Summary

Technical Problem

In the existing technology, the configuration items of the configuration file cannot be automatically updated when the reading rules are different, causing the automatic update to fail.

Method used

By adding annotation information based on attribute types in the configuration file, defining update conditions, and responding to update instructions to automatically update the configuration file, it is ensured that configuration items under any read rules can be automatically updated.

Benefits of technology

Automatic update of configuration files is realized, avoiding manual operations and improving the efficiency and consistency of configuration file updates.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118484222B_ABST
    Figure CN118484222B_ABST
Patent Text Reader

Abstract

The present application provides a configuration update method, device, electronic device and storage medium; the method includes: reading a configuration file based on a set reading rule; adding annotation information to the configuration file based on an attribute type of the configuration file; the annotation information is used to define a condition for triggering the configuration file to be updated; in response to receiving an update instruction for the configuration file, updating the configuration file based on the annotation information, so that configuration items read by any reading rule can be automatically updated, thereby realizing automatic updating of the configuration file.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to configuration update technology, and in particular to a configuration update method, device, electronic device and storage medium. Background Art

[0002] At present, many configuration items in configuration files need to be automatically updated at work. The current configuration center can read the configuration items in the configuration files, but due to different reading rules, there will be a problem that the configuration items read according to certain reading rules cannot be automatically updated. Summary of the invention

[0003] Embodiments of the present application provide a configuration update method, device, electronic device, and storage medium to solve one or more problems existing in the related art.

[0004] According to the first aspect of the present application, a configuration update method is provided, the method comprising: reading a configuration file based on a set reading rule; adding annotation information to the configuration file based on an attribute type of the configuration file; the annotation information is used to define a condition for triggering an update of the configuration file; in response to receiving an update instruction for the configuration file, updating the configuration file based on the annotation information.

[0005] According to an embodiment of the present application, adding annotation information to the configuration file based on the attribute type of the configuration file includes: in response to the attribute type of the configuration file satisfying a first condition, adding first annotation information to the configuration attribute class of the configuration file; in response to the attribute type of the configuration file not satisfying the first condition, adding second annotation information to the startup class of the configuration file, the first annotation information being different from the second annotation information.

[0006] According to an embodiment of the present application, in response to the attribute type of the configuration file satisfying a first condition, adding first annotation information in the configuration attribute class of the configuration file includes: based on the attribute type, determining whether the configuration attribute class of the configuration file can be edited; in response to the configuration attribute class of the configuration file being editable, determining that the attribute type of the configuration file satisfies the first condition; in response to the attribute type of the configuration file satisfying the first condition, adding first annotation information in the configuration attribute class of the configuration file; the first annotation information is used to define the conditions that trigger the update of the configuration file.

[0007] According to an embodiment of the present application, in response to the attribute type of the configuration file not satisfying the first condition, adding second annotation information to the startup class of the configuration file, including: based on the attribute type, determining whether the configuration attribute class of the configuration file can be edited; in response to the configuration attribute class of the configuration file not being able to be edited, determining that the attribute type of the configuration file does not satisfy the first condition; in response to the attribute type of the configuration file not satisfying the first condition, adding second annotation information to the startup class of the configuration file; the second annotation information is used to define the configuration attribute class for updating the configuration file and define the conditions that trigger the updating of the configuration file.

[0008] According to one embodiment of the present application, in response to receiving an update instruction for the configuration file, the configuration file is updated based on the annotation information, including: in response to receiving an update instruction for the configuration file, based on the annotation information, determining a first parameter of a configuration attribute class corresponding to the configuration file in the configuration file; the first parameter includes: at least one of an attribute name, a subscript, and a sub-attribute; based on the first parameter, the configuration file is updated.

[0009] According to an embodiment of the present application, in response to receiving an update instruction for the configuration file, based on the annotation information, determining the first parameter of the configuration attribute class corresponding to the configuration file, includes: determining all configuration files for configuration update based on the annotation information; determining the listening status of each configuration file in all the configuration files; in response to the listening status of the configuration file satisfying a listening condition, determining the first parameter of the configuration attribute class corresponding to the configuration file based on the update instruction.

[0010] According to an embodiment of the present application, updating the configuration file based on the first parameter includes: determining an update type corresponding to the configuration file based on the first parameter; and calling an updater that matches the update type to update the configuration file.

[0011] According to a second aspect of the present application, a configuration update device is provided, comprising: a reading module for reading a configuration file based on a set reading rule; an adding module for adding annotation information to the configuration file based on an attribute type of the configuration file; the annotation information is used to define a condition for triggering an update of the configuration file; and an updating module for updating the configuration file based on the annotation information in response to receiving an update instruction for the configuration file.

[0012] According to a third aspect of the present application, an electronic device is provided, including:

[0013] at least one processor; and

[0014] a memory communicatively connected to the at least one processor; wherein,

[0015] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method described in the present application.

[0016] According to a fourth aspect of the present application, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the method described in the present application.

[0017] The method of the embodiment of the present application reads the configuration file based on the set reading rules; adds annotation information to the configuration file based on the attribute type of the configuration file; the annotation information is used to define the conditions that trigger the configuration file to be updated; in response to receiving an update instruction for the configuration file, the configuration file is updated based on the annotation information. In this way, all configuration items read by any reading rule can be automatically updated, realizing the automatic update of the configuration file.

[0018] It should be understood that the teachings of the present application are not required to achieve all of the beneficial effects described above, but specific technical solutions can achieve specific technical effects, and other embodiments of the present application can also achieve beneficial effects not mentioned above. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] By reading the detailed description below with reference to the accompanying drawings, the above and other purposes, features and advantages of the exemplary embodiments of the present application will become readily understood. In the accompanying drawings, several embodiments of the present application are shown in an exemplary and non-limiting manner, wherein:

[0020] In the drawings, the same or corresponding reference numerals represent the same or corresponding parts.

[0021] Figure 1 The following is a schematic diagram showing the processing flow of the configuration update method provided in the embodiment of the present application. Figure 1 ;

[0022] Figure 2 The following is a schematic diagram showing the processing flow of the configuration update method provided in the embodiment of the present application. Figure 2 ;

[0023] Figure 3 The following is a schematic diagram showing the processing flow of the configuration update method provided in the embodiment of the present application. Figure 3 ;

[0024] Figure 4 The following is a schematic diagram showing the processing flow of the configuration update method provided in the embodiment of the present application. Figure 4 ;

[0025] Figure 5 The following is a schematic diagram showing the processing flow of the configuration update method provided in the embodiment of the present application. Figure 5 ;

[0026] Figure 6 The following is a schematic diagram showing the processing flow of the configuration update method provided in the embodiment of the present application. Figure 6 ;

[0027] Figure 7 The following is a schematic diagram showing the processing flow of the configuration update method provided in the embodiment of the present application. Figure 7 ;

[0028] Figure 8 An application scenario diagram of the configuration update method provided in an embodiment of the present application is shown;

[0029] Fig. 9 An optional schematic diagram of a configuration updating device provided in an embodiment of the present application is shown;

[0030] Fig.10 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0031] In order to make the purpose, features, and advantages of the present application more obvious and easy to understand, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.

[0032] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0033] In the following description, the terms "first\second" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.

[0034] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0035] The processing flow of the configuration update method provided in the embodiment of the present application is described. Figure 1 , Figure 1 The following is a schematic diagram of the processing flow of the configuration update method provided in the embodiment of the present application. Figure 1 , will combine Figure 1 Steps S101-S103 are shown for explanation.

[0036] Step S101, reading a configuration file based on a set reading rule.

[0037] In some embodiments, the configuration file may include an Apollo configuration file. Apollo (configuration center) can be a distributed configuration center. The configuration file may include files in formats such as INI, XML, JSON, and YAML. The embodiments of the present application do not limit the format of the specific configuration file. The set reading rules may include: reading rules corresponding to the configuration file format. The set reading rules may also include: reading the configuration file using annotations, and injecting the read configuration values ​​into the bean. Among them, the bean is an object managed by the Spring IoC (Inversion of Control) container in the Spring framework. The SpringIoC container is used to create beans, configure beans, assemble beans, and manage the life cycle of beans.

[0038] As an example, in the Spring framework, annotations are used to read the Apollo configuration file into POJO (Plain Old Java Object) beans according to the attribute type. The attribute type can be determined based on the configuration item with a specific prefix in the configuration file. A configuration item can be a single setting or parameter in the configuration file. A configuration item is a specific key-value pair, where the key is the name of the configuration item and the value is the value of the configuration item. Multiple related configuration items can form a configuration property class.

[0039] Step S102: adding annotation information to the configuration file based on the attribute type of the configuration file.

[0040] In some embodiments, annotation information can be used to define conditions that trigger the configuration file to be updated. Property types can include: bean property type, editability, and accessibility. Specific bean property types can include: basic data types, packaging classes, strings, and collection types. Property types can also include other related property features. The embodiments of the present application do not limit the specific property types in the configuration file.

[0041] Step S103: in response to receiving an update instruction for the configuration file, updating the configuration file based on the annotation information.

[0042] In some embodiments, the update instruction may be an instruction generated according to a user's control operation. The update instruction may also be an instruction automatically generated by the system. The update instruction is used to trigger an instruction to update the configuration file. For example, when an event of a change to the Apollo configuration file is monitored, a corresponding update instruction is generated to trigger an update of the configuration file based on the annotation information.

[0043] The method of the embodiment of the present application adds annotation information to the configuration file, defines the update conditions of the configuration file through the annotation information, and automatically triggers the configuration update when the update conditions are met. The configuration items read through any reading rule can be automatically updated, thereby realizing automatic update of the configuration file.

[0044] In some embodiments, the processing flow of the configuration update method is shown as follows: Figure 2 ,like Figure 2 As shown, including:

[0045] Step S201, reading the configuration file based on the set reading rule.

[0046] The specific description of step S201 is the same as that of the above step S101 and will not be repeated here.

[0047] like Figure 2 As shown, in step S102, based on the attribute type of the configuration file, annotation information is added to the configuration file, which may specifically include:

[0048] Step S202a: in response to the attribute type of the configuration file satisfying the first condition, first annotation information is added to the configuration attribute class of the configuration file.

[0049] Step S202b: in response to the attribute type of the configuration file not satisfying the first condition, adding second annotation information to the startup class of the configuration file.

[0050] In this embodiment, the first condition may include whether the configuration attribute class in the configuration file can be edited. The first annotation information may be used to define the condition that triggers the configuration file to be updated. The second annotation information may be used to define the configuration attribute class for the configuration file to be updated and to define the condition that triggers the configuration file to be updated. The condition that triggers the configuration file to be updated may include: one or more of: adding a configuration item, editing a configuration item, and deleting a configuration item.

[0051] Step S203: in response to receiving an update instruction for the configuration file, updating the configuration file based on the annotation information.

[0052] The specific description of step S203 is the same as that of the above step S103 and will not be repeated here.

[0053] The method of the embodiment of the present application adds annotation information in the configuration property class and startup class of the configuration file, defines the update conditions of the configuration file through the annotation information, and automatically triggers the configuration update when the update conditions are met. The configuration items read through any reading rule can be automatically updated, thereby realizing automatic update of the configuration file.

[0054] In some embodiments, the processing flow of the configuration update method is shown as follows: Figure 3 ,like Figure 3 As shown, including:

[0055] like Figure 3 As shown, in step S202a, in response to the attribute type of the configuration file satisfying the first condition, adding first annotation information to the configuration attribute class of the configuration file may specifically include:

[0056] Step S301: Determine whether the configuration attribute class of the configuration file can be edited based on the attribute type.

[0057] Step S302: In response to the configuration attribute class of the configuration file being editable, determining whether the attribute type of the configuration file satisfies a first condition.

[0058] Step S303: in response to the attribute type of the configuration file satisfying the first condition, first annotation information is added to the configuration attribute class of the configuration file.

[0059] In this embodiment, the configuration property class can be used to encapsulate the properties in the configuration file in the Spring framework. By using the @ConfigurationProperties annotation, the configuration property class can map the properties in the configuration file to the properties of the bean.

[0060] As an example, the @ConfigurationProperties annotation is used for the Apollo configuration file in the Spring framework to read the Apollo configuration file into a POJO bean according to the attribute type. Based on the editability included in the attribute type, determine whether the configuration attribute class of the Apollo configuration file can be edited. If it can be edited, determine that the attribute type of the configuration file meets the first condition, and add the @AutoUpdate annotation to the configuration attribute class corresponding to the Apollo configuration file. The @AutoUpdate annotation is used to define that when the configuration item is modified in the configuration attribute class A, the configuration file is triggered to be updated.

[0061] The method of the embodiment of the present application adds annotation information to the configuration property class of the configuration file, defines the update conditions of the configuration file through the annotation information, and automatically triggers the configuration update when the update conditions are met. The configuration items read through any reading rule can be automatically updated, thereby realizing automatic update of the configuration file.

[0062] In some embodiments, the processing flow of the configuration update method is shown as follows: Figure 4 ,like Figure 4 As shown, including:

[0063] like Figure 4 As shown, in step S202b, in response to the attribute type of the configuration file not satisfying the first condition, adding second annotation information to the startup class of the configuration file may specifically include:

[0064] Step S401: Determine whether the configuration attribute class of the configuration file can be edited based on the attribute type.

[0065] Step S402: In response to the configuration attribute class of the configuration file being unable to be edited, it is determined that the attribute type of the configuration file does not satisfy a first condition.

[0066] Step S403: In response to the attribute type of the configuration file not satisfying the first condition, second annotation information is added to the startup class of the configuration file.

[0067] In this embodiment, the configuration property class can be used to encapsulate the properties in the configuration file in the Spring framework. By using the @ConfigurationProperties annotation, the configuration property class can map the properties in the configuration file to the properties of the bean. The startup class can include: a main class with the @SpringBootApplication annotation. The property type of the configuration file that does not meet the first condition can include: the property type of the bean corresponding to the jar package.

[0068] As an example, the @ConfigurationProperties annotation is used for the Apollo configuration file in the Spring framework to read the Apollo configuration file into a POJO bean according to the attribute type. Based on the editability included in the attribute type, determine whether the configuration attribute class of the Apollo configuration file can be edited. If it cannot be edited, determine that the attribute type of the configuration file does not meet the first condition, and add the @EnableApolloAutoUpdateProperties annotation to the startup class of the Apollo configuration file. The @EnableApolloAutoUpdateProperties annotation is used to define that when a new configuration item is added to the configuration attribute class B, the configuration attribute class B in the configuration file is triggered to be updated.

[0069] The method of the embodiment of the present application adds annotation information in the startup class of the configuration file, defines the update conditions of the configuration file through the annotation information, and automatically triggers the configuration update when the update conditions are met. The configuration items read through any reading rule can be automatically updated, thereby realizing automatic update of the configuration file.

[0070] In some embodiments, the processing flow of the configuration update method is shown as follows: Figure 5 ,like Figure 5 As shown, including:

[0071] like Figure 5 As shown, in response to receiving the update instruction for the configuration file, updating the configuration file based on the annotation information in step S103 may include:

[0072] Step S501: in response to receiving an update instruction for a configuration file, determining a first parameter of a corresponding configuration attribute class in the configuration file based on annotation information.

[0073] In this embodiment, when an update instruction for a configuration file is received, all configuration files to be updated are determined based on the annotation information, and the prefix of the configuration file is intercepted to obtain the first parameter of the corresponding configuration attribute class in the configuration file.

[0074] Step S502: Update the configuration file based on the first parameter.

[0075] In this embodiment, the first parameter may include at least one of a property name, a subscript, and a sub-property. Updating the configuration file may include: calling a setter method to automatically update the configuration item in the configuration file.

[0076] As an example, based on the update instruction, the prefix of the configuration file org.A.objectList[1].key1 is intercepted to obtain objectList[1].key1. Among them, objectList is the attribute name, the subscript is 1, and the sub-attribute is key1. Based on the attribute name, subscript, and sub-attribute, the update type corresponding to the configuration file is determined, and the updater matching the update type is called to update the configuration file.

[0077] The method of the embodiment of the present application adds annotation information to the configuration file, defines the update conditions of the configuration file through the annotation information, and automatically triggers the configuration update when the update conditions are met. The configuration items read through any reading rules can be automatically updated. When the configuration file is updated, the updater matching the configuration file can be automatically called to update it, without manual operation, thereby realizing automatic update of the configuration file.

[0078] In some embodiments, the processing flow of the configuration update method is shown as follows: Figure 6 ,like Figure 6 As shown, including:

[0079] like Figure 6 As shown, in response to receiving the update instruction for the configuration file, determining the first parameter of the configuration attribute class corresponding to the configuration file based on the annotation information in step S501 may include:

[0080] Step S601: Determine all configuration files to be updated based on annotation information.

[0081] In this embodiment, the startup event of the application is monitored, and all configuration files for configuration update can be determined according to the annotation information. Determining all configuration files for configuration update can include: based on the annotation information, determining the beans read from the configuration file according to the attribute type.

[0082] As an example, listen to the startup event of the application, get the beans corresponding to all configuration property classes annotated with @ConfigurationProperties and @AutoUpdate, get the beans corresponding to the startup class annotated with @EnableApolloAutoUpdateProperties, and get the beans corresponding to the configuration files annotated with @Value.

[0083] Step S602: Determine the monitoring status of each configuration file in all configuration files.

[0084] Step S603: in response to the monitoring state of the configuration file satisfying the monitoring condition, based on the update instruction, determining a first parameter of the corresponding configuration attribute class in the configuration file.

[0085] In this embodiment, the monitoring state may indicate whether the event of changing the configuration file has been monitored. The monitoring state may satisfy the monitoring condition including: the event of changing the configuration file is the same as the condition that triggers the configuration file to be updated. The event of changing the configuration file may include: adding a configuration item, editing a configuration item, and deleting a configuration item. One or more of the following.

[0086] In this embodiment, when an event of changing a configuration file is monitored, the monitoring state of the configuration file is determined by the prefix of the configuration attribute class of the configuration file. In response to the event of changing the configuration file being the same as the condition that triggers the configuration file to be updated, a corresponding update instruction is generated, and based on the update instruction, the prefix of the configuration file is intercepted to obtain the first parameter of the corresponding configuration attribute class in the configuration file.

[0087] The method of the embodiment of the present application adds annotation information to the configuration file, defines the update conditions of the configuration file through the annotation information, and automatically triggers the configuration update when the update conditions are met. The configuration items read through any reading rules can be automatically updated. When the configuration file is updated, the updater matching the configuration file can be automatically called to update it, without manual operation, thereby realizing automatic update of the configuration file.

[0088] In some embodiments, the processing flow of the configuration update method is shown as follows: Figure 7 ,like Figure 7 As shown, including:

[0089] like Figure 7 As shown, updating the configuration file based on the first parameter in step S502 may include:

[0090] Step S701: Determine the update type corresponding to the configuration file based on the first parameter.

[0091] In this embodiment, the update type may include: simple & single, simple & multiple, object & single, object & multiple. Among them, simple means that the structure of the attribute is a simple attribute structure such as a basic data type, a direct value, and no nesting. Object means that the structure of the attribute is a complex object attribute structure, and the object attribute structure can be represented by a field. Single means a single attribute. Multiple means a series of attributes, and multiple attributes can be stored in a list form.

[0092] As an example, if the attribute name in the first parameter is not empty, the subscript is empty, and the sub-attribute is empty, the configuration file corresponds to the simple & single update type. If the attribute name in the first parameter is not empty, the subscript is empty, and the sub-attribute is not empty, the configuration file corresponds to the object & single update type. If the attribute name in the first parameter is not empty, the subscript is not empty, and the sub-attribute is empty, the configuration file corresponds to the simple & multiple update type. If the attribute name in the first parameter is not empty, the subscript is not empty, and the sub-attribute is not empty, the configuration file corresponds to the object & multiple update type.

[0093] Step S702: call an updater that matches the update type to update the configuration file.

[0094] In this embodiment, the updater SingleSimpleTypePropertyUpdater can match the simple & single update type and is used to update the configuration file of a single simple property structure. The updater SingleObjectTypePropertyUpdater can match the object & single update type and is used to update the configuration file of a single object property structure. The updater ListSimpleTypePropertyUpdater can match the simple & multiple update type and is used to update the configuration file of multiple simple property structures. The updater ListObjectTypePropertyUpdater can match the object & multiple update type and is used to update the configuration file of multiple object property structures.

[0095] The method of the embodiment of the present application adds annotation information to the configuration file, defines the update conditions of the configuration file through the annotation information, and automatically triggers the configuration update when the update conditions are met. The configuration items read through any reading rules can be automatically updated. When the configuration file is updated, the updater matching the configuration file can be automatically called to update it, without manual operation, thereby realizing automatic update of the configuration file.

[0096] refer to Figure 8 , an application scenario diagram of the configuration update method provided in the embodiment of the present application, which is applied to the configuration update of the Apollo configuration file. It includes:

[0097] Step S1, determining all Apollo configuration files for configuration update, including: monitoring the startup event of the application, obtaining the beans corresponding to all configuration property classes annotated with @ConfigurationProperties and @AutoUpdate, obtaining the beans corresponding to the startup classes annotated with @EnableApolloAutoUpdateProperties, and obtaining the beans corresponding to the configuration files annotated with @Value.

[0098] Step S2, through a listener, listens to the event of changing the configuration file, and determines the listening state of the configuration file, including: when the @ApolloConfigChangeListener listener listens to the event of changing the Apollo configuration file, the listening state of the Apollo configuration file is determined by the prefix of the configuration attribute class of the configuration file. The event of changing the configuration file may include: adding a configuration item, editing a configuration item, and deleting a configuration item. One or more.

[0099] Step S3, in response to the monitoring state of the configuration file satisfying the monitoring condition, based on the update instruction, determining the first parameter of the corresponding configuration attribute class in the configuration file, including: in response to the event of changing the Apollo configuration file being the same as the condition triggering the configuration file to be updated, generating a corresponding update instruction, based on the update instruction, intercepting the prefix of the Apollo configuration file, and obtaining the first parameter of the corresponding configuration attribute class in the Apollo configuration file. The first parameter may include at least one of an attribute name, a subscript, and a sub-attribute.

[0100] Step S4, based on the first parameter, the configuration file is updated, including: if the attribute name in the first parameter is not empty, the subscript is empty, and the sub-attribute is empty, then the Apollo configuration file corresponds to the simple & single update type. Call the SingleSimpleTypePropertyUpdater that matches the simple & single update type to update the Apollo configuration file.

[0101] The following is a description of the exemplary structure of the software modules included in the configuration updating device 90 provided in the embodiment of the present application. In some embodiments, for example, Fig. 9 As shown, the configuration updating device 90 may include: a reading module 901, used to read the configuration file based on the set reading rules; an adding module 902, used to add annotation information to the configuration file based on the attribute type of the configuration file; the annotation information is used to define the conditions for triggering the configuration file to be updated; an updating module 903, used to update the configuration file based on the annotation information in response to receiving an update instruction for the configuration file.

[0102] In some embodiments, the adding module 902 is used to: in response to the property type of the configuration file satisfying the first condition, add first annotation information in the configuration property class of the configuration file; in response to the property type of the configuration file not satisfying the first condition, add second annotation information in the startup class of the configuration file, and the first annotation information is different from the second annotation information.

[0103] In some embodiments, the adding module 902 is specifically used to: determine whether the configuration property class of the configuration file can be edited based on the property type; in response to the configuration property class of the configuration file being editable, determine that the property type of the configuration file satisfies a first condition; in response to the property type of the configuration file satisfying the first condition, add first annotation information to the configuration property class of the configuration file; the first annotation information is used to define the conditions for triggering the update of the configuration file.

[0104] In some embodiments, the adding module 902 is specifically used to: determine whether the configuration attribute class of the configuration file can be edited based on the attribute type; in response to the configuration attribute class of the configuration file cannot be edited, determine that the attribute type of the configuration file does not satisfy the first condition; in response to the attribute type of the configuration file not satisfying the first condition, add second annotation information to the startup class of the configuration file; the second annotation information is used to define the configuration attribute class for updating the configuration file and define the conditions for triggering the update of the configuration file.

[0105] In some embodiments, the update module 903 is used to: in response to receiving an update instruction for a configuration file, determine the first parameter of the corresponding configuration attribute class in the configuration file based on the annotation information; the first parameter includes: at least one of the attribute name, subscript and sub-attribute; based on the first parameter, update the configuration file.

[0106] In some embodiments, the update module 903 is specifically used to: determine all configuration files for configuration update based on annotation information; determine the listening status of each configuration file in all configuration files; in response to the listening status of the configuration file satisfying the listening condition, determine the first parameter of the corresponding configuration attribute class in the configuration file based on the update instruction.

[0107] In some embodiments, the update module 903 is specifically used to: determine the update type corresponding to the configuration file based on the first parameter; and call an updater that matches the update type to update the configuration file.

[0108] It should be noted that the description of the device in the embodiment of the present application is similar to the description of the method embodiment above, and has similar beneficial effects as the method embodiment, so it will not be repeated. Figures 1 to 8 The present invention can be understood by referring to the description of any one of the accompanying drawings.

[0109] According to an embodiment of the present application, the present application also provides an electronic device and a non-transitory computer-readable storage medium.

[0110] Fig.10 A schematic block diagram of an example electronic device 800 that can be used to implement an embodiment of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or required herein.

[0111] like Fig.10 As shown, the electronic device 800 includes a computing unit 801, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 to a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the electronic device 800 can also be stored. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0112] Multiple components in the electronic device 800 are connected to the I / O interface 805, including: an input unit 806, such as a keyboard, a mouse, etc.; an output unit 807, such as various types of displays, speakers, etc.; a storage unit 808, such as a disk, an optical disk, etc.; and a communication unit 809, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 809 allows the electronic device 800 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0113] The computing unit 801 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 801 performs the various methods and processes described above, such as the configuration update method. For example, in some embodiments, the configuration update method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 800 via the ROM 802 and / or the communication unit 809. When the computer program is loaded into the RAM 803 and executed by the computing unit 801, one or more steps of the configuration update method described above may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured to perform the configuration update method in any other appropriate manner (e.g., by means of firmware).

[0114] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0115] The program code for implementing the method of the present application can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, implements the functions / operations specified in the flow chart and / or block diagram. The program code can be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0116] In the context of the present application, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0117] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0118] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0119] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.

[0120] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this application can be executed in parallel, sequentially or in different orders, as long as the expected results of the technical solution disclosed in this application can be achieved, and this document is not limited here.

[0121] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A configuration update method, characterized in that: include: Read the configuration file based on the set reading rules; Adding annotation information to the configuration file based on the attribute type of the configuration file; The annotation information is used to define a condition for triggering the configuration file to be updated; The adding annotation information to the configuration file based on the attribute type of the configuration file includes: in response to the attribute type of the configuration file satisfying a first condition, adding first annotation information to the configuration attribute class of the configuration file; in response to the attribute type of the configuration file not satisfying the first condition, adding second annotation information to the startup class of the configuration file, wherein the first annotation information is different from the second annotation information; In response to the attribute type of the configuration file satisfying the first condition, adding first annotation information in the configuration attribute class of the configuration file includes: determining whether the configuration attribute class of the configuration file can be edited based on the attribute type; in response to the configuration attribute class of the configuration file being editable, determining that the attribute type of the configuration file satisfies the first condition; in response to the attribute type of the configuration file satisfying the first condition, adding first annotation information in the configuration attribute class of the configuration file; the first annotation information is used to define a condition that triggers the configuration file to be updated; In response to receiving an update instruction for the configuration file, the configuration file is updated based on the annotation information.

2. The method according to claim 1, characterized in that In response to the attribute type of the configuration file not satisfying the first condition, adding second annotation information to the startup class of the configuration file includes: Based on the attribute type, determining whether the configuration attribute class of the configuration file can be edited; In response to the configuration attribute class of the configuration file being unable to be edited, determining that the attribute type of the configuration file does not satisfy the first condition; In response to the attribute type of the configuration file not satisfying the first condition, adding second annotation information in the startup class of the configuration file; The second annotation information is used to define a configuration property class for updating the configuration file and to define a condition for triggering the updating of the configuration file.

3. The method according to claim 1, characterized in that In response to receiving an update instruction for the configuration file, updating the configuration file based on the annotation information includes: In response to receiving an update instruction for the configuration file, determining a first parameter of a configuration attribute class corresponding to the configuration file based on the annotation information; the first parameter includes: at least one of an attribute name, a subscript, and a sub-attribute; Based on the first parameter, the configuration file is updated.

4. The method according to claim 3, characterized in that In response to receiving an update instruction for the configuration file, determining a first parameter of a configuration attribute class corresponding to the configuration file based on the annotation information includes: Based on the annotation information, determine all configuration files to be updated; Determine the monitoring status of each profile in all profiles; In response to the monitoring state of the configuration file satisfying the monitoring condition, based on the update instruction, a first parameter of the corresponding configuration attribute class in the configuration file is determined.

5. The method according to claim 3, characterized in that: The updating of the configuration file based on the first parameter includes: Based on the first parameter, determining an update type corresponding to the configuration file; An updater matching the update type is called to update the configuration file.

6. A configuration updating device, characterized in that: include: The reading module is used to read the configuration file based on the set reading rules; An adding module, used for adding annotation information to the configuration file based on the attribute type of the configuration file; The annotation information is used to define a condition for triggering the configuration file to be updated; The adding module is further used to add first annotation information to the configuration attribute class of the configuration file in response to the attribute type of the configuration file satisfying the first condition; in response to the attribute type of the configuration file not satisfying the first condition, add second annotation information to the startup class of the configuration file, wherein the first annotation information is different from the second annotation information; The adding module is further used to determine whether the configuration attribute class of the configuration file can be edited based on the attribute type; In response to the configuration attribute class of the configuration file being editable, determining that the attribute type of the configuration file satisfies a first condition; In response to the attribute type of the configuration file satisfying the first condition, adding first annotation information in the configuration attribute class of the configuration file; The first annotation information is used to define a condition for triggering the configuration file to be updated; An updating module is used to update the configuration file based on the annotation information in response to receiving an update instruction for the configuration file.

7. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 5.

8. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to make a computer execute the method according to any one of claims 1-5.

Citation Information

Patent Citations

  • Configuration updating method and device, terminal equipment and storage medium

    CN117880090A