CN110795135A - Method and device for realizing injection-resolution configuration - Google Patents
Method and device for realizing injection-resolution configuration Download PDFInfo
- Publication number
- CN110795135A CN110795135A CN201810863084.XA CN201810863084A CN110795135A CN 110795135 A CN110795135 A CN 110795135A CN 201810863084 A CN201810863084 A CN 201810863084A CN 110795135 A CN110795135 A CN 110795135A
- Authority
- CN
- China
- Prior art keywords
- value
- configkey
- configpath
- key value
- configuration
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 33
- 238000004590 computer program Methods 0.000 claims description 9
- 238000006243 chemical reaction Methods 0.000 abstract description 6
- 235000010627 Phaseolus vulgaris Nutrition 0.000 description 15
- 244000046052 Phaseolus vulgaris Species 0.000 description 15
- 238000010586 diagram Methods 0.000 description 11
- 238000004891 communication Methods 0.000 description 7
- 230000006870 function Effects 0.000 description 6
- 230000008569 process Effects 0.000 description 6
- 238000012545 processing Methods 0.000 description 6
- 230000003287 optical effect Effects 0.000 description 4
- 238000013461 design Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 238000012986 modification Methods 0.000 description 3
- 230000008901 benefit Effects 0.000 description 2
- 230000008878 coupling Effects 0.000 description 2
- 239000000835 fiber Substances 0.000 description 2
- 230000009545 invasion Effects 0.000 description 2
- 230000000644 propagated effect Effects 0.000 description 2
- 239000004065 semiconductor Substances 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- 238000010276 construction Methods 0.000 description 1
- 238000010168 coupling process Methods 0.000 description 1
- 238000005859 coupling reaction Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 238000002347 injection Methods 0.000 description 1
- 239000007924 injection Substances 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 238000012805 post-processing Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/70—Software maintenance or management
- G06F8/71—Version control; Configuration management
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/70—Software maintenance or management
- G06F8/73—Program documentation
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Library & Information Science (AREA)
- Computer Security & Cryptography (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a method and a device for realizing injection-resolution configuration, and relates to the technical field of computers. One embodiment of the method comprises: reading the configuration file to realize environment setting; creating a component factory class and adding a component definition; executing the container post-processor, and then synchronizing configuration information; a component object is created. The implementation mode can solve the problems that the conversion from the character string to the program type is wrong, and the logic for acquiring the remote configuration information is highly invasive to the service.
Description
Technical Field
The invention relates to the technical field of computers, in particular to a method and a device for realizing annotation type configuration.
Background
Currently, most application systems require some configuration information. Such as the setting of a service logic threshold (a single amount under a single user is allowed a day), the setting of some switches (whether or not to walk through the logic). Such information is usually stored in a zookeeper (distributed, open source code distributed application coordination service) or a configuration service center implemented by itself, and a passive notification or active polling manner is adopted to obtain a remote value (all in the form of a character string), and then the remote value is converted into a data type (Integer, Boolean, Date, etc.) required by a program and then cached in a local place (for example, in a certain static variable in the JVM).
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art:
the conversion from "character string" to "program type" and caching to local, this process, disperse in the application needs all places of configuration information, have certain intrusiveness to the business logic of the application program, and if improper with remote synchronization, still influence the normal business logic execution.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for implementing annotation configuration, which can solve the problem that a conversion from a string to a program type is erroneous and the service intrusiveness of acquiring remote configuration information logic is high.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided a method for implementing annotation-oriented configuration, including reading a configuration file to implement environment setting; creating a component factory class and adding a component definition; executing the container post-processor, and then synchronizing configuration information; a component object is created.
Optionally, executing the container post-processor, and then synchronizing the configuration information, comprises:
analyzing the @ ConfigPath and the @ ConfigKey to obtain a Key Value and a Value which respectively correspond to the @ ConfigPath and the @ ConfigKey;
connecting a remote configuration center, and judging whether a Key Value and a Value respectively corresponding to the @ ConfigPath and the @ ConfigKey exist;
if the Value exists, acquiring a Key Value and a Value of @ ConfigPath of the remote configuration center, and a Key Value and a Value of @ ConfigKey to update to the local;
and if the Value does not exist, adding the Key Value and the Value of the @ ConfigPath and the Key Value and the Value of the @ ConfigKey after parsing in the remote configuration center.
Optionally, annotations are added to the Key Value and Value of the parsed @ ConfigPath, and the Key Value and Value of the parsed @ ConfigKey.
Optionally, before obtaining the Key Value and the Value of @ ConfigPath, and the Key Value and the Value of @ ConfigKey, of the remote configuration center, the method includes:
converting the character string form of the configuration information into a value of a data type corresponding to Key through PropertyEditor of a Spring frame; the configuration information is Key Value and Value of @ ConfigPath of the remote configuration center, and Key Value and Value of @ ConfigKey.
In addition, according to an aspect of the embodiments of the present invention, there is provided an apparatus for implementing annotation configuration, including a setting module, configured to read a configuration file to implement environment setting; creating a component factory class and loading a component definition; a configuration module to execute the container post-processor and then synchronize configuration information to create the component object.
Optionally, the configuration module executes the container post-processor and then synchronizes configuration information, including:
analyzing the @ ConfigPath and the @ ConfigKey to obtain a Key Value and a Value which respectively correspond to the @ ConfigPath and the @ ConfigKey;
connecting a remote configuration center, and judging whether a Key Value and a Value respectively corresponding to the @ ConfigPath and the @ ConfigKey exist;
if the Value exists, acquiring a Key Value and a Value of @ ConfigPath of the remote configuration center, and a Key Value and a Value of @ ConfigKey to update to the local;
and if the Value does not exist, adding the Key Value and the Value of the @ ConfigPath and the Key Value and the Value of the @ ConfigKey after parsing in the remote configuration center.
Optionally, the configuration module is further configured to:
and adding annotations to the Key Value and the Value of the parsed @ ConfigPath and the Key Value and the Value of the parsed @ ConfigKey.
Optionally, before the configuration module obtains the Key Value and the Value of @ ConfigPath of the remote configuration center, and the Key Value and the Value of @ ConfigKey, the configuration module includes:
converting the character string form of the configuration information into a value of a data type corresponding to Key through PropertyEditor of a Spring frame; the configuration information is Key Value and Value of @ ConfigPath of the remote configuration center, and Key Value and Value of @ ConfigKey.
According to another aspect of the embodiments of the present invention, there is also provided an electronic device, including:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any of the embodiments described above that implement the explicit configuration.
According to another aspect of the embodiments of the present invention, there is also provided a computer readable medium, on which a computer program is stored, which when executed by a processor, implements the method according to any of the embodiments based on implementing an annotated configuration described above.
One embodiment of the above invention has the following advantages or benefits: the invention realizes a configuration information synchronization client terminal with low invasion to the service by combining the injection type configuration with Spring (a design level framework of open source codes, which solves the loose coupling problem of a service logic layer and other layers), thereby realizing the automatic conversion of configuration information and types, simultaneously unifying the processing logic of the configuration information, and being transparent and low-invasion to the application.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of a main flow of a method of implementing an annotated configuration according to an embodiment of the invention;
FIG. 2 is a schematic diagram of a main flow of a method of implementing an annotated configuration according to a referenced embodiment of the invention;
FIG. 3 is a schematic diagram of the major modules of an apparatus implementing an annotated configuration according to an embodiment of the invention;
FIG. 4 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 5 is a schematic block diagram of a computer system suitable for use in implementing a terminal device or server of an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Fig. 1 is a schematic diagram of a main flow of a method for implementing an annotated configuration according to an embodiment of the present invention, which may include:
step S101, reading the configuration file to realize environment setting.
Step S102, creating a component factory class and loading a component definition.
Preferably, the component employed in the present invention is a Bean, and the component factory class is Bean factory. Further, a BeanFactory may be created, and the Bean definition may be loaded.
Step S103, executing the container post processor, then synchronizing the configuration information, and further creating the component object.
Preferably, if the component employed is a Bean, the container post processor is executed and then synchronizes the configuration information, thereby creating the Bean object.
In a further embodiment, when executing the container post processor and then synchronizing the configuration information, this may be done by:
and analyzing the @ ConfigPath and the @ ConfigKey to obtain a Key Value and a Value corresponding to the @ ConfigPath and the @ ConfigKey respectively.
And connecting a remote configuration center, and judging whether a Key Value and a Value respectively corresponding to the @ ConfigPath and the @ ConfigKey exist.
And according to the judgment result, if the Value exists, acquiring the Key Value and the Value of the @ ConfigPath of the remote configuration center, and the Key Value and the Value of the @ ConfigKey to update to the local. And if the Value does not exist, adding the Key Value and the Value of the @ ConfigPath and the Key Value and the Value of the @ ConfigKey after parsing in the remote configuration center.
In a further embodiment, annotations may be added to the Key Value, Value of parsed @ ConfigPath, and the Key Value and Value of parsed @ ConfigKey.
It should be further noted that before updating the configuration information of the remote configuration center (i.e. Key Value and Value of @ ConfigPath, and Key Value and Value of @ ConfigKey of the remote configuration center) to the local, the character string form of the configuration information may be converted into a Value of the data type corresponding to the Key by PropertyEditor of the Spring framework.
As another reference embodiment of the present invention, as shown in fig. 2, this embodiment implements an annotated configuration based on a characteristic of Spring, and the method for implementing the annotated configuration may include:
in step S201, property sources and profiles are parsed to complete the setting of the environment.
Wherein, the configuration file can be read by analyzing the property sources and the profiles.
In step S202, component factory classes are created to build containers.
For example, an IOC (inversion of control) container may be obtained by creating a Bean factory (Bean factory class). Wherein, the IOC (inversion of control) is a law for reducing program coupling.
In step S203, the component definition is loaded.
Wherein the component definitions are for example: the Bean definition (i.e., Bean definition) is used to describe an instance of a Bean, including: attributes, constructors, parameters, and other Bean-related information.
Step S204, executing the container post processor, and synchronizing the configuration information so as to make the configuration information of the local configuration center consistent with that of the remote configuration center.
In the embodiment, the synchronization of the configuration information is performed after the container postprocessor is executed, so that the configuration information is in the latest state when the service logic is executed, the synchronization of the configuration information is perfectly decoupled from the service logic, and the synchronization of the configuration information with the configuration information of the remote configuration center is ensured. The specific implementation process comprises the following steps:
the method comprises the following steps: parsing @ ConfigPath and @ ConfigKey to obtain the Key Value, Value of @ ConfigPath, and the Key Value and Value of @ ConfigKey.
Step two: connecting a remote configuration center, judging whether a Key Value and a Value of the @ ConfigPath after the analysis and a Key Value and a Value of the @ ConfigKey after the analysis exist, if so, executing a third step, and if not, executing a fourth step.
Step three: and acquiring a Key Value and a Value of @ ConfigPath and a Key Value and a Value of @ ConfigKey of the remote configuration center to update to the local.
Preferably, after the configuration information of the remote configuration center is obtained, a character string form of the configuration information may be converted into a value of a data type corresponding to Key through a PropertyEditor (for completing conversion between the data type and the character string) of a Spring framework (which is a design level framework of open source code). The configuration information is Key Value and Value of @ ConfigPath of the remote configuration center, and Key Value and Value of @ ConfigKey.
Step four: and adding the Key Value and the Value of the parsed @ ConfigPath, and the Key Value and the Value of the @ ConfigKey to a remote configuration center.
It is worth mentioning that the remote configuration center can be monitored to monitor the Key Value and the Value of @ ConfigPath and to monitor the Key Value and the Value of @ ConfigKey after either step three or step four is executed.
In step S205, a component object is created, which defaults to a singleton.
For example, a component when a Bean may call the Bean's constructor, creating an instance of the Bean, to create the Bean object.
It should be noted that, in the present invention, since the configuration information is static, when the configuration information needs to be referred to, it can be directly used (i.e. accessible):
class name attribute name
As a further embodiment of the present invention, annotations are added to the Key Value and Value of @ ConfigPath and the Key Value and Value of @ ConfigKey, so that lower intrusiveness to the service can be achieved, that is, compared with the traditional configuration information synchronization mode, the purpose of logical decoupling from the service is achieved by encapsulating the logic of configuration information synchronization into the annotation and container post-processing.
Where @ ConfigPath may indicate that this class is a configuration class, corresponding to a path in the remote configuration center, for example: value "/yanglikun", i.e. configure Path. In addition, the @ ConfigPath has a corresponding read-write permission value, and the method supporting the spring placeholder loads the key under different operating environments according to the profile. For example: readToken ═ $ { ucc. yanglikun. readToken } ", i.e., read the key. writeToken ═ $ { ucc. yanglikun. writeToken } ", i.e., write a key.
Where, the @ ConfigKey may represent specific configuration information (Key, Value), and the default field name is the Key of the remote configuration center, which may also be customized, for example: @ ConfigKey ("custom _ key _ name"), i.e., specifying field values, default field names.
Fig. 3 is an apparatus for implementing the annotated configuration according to an embodiment of the present invention, and as shown in fig. 3, the apparatus 300 for implementing the annotated configuration includes a setup module 301 and a configuration module 302. The setting module 301 reads the configuration file to implement environment setting; create component factory classes, and load component definitions. Thereafter, the configuration module 302 executes the container post-processor and then synchronizes the configuration information, thereby creating the component object.
As a further embodiment, the configuration module 302 executes a container post-processor, and then the specific implementation process of synchronizing the configuration information includes:
and analyzing the @ ConfigPath and the @ ConfigKey to obtain a Key Value and a Value corresponding to the @ ConfigPath and the @ ConfigKey respectively.
And connecting a remote configuration center, and judging whether a Key Value and a Value respectively corresponding to the @ ConfigPath and the @ ConfigKey exist. And according to the judgment result, if the Value exists, acquiring the Key Value and the Value of the @ ConfigPath of the remote configuration center, and the Key Value and the Value of the @ ConfigKey to update to the local. And if the Value does not exist, adding the Key Value and the Value of the @ ConfigPath and the Key Value and the Value of the @ ConfigKey after parsing in the remote configuration center.
Preferably, annotations are added to the Key Value and Value of the parsed @ ConfigPath, and the Key Value and Value of the parsed @ ConfigKey.
It should be further noted that before acquiring the Key Value and Value of @ ConfigPath, and the Key Value and Value of @ ConfigKey of the remote configuration center, the PropertyEditor of the Spring framework converts the string format of the configuration information into the Value of the data type corresponding to the Key. The configuration information is Key Value and Value of @ ConfigPath of the remote configuration center, and Key Value and Value of @ ConfigKey.
It should be noted that, in the implementation of the apparatus for implementing the annotated configuration according to the present invention, the details have been described in the above method for implementing the annotated configuration, and therefore, the repeated contents are not described herein.
Fig. 4 illustrates an exemplary system architecture 400 of an apparatus implementing an annotated configuration or a method of implementing an annotated configuration to which embodiments of the invention may be applied.
As shown in fig. 4, the system architecture 400 may include terminal devices 401, 402, 403, a network 404, and a server 405. The network 404 serves as a medium for providing communication links between the terminal devices 401, 402, 403 and the server 405. Network 404 may include various types of connections, such as wire, wireless communication links, or fiber optic cables, to name a few.
A user may use terminal devices 401, 402, 403 to interact with a server 405 over a network 404 to receive or send messages or the like. The terminal devices 401, 402, 403 may have installed thereon various communication client applications, such as shopping-like applications, web browser applications, search-like applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only).
The terminal devices 401, 402, 403 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 405 may be a server providing various services, such as a background management server (for example only) providing support for shopping websites browsed by users using the terminal devices 401, 402, 403. The backend management server may analyze and perform other processing on the received data such as the product information query request, and feed back a processing result (for example, target push information, product information — just an example) to the terminal device.
It should be noted that the method for implementing the annotated configuration provided by the embodiment of the present invention is generally executed by the server 405, and accordingly, the apparatus for implementing the annotated configuration is generally disposed in the server 405.
It should be understood that the number of terminal devices, networks, and servers in fig. 4 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 5, shown is a block diagram of a computer system 500 suitable for use with a terminal device implementing an embodiment of the present invention. The terminal device shown in fig. 5 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 5, the computer system 500 includes a Central Processing Unit (CPU)501 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)502 or a program loaded from a storage section 508 into a Random Access Memory (RAM) 503. In the RAM503, various programs and data necessary for the operation of the system 500 are also stored. The CPU501, ROM 502, and RAM503 are connected to each other via a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
The following components are connected to the I/O interface 505: an input portion 506 including a keyboard, a mouse, and the like; an output portion 507 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 508 including a hard disk and the like; and a communication section 509 including a network interface card such as a LAN card, a modem, or the like. The communication section 509 performs communication processing via a network such as the internet. The driver 510 is also connected to the I/O interface 505 as necessary. A removable medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 510 as necessary, so that a computer program read out therefrom is mounted into the storage section 508 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 509, and/or installed from the removable medium 511. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 501.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. 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 or flowchart illustration, and combinations of blocks in the block diagrams 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.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor includes a setup module and a configuration module. Wherein the names of the modules do not in some cases constitute a limitation of the module itself.
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: reading a configuration file to realize environment setting; reading a configuration file to realize environment setting; creating a component factory class and adding a component definition; executing the container post-processor, and then synchronizing configuration information; a component object is created.
According to the technical scheme of the embodiment of the invention, the problems that the conversion from the character string to the program type is wrong and the service invasion is high when the remote configuration information logic is acquired can be solved.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims (10)
1. A method of implementing an annotated configuration, comprising:
reading a configuration file to realize environment setting;
creating a component factory class and adding a component definition;
executing the container post-processor, and then synchronizing configuration information;
a component object is created.
2. The method of claim 1, wherein executing the container post-processor and then synchronizing the configuration information comprises:
analyzing the @ ConfigPath and the @ ConfigKey to obtain a Key Value and a Value which respectively correspond to the @ ConfigPath and the @ ConfigKey;
connecting a remote configuration center, and judging whether a Key Value and a Value respectively corresponding to the @ ConfigPath and the @ ConfigKey exist;
if the Value exists, acquiring a Key Value and a Value of @ ConfigPath of the remote configuration center, and a Key Value and a Value of @ ConfigKey to update to the local;
and if the Value does not exist, adding the Key Value and the Value of the @ ConfigPath and the Key Value and the Value of the @ ConfigKey after parsing in the remote configuration center.
3. The method according to claim 2, characterized in that annotations are added to the Key Value, Value of the parsed @ ConfigPath, and Key Value and Value of the parsed @ ConfigKey.
4. The method of claim 2, wherein obtaining the Key Value, the Value of @ ConfigPath, and the Key Value and the Value of @ ConfigKey of the remote configuration center is preceded by:
converting the character string form of the configuration information into a value of a data type corresponding to Key through PropertyEditor of a Spring frame; the configuration information is Key Value and Value of @ ConfigPath of the remote configuration center, and Key Value and Value of @ ConfigKey.
5. An apparatus for implementing an annotated configuration, comprising:
the setting module is used for reading the configuration file to realize environment setting; creating a component factory class and loading a component definition;
a configuration module to execute the container post-processor and then synchronize configuration information to create the component object.
6. The apparatus of claim 5, wherein the configuration module executes the container post-processor and then synchronizes configuration information, comprising:
analyzing the @ ConfigPath and the @ ConfigKey to obtain a Key Value and a Value which respectively correspond to the @ ConfigPath and the @ ConfigKey;
connecting a remote configuration center, and judging whether a Key Value and a Value respectively corresponding to the @ ConfigPath and the @ ConfigKey exist;
if the Value exists, acquiring a Key Value and a Value of @ ConfigPath of the remote configuration center, and a Key Value and a Value of @ ConfigKey to update to the local;
and if the Value does not exist, adding the Key Value and the Value of the @ ConfigPath and the Key Value and the Value of the @ ConfigKey after parsing in the remote configuration center.
7. The apparatus of claim 6, wherein the configuration module is further configured to:
and adding annotations to the Key Value and the Value of the parsed @ ConfigPath and the Key Value and the Value of the parsed @ ConfigKey.
8. The apparatus of claim 6, wherein the configuration module, prior to obtaining the Key Value, Value of @ ConfigPath, and Key Value and Value of @ ConfigKey of the remote configuration center, comprises:
converting the character string form of the configuration information into a value of a data type corresponding to Key through PropertyEditor of a Spring frame; the configuration information is Key Value and Value of @ ConfigPath of the remote configuration center, and Key Value and Value of @ ConfigKey.
9. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-4.
10. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810863084.XA CN110795135A (en) | 2018-08-01 | 2018-08-01 | Method and device for realizing injection-resolution configuration |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810863084.XA CN110795135A (en) | 2018-08-01 | 2018-08-01 | Method and device for realizing injection-resolution configuration |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110795135A true CN110795135A (en) | 2020-02-14 |
Family
ID=69425896
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810863084.XA Pending CN110795135A (en) | 2018-08-01 | 2018-08-01 | Method and device for realizing injection-resolution configuration |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110795135A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112835650A (en) * | 2021-03-18 | 2021-05-25 | 南威软件股份有限公司 | Method and system for realizing system parameter unified configuration real-time effect |
CN112905167A (en) * | 2021-03-11 | 2021-06-04 | 北京字节跳动网络技术有限公司 | Application operation method and device and electronic equipment |
CN113608819A (en) * | 2021-06-18 | 2021-11-05 | 北京汇钧科技有限公司 | Method and device for creating container, electronic equipment and medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102541996A (en) * | 2011-11-22 | 2012-07-04 | 大唐软件技术股份有限公司 | JDBC (java database connectivity) based data access layer building method and device utilizing same |
US20140075561A1 (en) * | 2012-09-12 | 2014-03-13 | International Business Machines Corporation | Static security analysis using a hybrid representation of string values |
CN106681861A (en) * | 2016-12-08 | 2017-05-17 | 杭州销冠网络科技有限公司 | New environment isolation configuration data management method and system |
CN106990979A (en) * | 2017-01-22 | 2017-07-28 | 阿里巴巴集团控股有限公司 | A kind of configuration information update method, system, client and server |
CN108304251A (en) * | 2018-02-06 | 2018-07-20 | 网宿科技股份有限公司 | Thread synchronization method and server |
-
2018
- 2018-08-01 CN CN201810863084.XA patent/CN110795135A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102541996A (en) * | 2011-11-22 | 2012-07-04 | 大唐软件技术股份有限公司 | JDBC (java database connectivity) based data access layer building method and device utilizing same |
US20140075561A1 (en) * | 2012-09-12 | 2014-03-13 | International Business Machines Corporation | Static security analysis using a hybrid representation of string values |
CN106681861A (en) * | 2016-12-08 | 2017-05-17 | 杭州销冠网络科技有限公司 | New environment isolation configuration data management method and system |
CN106990979A (en) * | 2017-01-22 | 2017-07-28 | 阿里巴巴集团控股有限公司 | A kind of configuration information update method, system, client and server |
CN108304251A (en) * | 2018-02-06 | 2018-07-20 | 网宿科技股份有限公司 | Thread synchronization method and server |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112905167A (en) * | 2021-03-11 | 2021-06-04 | 北京字节跳动网络技术有限公司 | Application operation method and device and electronic equipment |
CN112905167B (en) * | 2021-03-11 | 2023-10-27 | 北京字节跳动网络技术有限公司 | Application operation method and device and electronic equipment |
CN112835650A (en) * | 2021-03-18 | 2021-05-25 | 南威软件股份有限公司 | Method and system for realizing system parameter unified configuration real-time effect |
CN113608819A (en) * | 2021-06-18 | 2021-11-05 | 北京汇钧科技有限公司 | Method and device for creating container, electronic equipment and medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110019080B (en) | Data access method and device | |
CN107491382B (en) | Log output method and device | |
CN110888696A (en) | Page display method and system, computer system and computer readable medium | |
CN111400061A (en) | Data processing method and system | |
CN110858202A (en) | Method and device for generating where clause in database query statement | |
CN110704833A (en) | Data permission configuration method, device, electronic device and storage medium | |
CN111666293A (en) | Database access method and device | |
CN113626223A (en) | Interface calling method and device | |
CN110795135A (en) | Method and device for realizing injection-resolution configuration | |
CN111125064A (en) | Method and device for generating database mode definition statement | |
CN110109983B (en) | Method and device for operating Redis database | |
CN110795741A (en) | Method and device for carrying out security processing on data | |
CN111414154A (en) | Method and device for front-end development, electronic equipment and storage medium | |
CN115470432A (en) | Page rendering method and device, electronic equipment and computer readable medium | |
CN110807535A (en) | Construction method and construction device of unified reservation platform and unified reservation platform system | |
CN111062682B (en) | Work order processing method and device | |
CN113760264A (en) | Method and device for multiplexing components among multiple applications | |
CN112650804A (en) | Big data access method, device, system and storage medium | |
CN111143408A (en) | Event processing method and device based on business rules | |
CN113722007B (en) | Configuration method, device and system of VPN branch equipment | |
US20240078275A1 (en) | Method and device for displaying information in application | |
CN117149248A (en) | Micro front end construction method, device, equipment and storage medium | |
CN113779122B (en) | Method and device for exporting data | |
CN113760487B (en) | Service processing method and device | |
CN112988857B (en) | Service data processing method and device |
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 |