CN114238015A - Attribute updating method and device, electronic equipment and storage medium - Google Patents
Attribute updating method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN114238015A CN114238015A CN202111523279.8A CN202111523279A CN114238015A CN 114238015 A CN114238015 A CN 114238015A CN 202111523279 A CN202111523279 A CN 202111523279A CN 114238015 A CN114238015 A CN 114238015A
- Authority
- CN
- China
- Prior art keywords
- updated
- instance object
- attribute
- attribute configuration
- annotation
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/3065—Monitoring arrangements determined by the means or processing involved in reporting the monitored data
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/3065—Monitoring arrangements determined by the means or processing involved in reporting the monitored data
- G06F11/3072—Monitoring arrangements determined by the means or processing involved in reporting the monitored data where the reporting involves data filtering, e.g. pattern matching, time or event triggered, adaptive or policy-based reporting
- G06F11/3079—Monitoring arrangements determined by the means or processing involved in reporting the monitored data where the reporting involves data filtering, e.g. pattern matching, time or event triggered, adaptive or policy-based reporting the data filtering being achieved by reporting only the changes of the monitored data
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/3089—Monitoring arrangements determined by the means or processing involved in sensing the monitored data, e.g. interfaces, connectors, sensors, probes, agents
- G06F11/3093—Configuration details thereof, e.g. installation, enabling, spatial arrangement of the probes
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
- H04L41/08—Configuration management of networks or network elements
- H04L41/0803—Configuration setting
- H04L41/0813—Configuration setting characterised by the conditions triggering a change of settings
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
- H04L41/50—Network service management, e.g. ensuring proper service fulfilment according to agreements
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/02—Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Stored Programmes (AREA)
Abstract
The application provides a method and a device for updating attributes, electronic equipment and a storage medium, wherein the method comprises the following steps: adding the update annotation into an instance object needing attribute configuration change, and generating an instance object to be updated; wherein, the updating annotation comprises attribute configuration information needing to be changed, and the instance object is stored in the container; acquiring an instance object to be updated, and acquiring a target object of which the attribute configuration needs to be changed from the instance object to be updated; reading attribute configuration values according to attribute configuration information in the updated annotation; and updating the attribute value of the target object according to the attribute configuration value. Only the instance object added with the update annotation needs to be updated, and the influence range of the update attribute configuration is reduced to the minimum; after the configuration information is updated, the service does not need to be restarted, the service available time is increased, the service failure rate is reduced, and meanwhile, the failure cost caused by restarting is reduced.
Description
Technical Field
The present application relates to the field of service frameworks, and in particular, to a method and an apparatus for updating an attribute, an electronic device, and a storage medium.
Background
Feign is a declarative service calling framework under a micro-service system, is very commonly used in a spring closed system, and is largely used in a scene of calling three-party services due to the convenience of Feign. At present, when configuration information of a Feign client service needs to be changed, a corresponding service needs to be restarted, the corresponding service is greatly influenced after the configuration is changed, the service failure rate is high, and system instability, request abnormity and the like can be caused.
Disclosure of Invention
The embodiment of the invention aims to provide a method, a device, electronic equipment and a storage medium for updating an attribute, wherein an update note is added into an instance object of which the attribute needs to be changed, the update note comprises attribute configuration information, a target object of which the attribute needs to be changed is obtained from the instance object according to the update note, an attribute configuration value is read according to the attribute configuration information, and the attribute value of the target object is updated according to the attribute configuration value. The method and the device have the advantages that only the instance object added with the update annotation is updated, the range of influence of attribute configuration updating is minimized, and the problem that corresponding services need to be restarted when attribute configuration is changed in the prior art is solved, so that request abnormity in the restarting process is avoided, and the stability of the system is improved.
In a first aspect, an embodiment of the present application provides a method for updating an attribute, including: adding the update annotation into an instance object needing attribute configuration change, and generating an instance object to be updated; wherein, the updating annotation comprises attribute configuration information needing to be changed, and the instance object is stored in the container; acquiring an instance object to be updated, and acquiring a target object of which the attribute configuration needs to be changed from the instance object to be updated; reading attribute configuration values according to attribute configuration information in the updated annotation; and updating the attribute value of the target object according to the attribute configuration value.
In the implementation process, an update annotation is added to the instance object needing to be changed in attribute configuration, the instance object to be updated is obtained, the target object is obtained from the instance object to be updated, the attribute configuration value is obtained from the update annotation, and the attribute value of the target object is updated according to the attribute configuration value. Only the instance object added with the update annotation needs to be updated, and the influence range of the update attribute configuration is reduced to the minimum; after the configuration information is updated, the service does not need to be restarted, the service available time is increased, the service failure rate is reduced, and meanwhile, the failure cost caused by restarting is reduced.
Optionally, in this embodiment of the present application, adding an update annotation to an instance object whose attribute configuration needs to be changed includes: and identifying the instance object of which the attribute needs to be changed by adding the update annotation, wherein the attribute configuration information comprises an attribute configuration key and an instance object name. In the implementation process, the instance object needing to be changed in attribute configuration is identified by adding the update annotation, wherein the items needing to be changed in attribute configuration can have a plurality of items, the attribute configuration information value is added into the update annotation, the instance object added with the update annotation dynamically modifies the attribute configuration needing to be modified according to the attribute configuration value after the instance object is online next time, only the instance object added with the update annotation needs to be updated, and the influence range of the update attribute configuration is reduced to the minimum.
Optionally, in this embodiment of the present application, the obtaining an instance object to be updated includes: and registering a monitor in the container, wherein the monitor is used for acquiring configuration change information of the instance object, the configuration change information comprises an update annotation of the instance object, and the monitor acquires the instance object to be updated according to the update annotation of the instance object. In the implementation process, the listener is registered in the container storing the instance object, and when the instance object in the container changes, the listener can acquire a change event of the current container and acquire the instance object of which the configuration needs to be changed in an annotation manner.
Optionally, in this embodiment of the present application, the obtaining, by the listener, the to-be-updated instance object according to the update annotation of the instance object includes: and the listener acquires the instance object to be updated according to the update annotation through the container context environment. In the implementation process, the listener registered in the container can obtain the instance object to which the update annotation is added through the context or the container.
Optionally, in this embodiment of the present application, the obtaining an instance object to be updated, and obtaining a target object whose attribute configuration needs to be changed from the instance object to be updated includes: the target object is obtained from a container storing the instance object to be updated by reflection.
Optionally, in this embodiment of the present application, wherein the updating the attribute value of the target object according to the attribute configuration value includes: and updating the attribute value of the target object according to the attribute configuration value through a reflection method.
Optionally, in this embodiment of the present application, the process of updating the attribute is a single thread operation. In the implementation process, the process of updating the attribute configuration is single-thread operation, so that the safety among threads is improved.
In a second aspect, an embodiment of the present application further provides an attribute updating apparatus, including: the annotation adding module is used for adding the updated annotation into the instance object of which the attribute configuration needs to be changed and generating an instance object to be updated; wherein, the updating annotation comprises attribute configuration information needing to be changed, and the instance object is stored in the container; the object obtaining module is used for obtaining the instance object to be updated and obtaining the target object of which the attribute configuration needs to be changed from the instance object to be updated; the reading module is used for reading the attribute configuration value according to the attribute configuration information in the updated annotation; and the updating module is used for updating the attribute value of the target object according to the attribute configuration value.
Optionally, in this embodiment of the present application, the annotation adding module is further configured to identify an instance object whose attribute needs to be changed by adding an update annotation, where the attribute configuration information includes an attribute configuration key and an instance object name.
Optionally, in an embodiment of the present application, the object obtaining module further includes a listener unit; the listener unit is used for registering a listener in the container, wherein the listener is used for acquiring configuration change information of the instance object, and the configuration change information comprises an update annotation of the instance object; and acquiring the instance object to be updated according to the update annotation of the instance object by the listener.
Optionally, in this embodiment of the present application, the listener unit is further configured to obtain, through the container context environment, an instance object to be updated according to the update annotation.
Optionally, in this embodiment of the present application, the obtain object module is further configured to obtain, through reflection, the target object from a container storing the instance object to be updated.
Optionally, in this embodiment of the present application, the updating module is further configured to update the attribute value of the target object according to the attribute configuration value through a reflection method.
Optionally, in this embodiment of the present application, the attribute updating apparatus further includes: and the thread module is used for single thread operation of updating the attribute.
In a third aspect, an embodiment of the present application further provides an electronic device, including: a processor and a memory, the memory storing processor-executable machine-readable instructions, the machine-readable instructions when executed by the processor performing the method as described above.
In a fourth aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored, where the computer program is executed by a processor to perform the above-described method.
By adopting the method, the device, the electronic equipment and the storage medium for updating the attribute, only the instance object added with the update annotation is updated, the influence range of attribute configuration updating is minimized, and the problem that the corresponding service needs to be restarted when the attribute configuration is changed in the prior art is avoided, so that request abnormity in the restarting process is avoided, and the stability of the system is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and that those skilled in the art can also obtain other related drawings based on the drawings without inventive efforts.
Fig. 1 is a schematic flowchart of a method for updating an attribute according to an embodiment of the present application;
fig. 2 is a schematic flowchart of a method for updating an attribute of a uniform resource locator by a Feign client according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of an attribute updating apparatus according to an embodiment of the present disclosure; and
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
Embodiments of the present invention will be described in detail below with reference to the accompanying drawings. The following examples are merely used to more clearly illustrate the technical solutions of the present application, and therefore are only examples, and the protection scope of the present application is not limited thereby.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs; the terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application.
In the description of the embodiments of the present application, the technical terms "first", "second", and the like are used only for distinguishing different objects, and are not to be construed as indicating or implying relative importance or implicitly indicating the number, specific order, or primary-secondary relationship of the technical features indicated. In the description of the embodiments of the present application, "a plurality" means two or more unless specifically defined otherwise.
Before introducing the method for updating attributes provided in the embodiment of the present application, some concepts related to the embodiment of the present application are introduced:
feign is a lightweight client framework for HTTP requests. HTTP request calling is initiated in an interface filling and solving mode, interface-oriented programming is conducted, and direct calling in a mode of packaging HTTP request messages in Java is not conducted. The service consumer takes the interface to the service provider and calls it as a local interface method, actually issuing a remote request. The method is more convenient to call the HTTP-based API and widely applied to the Spring Cloud solution.
Spring Cloud is an ordered collection of a series of frameworks. The development convenience of the Spring Boot is utilized to skillfully simplify the development of infrastructure of a distributed system, such as service discovery registration, configuration center, message bus, load balancing, circuit breaker, data monitoring and the like, and the Spring Boot can be used for one-key starting and deployment in a development style. Please refer to fig. 1, which is a schematic flowchart illustrating an attribute updating method according to an embodiment of the present application.
Step S110: adding the update annotation into an instance object needing attribute configuration change, and generating an instance object to be updated; wherein, the updating annotation comprises attribute configuration information needing to be changed, and the instance object is stored in the container.
The embodiment of the step S110 includes: adding an update note into an instance object needing to change the attribute configuration, and generating an instance object to be updated, wherein the update note comprises attribute configuration information needing to be changed, and the instance object is stored in a container, and specifically, the instance object may be a bean in a spring container.
In a preferred embodiment, the scheme can be used for changing the attribute configuration of the Feign client, and the changed attribute configuration includes, but is not limited to, a uniform resource locator, a timeout time and the like. The Feign client is stored in a Spring container in the form of a single bean in Spring, the bean needing to change the attribute is identified by adding an update note, specifically, the update note is added on a Feign client interface needing to change the attribute configuration, the update note can be @ PrepareLaunchClient, the attribute configuration information needing to be changed is configured in the update note, and specifically, for example, when the uniform resource locator needs to be changed, a key where the URL needing to be changed is located is configured in the note.
After step S110, step S120 is performed: and acquiring the instance object to be updated, and acquiring a target object of which the attribute configuration needs to be changed from the instance object to be updated.
The embodiment of the step S120 includes: the instance object to be updated is the instance object to which the update annotation has been added, and the listener configured by adding the attribute can acquire the instance object to which the update annotation is added from the container when the instance object in the container changes, specifically, for example, the Feign client to which the @ preparlannechclient annotation is added is acquired from the spring container.
After step S120, step S130 is performed: and reading the attribute configuration value according to the attribute configuration information in the updated annotation.
The embodiment of the step S130 includes: reading the attribute configuration value in the attribute configuration information, specifically, for example, reading a value corresponding to a key where the URL to be changed configured in the update annotation is located.
After step S130, step S140 is performed: and updating the attribute value of the target object according to the attribute configuration value.
The embodiment of the step S140 includes: and updating the attribute value of the target object according to the attribute configuration value, specifically, for example, modifying the URL in the Feign client, wherein the modified value is the value corresponding to the key of the URL identified in the @ preparalanchclient annotation.
It should be noted that, after the listener updates the URL attribute value in the Feign client, other requests initiate a call to the Feign client again, and use the updated URL value.
In the implementation process, an update annotation is added to the instance object needing to be changed in attribute configuration, the instance object to be updated is obtained, the target object is obtained from the instance object to be updated, the attribute configuration value is obtained from the update annotation, and the attribute value of the target object is updated according to the attribute configuration value. Only the instance object added with the update annotation needs to be updated, and the influence range of the update attribute configuration is reduced to the minimum; after the configuration information is updated, the service does not need to be restarted, the service available time is increased, the service failure rate is reduced, and meanwhile, the failure cost caused by restarting is reduced.
Optionally, in this embodiment of the present application, adding an update annotation to an instance object whose attribute configuration needs to be changed includes: and identifying the instance object of which the attribute needs to be changed by adding the update annotation, wherein the attribute configuration information comprises an attribute configuration key and an instance object name.
The implementation manner of the above steps is as follows: the instance object needing attribute change is identified by adding the update annotation, namely, the update annotation is only added to the instance object needing configuration change, and when the attribute configuration is updated, the instance object added with the update annotation is only updated. In the implementation process, the Feign client attribute configuration is updated in real time, and the instance object needing to be updated and configured is marked in a mode of adding an update annotation, so that the attribute configuration updating service is prevented from being restarted, and the influence of the attribute configuration updating is minimized.
Optionally, in this embodiment of the application, the obtaining of the instance object to be updated includes: and registering a monitor in the container, wherein the monitor is used for acquiring configuration change information of the instance object, the configuration change information comprises an update annotation of the instance object, and the monitor acquires the instance object to be updated according to the update annotation of the instance object.
The implementation manner of the above steps is as follows: registering a listener in a container, and if the attribute configuration in the container is changed, acquiring change information by the listener, wherein the change information is the attribute configuration information needing to be changed, and acquiring the to-be-updated instance object added with an update note from the container. In a preferred embodiment, the adding monitor is a watch configured for the attribute currently applied by the zookeeper, when the attribute configuration is changed, the zookeeper sends attribute configuration change information to the monitor, the attribute configuration change information includes a value of the attribute configuration to be changed, and after the monitor acquires the change information, the monitor acquires the to-be-updated instance object to which the update annotation is added from the container.
Optionally, in this embodiment of the present application, the obtaining, by the listener, the to-be-updated instance object according to the update annotation of the instance object includes: and the listener acquires the instance object to be updated according to the update annotation through the container context environment.
The implementation manner of the above steps is as follows: the monitor acquires the change information of the container, and may acquire the object to be updated to which the update annotation is added through the container, specifically, for example, the monitor registered in the Spring container acquires the object to be updated to which the update annotation is added through an application context in Spring, or through a getfeanswithindication (class association type) method provided by Spring container BeanFactory.
Optionally, in this embodiment of the present application, obtaining an instance object to be updated, and obtaining a target object whose attribute configuration needs to be changed from the instance object to be updated includes: the target object is obtained from a container storing the instance object to be updated by reflection.
The implementation manner of the above steps is as follows: updating the attribute configuration of the Feign client, acquiring a Feign client proxy object from the Spring container for storing the entity object to be updated, and acquiring a target object according to the Feign client proxy object through reflection.
Optionally, in this embodiment of the application, wherein updating the attribute value of the target object according to the attribute configuration value includes: and updating the attribute value of the target object according to the attribute configuration value through a reflection method.
Optionally, in this embodiment of the present application, a process of updating the attribute is a single thread operation. In the implementation process, the process of updating the attribute configuration is single-thread operation, so that the safety among threads is improved.
Please refer to fig. 2, which is a schematic flowchart illustrating a method for updating an url attribute of a Feign client according to an embodiment of the present application;
in a preferred embodiment, the method for updating attributes provided by the present application can be applied to a Feign client. As shown in fig. 2, updating the path attribute of the Feign client, where the Feign client is stored in a Spring container in the form of a single bean in Spring, adding an update note @ preparranchclient to the Feign client interface needing to change the path, and configuring the attribute configuration information needing to be changed, that is, the path configuration information needing to be changed, in the update note;
the method comprises the steps that a listener adds the listener to a router of a configuration path currently applied by the Zookeeper, and when the configuration path is changed, the Zookeeper sends path change information to the listener, so that the listener monitors that the configuration of the Zookeeper path is changed;
the listener acquires a proxy object of the bean added with the update annotation from the Spring container;
acquiring a value of path configuration information to be changed in the update annotation, such as "URL" ═ user.
Acquiring a target object from the proxy object, wherein the target object is acquired from the bean proxy object and needs to change the path attribute at the Feign client;
configuring the path attribute of the target object to be the updated value of 'user.url';
and after the target object, namely the Feign client path value needing to change the path attribute is updated successfully, initiating the call to the Feign client again by other requests, and using the updated path value.
In the implementation process, an update annotation is added to the instance object needing to change the attribute configuration, the agent object of the bean of the update annotation is obtained, the target object is obtained from the agent object of the bean of the update annotation, the attribute configuration value is obtained from the update annotation, and the attribute value of the target object is updated according to the attribute configuration value. Only the target object is selected from the agent objects of the annotated bean to be updated, and the influence range of the updated attribute configuration is reduced to the minimum. And the target object can be directly reused after being updated without restarting service after the configuration information is updated, so that the service available time is increased, the service failure rate is reduced, and the failure cost caused by restarting is reduced.
Please refer to fig. 3, which is a schematic structural diagram of an attribute updating apparatus according to an embodiment of the present application; the embodiment of the present application provides an update attribute 200, including:
an add annotation module 210, configured to add an update annotation into an instance object whose attribute configuration needs to be changed, and generate an instance object to be updated; wherein, the updating annotation comprises attribute configuration information needing to be changed, and the instance object is stored in the container;
the object obtaining module 220 is configured to obtain an instance object to be updated, and obtain a target object whose attribute configuration needs to be changed from the instance object to be updated;
a reading module 230, configured to read an attribute configuration value according to the attribute configuration information in the updated annotation; and
and an updating module 240, configured to update the attribute value of the target object according to the attribute configuration value.
It should be understood that the apparatus corresponds to the above-mentioned server routing method embodiment, and can perform the steps related to the above-mentioned method embodiment, and the specific functions of the apparatus can be referred to the above description, and the detailed description is appropriately omitted here to avoid redundancy. The device includes at least one software function that can be stored in memory in the form of software or firmware (firmware) or solidified in the Operating System (OS) of the device.
Please refer to fig. 4 for a schematic structural diagram of an electronic device according to an embodiment of the present application. An electronic device 300 provided in an embodiment of the present application includes: a processor 310 and a memory 320, the memory 320 storing machine readable instructions executable by the processor 310, the machine readable instructions when executed by the processor 310 performing the method as above.
The embodiment of the application also provides a storage medium, wherein the storage medium is stored with a computer program, and the computer program is executed by a processor to execute the method.
The storage medium may be implemented by any physical object type volatile or nonvolatile storage device or a combination thereof, such as a Static Random Access Memory (SRAM), an Electrically Erasable Programmable Read-Only Memory (EEPROM), an Erasable Programmable Read-Only Memory (EPROM), a Programmable Read-Only Memory (PROM), a Read-Only Memory (ROM), a magnetic Memory, a flash Memory, a magnetic disk, or an optical disk.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The apparatus embodiments described above are merely illustrative, and for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The above description is only an alternative embodiment of the embodiments of the present application, but the scope of the embodiments of the present application is not limited thereto, and any person skilled in the art can easily conceive of changes or substitutions within the technical scope of the embodiments of the present application, and all the changes or substitutions should be covered by the scope of the embodiments of the present application.
Claims (10)
1. A method of updating attributes, comprising:
adding the update annotation into an instance object needing attribute configuration change, and generating an instance object to be updated; wherein the update annotation comprises the attribute configuration information to be changed, and the instance object is stored in a container;
acquiring the instance object to be updated, and acquiring a target object of which the attribute configuration needs to be changed from the instance object to be updated;
reading attribute configuration values according to the attribute configuration information in the updated annotation; and
and updating the attribute value of the target object according to the attribute configuration value.
2. The method of claim 1, wherein adding an update annotation to an instance object requiring a change to a property configuration comprises:
and identifying the instance object of which the attribute needs to be changed by adding an update annotation, wherein the attribute configuration information comprises an attribute configuration key and an instance object name.
3. The method according to claim 1, wherein obtaining the instance object to be updated comprises:
registering a listener in the container, wherein the listener is configured to obtain configuration change information of the instance object, and the configuration change information includes the update annotation of the instance object;
and the listener acquires the instance object to be updated according to the update annotation of the instance object.
4. The method of claim 3, wherein obtaining, by the listener, an instance object to be updated according to the updated annotation for the instance object comprises:
and the listener acquires the instance object to be updated according to the update annotation through the container context environment.
5. The method according to claim 1, wherein obtaining the instance object to be updated and obtaining the target object whose attribute configuration needs to be changed from the instance object to be updated comprises:
and acquiring a target object from a container storing the instance object to be updated through reflection.
6. The method of claim 1, wherein updating the attribute value of the target object according to the attribute configuration value comprises:
and updating the attribute value of the target object according to the attribute configuration value through a reflection method.
7. The method of claim 1, wherein the process of updating the attributes is a single threaded operation.
8. An apparatus for updating attributes, comprising:
the annotation adding module is used for adding the updated annotation into the instance object of which the attribute configuration needs to be changed and generating an instance object to be updated; wherein the update annotation comprises the attribute configuration information to be changed, and the instance object is stored in a container;
the object obtaining module is used for obtaining the instance object to be updated and obtaining a target object of which the attribute configuration needs to be changed from the instance object to be updated;
the reading module is used for reading the attribute configuration value according to the attribute configuration information in the updated annotation; and
and the updating module is used for updating the attribute value of the target object according to the attribute configuration value.
9. An electronic device, comprising: a processor and a memory, the memory storing machine-readable instructions executable by the processor, the machine-readable instructions, when executed by the processor, performing the method of any of claims 1 to 7.
10. A computer-readable storage medium, having stored thereon a computer program which, when executed by a processor, performs the method of any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111523279.8A CN114238015B (en) | 2021-12-13 | 2021-12-13 | A method, device, electronic device and storage medium for updating attributes |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111523279.8A CN114238015B (en) | 2021-12-13 | 2021-12-13 | A method, device, electronic device and storage medium for updating attributes |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114238015A true CN114238015A (en) | 2022-03-25 |
CN114238015B CN114238015B (en) | 2025-06-20 |
Family
ID=80755541
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111523279.8A Active CN114238015B (en) | 2021-12-13 | 2021-12-13 | A method, device, electronic device and storage medium for updating attributes |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114238015B (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106990979A (en) * | 2017-01-22 | 2017-07-28 | 阿里巴巴集团控股有限公司 | A kind of configuration information update method, system, client and server |
CN107360018A (en) * | 2017-06-05 | 2017-11-17 | 小草数语(北京)科技有限公司 | Config update method and device |
CN108733399A (en) * | 2017-04-13 | 2018-11-02 | 北京京东尚科信息技术有限公司 | The method and apparatus that dynamic updates configuration data |
US20180357274A1 (en) * | 2017-06-07 | 2018-12-13 | Sap Se | Dynamic, variable-data attribute data service |
CN111651221A (en) * | 2020-07-14 | 2020-09-11 | 迈普通信技术股份有限公司 | Annotation internationalization method and device, storage medium and electronic equipment |
-
2021
- 2021-12-13 CN CN202111523279.8A patent/CN114238015B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106990979A (en) * | 2017-01-22 | 2017-07-28 | 阿里巴巴集团控股有限公司 | A kind of configuration information update method, system, client and server |
CN108733399A (en) * | 2017-04-13 | 2018-11-02 | 北京京东尚科信息技术有限公司 | The method and apparatus that dynamic updates configuration data |
CN107360018A (en) * | 2017-06-05 | 2017-11-17 | 小草数语(北京)科技有限公司 | Config update method and device |
US20180357274A1 (en) * | 2017-06-07 | 2018-12-13 | Sap Se | Dynamic, variable-data attribute data service |
CN111651221A (en) * | 2020-07-14 | 2020-09-11 | 迈普通信技术股份有限公司 | Annotation internationalization method and device, storage medium and electronic equipment |
Also Published As
Publication number | Publication date |
---|---|
CN114238015B (en) | 2025-06-20 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109639636B (en) | Service data forwarding method, service data processing method, service data forwarding device, service data processing device and electronic equipment | |
CN109542529B (en) | Function name-based point burying method and device, computer equipment and storage medium | |
CN108769124B (en) | Application deployment method, device, server and storage medium of PaaS platform | |
CN111367662B (en) | Load balancing method, device and system | |
CN109492013B (en) | Data processing method, device and system applied to database cluster | |
EP2876866A1 (en) | Communication apparatus, communication method, and recording medium | |
EP2876865A1 (en) | Communication apparatus, communication system, communication method, and recording medium | |
CN107835228B (en) | Instruction processing method and device based on dynamic generalized routing | |
CN114144761B (en) | Publishing system, pushing method, application device, receiving device and service management device | |
US20150133106A1 (en) | Communication apparatus, communication system, communication method, and recording medium | |
CN107102908B (en) | Data verification method, data fault tolerance method and device | |
CN106933547A (en) | Method, device and more new system that global information is obtained and processed | |
CN110580305B (en) | Method, apparatus, system and medium for generating identifier | |
CN113940037B (en) | Resource subscription method, device, computer equipment and storage medium | |
CN109257396B (en) | Distributed lock scheduling method and device | |
JP2015082149A (en) | Communication system, communication method, and communication program | |
CN113094211B (en) | Backup data processing method and device | |
CN115237459A (en) | Software development kit generation method, device, equipment, storage medium and product | |
CN112737921A (en) | Message interaction method, client and communication system | |
CN113010328A (en) | Information sharing method and device, terminal equipment and storage medium | |
CN108521342B (en) | Cluster management method and device | |
CN111988143B (en) | Key updating method, device, equipment and storage medium | |
CN111327680B (en) | Authentication data synchronization method, device, system, computer equipment and storage medium | |
CN114238015A (en) | Attribute updating method and device, electronic equipment and storage medium | |
CN110417601B (en) | Information prompting method, device and system in client and readable storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |