CN113986996A - Annotation-based customized return response method, device, equipment and storage medium - Google Patents

Annotation-based customized return response method, device, equipment and storage medium Download PDF

Info

Publication number
CN113986996A
CN113986996A CN202111354083.0A CN202111354083A CN113986996A CN 113986996 A CN113986996 A CN 113986996A CN 202111354083 A CN202111354083 A CN 202111354083A CN 113986996 A CN113986996 A CN 113986996A
Authority
CN
China
Prior art keywords
annotation
target
interface
response
response value
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
Application number
CN202111354083.0A
Other languages
Chinese (zh)
Inventor
陈立宇
范渊
苗春雨
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
DBAPPSecurity Co Ltd
Original Assignee
DBAPPSecurity Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by DBAPPSecurity Co Ltd filed Critical DBAPPSecurity Co Ltd
Priority to CN202111354083.0A priority Critical patent/CN113986996A/en
Publication of CN113986996A publication Critical patent/CN113986996A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2457Query processing with adaptation to user needs
    • G06F16/24573Query processing with adaptation to user needs using data annotations, e.g. user-defined metadata

Abstract

The application relates to a response method, a response device, response equipment and a storage medium based on annotation self-definition, wherein the method comprises the following steps: intercepting an interface response value on an interface through a preset interceptor, and acquiring an interface annotation corresponding to the interface response value through a reflection mechanism; judging whether a target annotation exists in the interface annotation by a checking method; if the target annotation exists, acquiring a target response value from the interface response value according to a specific field in the target annotation, and returning the target response value; if no target annotation exists, an interface response value is returned. Through the method and the device, the problems that response classes cannot be shared and management is difficult in the prior art are solved, and the effect that the response classes can be shared in an interface layer and management is convenient is achieved.

Description

Annotation-based customized return response method, device, equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a response method, device, apparatus, and storage medium based on annotation customization.
Background
With the development of computer services, a large number of interfaces exist in a computer system, each interface corresponds to different requirements, and a corresponding response class (class) structure needs to be defined according to the requirements to realize an interface function.
Generally, in view of the security of the interfaces, corresponding response classes are defined for each interface according to different requirements, but in the same module structure of the computer, because the requirements are similar, the request response classes of multiple interfaces also become highly similar, so that a large number of similar response classes exist in the system, and the response classes cannot be shared and are difficult to manage.
Aiming at the problems that response classes cannot be shared and management is difficult in the related technology, no effective solution is provided at present.
Disclosure of Invention
The embodiment provides a response method, a response device, response equipment and a storage medium based on annotation customization, so as to solve the problems that response classes cannot be shared and management is difficult in the related art.
In a first aspect, in this embodiment, a response method based on annotation customization is provided, including:
intercepting an interface response value on an interface through a preset interceptor, and acquiring the interface annotation corresponding to the interface response value through a reflection mechanism;
judging whether a target annotation exists in the interface annotation by a checking method;
if the target annotation exists, acquiring a target response value from the interface response value according to a specific field in the target annotation, and returning the target response value;
if the target annotation does not exist, returning the interface response value.
In some embodiments, the annotation-based customized return response method further includes:
and presetting the interceptor in an interface layer.
In some embodiments, the obtaining a target response value from the interface response values according to a specific field in the target annotation and returning the target response value includes:
analyzing the specific field in the target annotation to obtain a target field;
acquiring a corresponding response value from the interface response value according to the target field and the specific field, and generating a corresponding response structure;
and assigning the corresponding response value to the response structure to obtain the target response value, and returning the target response value.
In some of these embodiments, the target annotations include a json annotation and a jsons annotation, wherein the jsons annotation includes a plurality of the json annotations.
In some embodiments, the parsing the specific field in the target annotation to obtain a target field includes:
when the target annotation is a json annotation, analyzing the specific field in the json annotation to acquire the target field;
and when the target annotation is a jsons annotation, traversing the jsons annotation to obtain the json annotation, and analyzing the specific field in the json annotation to obtain the target field.
In some embodiments, the annotation-based customized return response method further includes:
and after the interface receives the request, carrying out interface logic processing on the request to obtain the interface response value.
In a second aspect, in this embodiment, there is provided an annotation-based customized return response apparatus, including: the device comprises an interception module, a verification module and a response module;
the interception module is used for intercepting an interface response value on an interface through a preset interceptor and acquiring the interface annotation corresponding to the interface response value through a reflection mechanism;
the checking module is used for judging whether the interface annotation has a target annotation through a checking method;
the response module is used for acquiring a target response value from the interface response value according to a specific field in the target annotation and returning the target response value or;
for returning the interface response value when the target annotation is not present.
In some embodiments, the interception module is further configured to preset the interceptor in an interface layer.
In a third aspect, in this embodiment, there is provided a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the annotation based customized return response method according to the first aspect when executing the computer program.
In a fourth aspect, in the present embodiment, there is provided a storage medium having stored thereon a computer program which, when executed by a processor, implements the annotation based customized return response method according to the first aspect.
Compared with the related art, the annotation-based customized response returning method, device, equipment and storage medium provided in the embodiment intercept an interface response value on an interface through a preset interceptor, and obtain the interface annotation corresponding to the interface response value through a reflection mechanism; judging whether a target annotation exists in the interface annotation by a checking method; if the target annotation exists, acquiring a target response value from the interface response value according to a specific field in the target annotation, and returning the target response value; if the target annotation does not exist, the interface response value is returned, the problems that response classes cannot be shared and management is difficult are solved, and the effects that the response classes can be shared and management is convenient are achieved.
The details of one or more embodiments of the application are set forth in the accompanying drawings and the description below to provide a more thorough understanding of the application.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
fig. 1 is a block diagram of a hardware structure of a terminal based on an annotation-customized return response method in an embodiment;
FIG. 2 is a flow diagram of a response return method based on annotation customization in one embodiment;
FIG. 3 is a flowchart of step S221 in one embodiment;
FIG. 4 is a flow diagram of a response return method based on annotation customization in a preferred embodiment;
FIG. 5 is a block diagram of an exemplary customized response based on annotation device.
In the figure: 510. an interception module; 520. a checking module; 530. and a response module.
Detailed Description
For a clearer understanding of the objects, aspects and advantages of the present application, reference is made to the following description and accompanying drawings.
Unless defined otherwise, technical or scientific terms used herein shall have the same general meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The use of the terms "a" and "an" and "the" and similar referents in the context of this application do not denote a limitation of quantity, either in the singular or the plural. The terms "comprises," "comprising," "has," "having," and any variations thereof, as referred to in this application, are intended to cover non-exclusive inclusions; for example, a process, method, and system, article, or apparatus that comprises a list of steps or modules (elements) is not limited to the listed steps or modules, but may include other steps or modules (elements) not listed or inherent to such process, method, article, or apparatus. Reference throughout this application to "connected," "coupled," and the like is not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. Reference to "a plurality" in this application means two or more. "and/or" describes an association relationship of associated objects, meaning that three relationships may exist, for example, "A and/or B" may mean: a exists alone, A and B exist simultaneously, and B exists alone. In general, the character "/" indicates a relationship in which the objects associated before and after are an "or". The terms "first," "second," "third," and the like in this application are used for distinguishing between similar items and not necessarily for describing a particular sequential or chronological order.
The method embodiments provided in the present embodiment may be executed in a terminal, a computer, or a similar computing device. For example, the method is executed on a terminal, and fig. 1 is a block diagram of a hardware structure of the terminal based on the annotation-based customized response returning method of this embodiment. As shown in fig. 1, the terminal may include one or more processors 102 (only one shown in fig. 1) and a memory 104 for storing data, wherein the processor 102 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA. The terminal may also include a transmission device 106 for communication functions and an input-output device 108. It will be understood by those of ordinary skill in the art that the structure shown in fig. 1 is merely an illustration and is not intended to limit the structure of the terminal described above. For example, the terminal may also include more or fewer components than shown in FIG. 1, or have a different configuration than shown in FIG. 1.
The memory 104 may be used to store a computer program, for example, a software program and a module of application software, such as a computer program corresponding to the annotation based customized return response method in the present embodiment, and the processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, so as to implement the above-mentioned method. The memory 104 may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory located remotely from the processor 102, which may be connected to the terminal over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 106 is used to receive or transmit data via a network. The network described above includes a wireless network provided by a communication provider of the terminal. In one example, the transmission device 106 includes a Network adapter (NIC) that can be connected to other Network devices through a base station to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module, which is used to communicate with the internet in a wireless manner.
In this embodiment, a response method based on annotation customization is provided, and fig. 2 is a corresponding flowchart of this embodiment, and as shown in fig. 2, the method includes the following steps:
step S210, intercepting an interface response value on the interface through a preset interceptor, and obtaining an interface annotation corresponding to the interface response value through a reflection mechanism.
Specifically, the above reflection mechanism refers to reversely and dynamically acquiring attributes in a class or an object through a byte code file of the class in the running state of the program. After the interface response value on the interface is intercepted, the annotation on the interface corresponding to the interface response value can be obtained through a reflection mechanism.
Step S220, judging whether the interface annotation has the target annotation through a checking method.
Specifically, in the interceptor, whether a target annotation exists in the interface annotation is determined by a verification method.
If the target annotation exists, step S221 is executed to obtain a target response value from the interface response value according to the specific field in the target annotation, and return the target response value.
Specifically, the specific field content in the target annotation is analyzed, the target response value of the interface is obtained from the intercepted interface response value, and the target response value is returned.
If no target annotation exists, step S222 is executed to return an interface response value.
Specifically, if the target annotation does not exist, the intercepted interface response value is not processed, and the interface response value is directly returned.
Intercepting an interface response value on an interface through a preset interceptor, and acquiring an interface annotation corresponding to the interface response value through a reflection mechanism; judging whether a target annotation exists in the interface annotation by a checking method; if the target annotation exists, acquiring a target response value from the interface response value according to a specific field in the target annotation, and returning the target response value; if no target annotation exists, an interface response value is returned.
The existing method defines a corresponding response class for each interface according to different requirements, but in the same module structure of a computer, the request response classes of a plurality of interfaces are highly similar, so that a large number of similar response classes exist in the system, the response classes cannot be shared, and the large number of similar classes need to be synchronously modified when the database table structure is modified, so that the management is difficult. The embodiment provides an effective supplement on the basis of the prior art, and through the steps, the preset interceptor uniformly intercepts the interface response values of all the interfaces, the interface response values at this time include a large number of same or similar response classes, then according to the annotation information on the interface corresponding to the interface response value, the response class in the interface response value is distinguished, the target response corresponding to the interface is returned by self-defining, therefore, a large amount of original same or similar response classes can share the response class structure, and the target response value returned from the response class structure can be directly used, and further, through the sharing of the response classes realized in the embodiment, when the database table structure is modified, synchronous modification is not needed, so similar types are similar, only one response type structure is modified, therefore, the problems that response types cannot be shared and management is difficult in the prior art are solved.
In some of these embodiments, the method further comprises:
the interceptors are preset in the interface layer.
Specifically, the interceptor preset in the interface layer is implemented by using a handlemethodreturnvaluehandler interface of the Spring framework to process the return value.
In some embodiments, the above-mentioned obtaining the target response value from the interface response value according to the specific field in the target annotation, and returning the target response value, as shown in fig. 3, step S221 in fig. 2 includes the following steps:
step S310, analyzing the specific field in the target annotation to obtain the target field.
Specifically, the specific field refers to a field defining an attribute of a class in the target annotation, and may perform operations such as filtering on the interface response value. And analyzing the content of the specific field to obtain a target field of the response interface.
Further, the specific field may be an include field and/or a filter field, and the specific field may be selected according to specific requirements, where the fields defined in the include field and the filter field are cut by commas, the defined field is a target field, the include field is an inclusion process for the target field, and the filter field is an exclusion process for the target field, where the priority of the filter field is higher than that of the include field, that is, when the include field and the filter field exist in the target annotation at the same time, if the include field contains the same target field, the priority of the filter is the highest to perform the filter exclusion process.
Step S320, obtaining a corresponding response value from the interface response value according to the target field and the specific field, and generating a corresponding response structure.
Specifically, according to the acquired target field and the corresponding processing method of the specific field, the corresponding response value in the interface response values is obtained through traversal of a reflection mechanism, and a corresponding response structure is automatically generated. For example, if the include field includes three object fields, namely a, b and c, a response structure including a, b and c is automatically generated, and if the filter field also includes the object field, the object field is erased from the response structure to obtain a response structure including the object fields of b and c.
And step S330, assigning the corresponding response value to the response structure to obtain a target response value, and returning the target response value.
Specifically, the corresponding response value is assigned to the response structure, the data structure is reconstructed, and the target response value corresponding to the interface is obtained through the custom annotation.
According to the embodiment, when the target annotation exists in the interface, the specific field in the target annotation is analyzed to obtain the target field, and the corresponding target response value of the interface is obtained from the intercepted interface response value according to the target field and the corresponding specific field, so that the target response value can be returned according to the annotation and interface customization.
In some embodiments, the target annotation comprises a json annotation and a jsons annotation, wherein the jsons annotation comprises a plurality of json annotations.
In particular, the interface may be modified with json annotations in the interface layer, which are data structures and may contain multiple levels of json annotations, to self-define return responses.
In some embodiments, the parsing the specific field in the target annotation to obtain the target field includes:
when the target annotation is json annotation, a specific field in the json annotation is analyzed, and the target field is obtained.
And when the target annotation is jsons annotation, traversing the jsons annotation to obtain json annotation, and analyzing the specific field in the json annotation to obtain the target field.
Specifically, specific fields such as filter and include are included in the json note, and if the target note is the json note, the specific fields are directly analyzed to obtain the target field. If the target annotation is jsons annotation, traversing the jsons annotation array to find the array containing the json annotation, and then analyzing the specific field to obtain the target field.
According to the embodiment, the specific field is obtained by corresponding processing according to whether the target annotation is jsons annotation or json annotation, and the specific field is further analyzed, so that the target field can be obtained from the target annotation.
In some of these embodiments, the method further comprises:
and after the interface receives the request, performing interface logic processing on the request to obtain an interface response value.
Specifically, interface logic processing is performed according to information such as a method and an address defined in the request, and an interface response value is obtained.
The present embodiment is described and illustrated below by means of preferred embodiments.
Fig. 4 is a flowchart of the response method based on annotation customization in the preferred embodiment, and as shown in fig. 4, the method includes the following steps:
step S410, after the interface receives the request, performing interface logic processing on the request to obtain an interface response value.
Specifically, interface logic processing is performed according to information such as a method and an address defined in the request, and an interface response value is obtained.
Step S420, intercepting the interface response value on the interface through a preset interceptor, and obtaining an interface annotation corresponding to the interface response value through a reflection mechanism.
Specifically, the specific field refers to a field defining an attribute of a class in the target annotation, and may perform operations such as filtering on the interface response value. And analyzing the content of the specific field to obtain a target field of the response interface.
Step S430, judging whether the interface annotation has the target annotation through a checking method.
Specifically, the verification is performed through a supportsreturnType method in a HandlerMethodReturn ValueHandler interface, the target annotations comprise json annotations and/or json annotations, and the json annotations are data structures and can contain multi-level json annotations.
If no target annotation exists, go to step S431; if the target annotation exists, step S440 is executed;
in step S431, an interface response value is returned.
Step S440, judging whether the target annotation is a json annotation or a jsons annotation. If the annotation is jsons, step S441 is performed, and step S442 is performed. If yes, go to step S442.
In particular, json notes are used to customize the return response in the interface layer, and jsons notes may also be used to modify the interface.
Step S441, traversal is performed on the jsons annotation to obtain the json annotation.
Specifically, since the json annotation may contain multi-level json annotation, the data structure in the json annotation is traversed to find the array containing the json annotation.
Step S442, parsing the specific field in the json annotation to obtain the target field.
Specifically, the specific field may be an include field and/or a filter field, and the corresponding specific field may be selected according to specific requirements, where the fields defined in the include field and the filter field are cut by commas, the defined field is a target field, the include field is an inclusion process for the target field, and the filter field is an exclusion process for the target field, where the priority of the filter field is higher than that of the include field, that is, when the include field and the filter field exist in the target annotation at the same time, if the include field contains the same target field, the priority of the filter is the highest to perform the filter exclusion process.
And step S450, acquiring a corresponding response value from the interface response value according to the target field and the specific field, and generating a corresponding response structure.
Specifically, according to the acquired target field and the corresponding processing method of the specific field, the corresponding response value in the interface response values is obtained through traversal of a reflection mechanism, and a corresponding response structure is automatically generated.
And step S460, assigning the corresponding response value to the response structure to obtain a target response value, and returning the target response value.
Specifically, the corresponding response value is assigned to the response structure, the data structure is reconstructed, and the target response value corresponding to the interface is obtained through the custom annotation.
According to the preferred embodiment, the interface response value is obtained according to the request, then the interface response value on the interface is intercepted by the interceptor preset by the interface layer, then the interface response value is screened according to the filter and include fields in the interface annotation, the response value which needs to be returned by the corresponding interface is customized, the multiplexing of response classes is achieved, a new response structure does not need to be defined for each interface, but the corresponding response structure can be automatically generated according to the specific field in the annotation, the response value which needs to be returned is assigned to the response structure, and then the corresponding target response value is returned.
It should be noted that the steps illustrated in the above-described flow diagrams or in the flow diagrams of the figures may be performed in a computer system, such as a set of computer-executable instructions, and that, although a logical order is illustrated in the flow diagrams, in some cases, the steps illustrated or described may be performed in an order different than here. For example, between step S431 and step S440, step S440 may be executed first, and then step S431 may be executed.
The present embodiment further provides a response device customized based on annotation, which is used to implement the foregoing embodiments and preferred embodiments, and the description of the response device is omitted here. The terms "module," "unit," "subunit," and the like as used below may implement a combination of software and/or hardware for a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
Fig. 5 is a block diagram of a structure of an annotation-based customized return response apparatus according to this embodiment, and as shown in fig. 5, the apparatus includes: an interception module 510, a verification module 520, and a response module 530, wherein:
the intercepting module 510 is configured to intercept an interface response value on an interface through a preset interceptor, and obtain an interface annotation corresponding to the interface response value through a reflection mechanism.
The checking module 520 is configured to determine whether the interface annotation has a target annotation by using a checking method.
A response module 530, configured to, when a target annotation exists, obtain a target response value from the interface response value according to a specific field in the target annotation, and return the target response value, or; for returning an interface response value when no target annotation is present.
By the device provided by the embodiment, the interface response values of all the interfaces are intercepted by the preset interceptor in a unified manner, the interface response values comprise a large number of same or similar response classes, then the response classes in the interface response values are distinguished according to annotation information on the interfaces corresponding to the interface response values, and target responses corresponding to the interfaces are returned in a customized manner, so that the original large number of same or similar response classes can share the response class structure, and the target response values returned from the response class structure can be directly used.
In some embodiments, the interception module 510 may be further configured to preset an interceptor in the interface layer.
In some embodiments, the target annotations in the verification module 520 include json annotations and jsons annotations, where the json annotations include a plurality of json annotations.
In some embodiments, the response module 530 may be further configured to:
analyzing a specific field in the target annotation to obtain a target field;
acquiring a corresponding response value from the interface response value according to the target field and the specific field, and generating a corresponding response structure;
and assigning the corresponding response value to the response structure to obtain a target response value, and returning the target response value.
In some embodiments, the response module 530 may be further configured to:
when the target annotation is a json annotation, analyzing a specific field in the json annotation to acquire a target field;
and when the target annotation is jsons annotation, traversing the jsons annotation to obtain json annotation, and analyzing the specific field in the json annotation to obtain the target field.
In some of these embodiments, the apparatus further comprises: a processing module;
and the processing module is used for carrying out interface logic processing on the request after the interface receives the request to obtain an interface response value.
The above modules may be functional modules or program modules, and may be implemented by software or hardware. For a module implemented by hardware, the modules may be located in the same processor; or the modules can be respectively positioned in different processors in any combination.
There is also provided in this embodiment an electronic device comprising a memory having a computer program stored therein and a processor arranged to run the computer program to perform the steps of any of the above method embodiments.
Optionally, the electronic apparatus may further include a transmission device and an input/output device, wherein the transmission device is connected to the processor, and the input/output device is connected to the processor.
It should be noted that, for specific examples in this embodiment, reference may be made to the examples described in the foregoing embodiments and optional implementations, and details are not described again in this embodiment.
In addition, in combination with the annotation-based customized return response method provided in the foregoing embodiment, a storage medium may also be provided in this embodiment to implement the method. The storage medium having stored thereon a computer program; the computer program, when executed by a processor, implements any of the annotation based customized return response methods of the above embodiments.
It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to be limiting. All other embodiments, which can be derived by a person skilled in the art from the examples provided herein without any inventive step, shall fall within the scope of protection of the present application.
It is obvious that the drawings are only examples or embodiments of the present application, and it is obvious to those skilled in the art that the present application can be applied to other similar cases according to the drawings without creative efforts. Moreover, it should be appreciated that in the development of any such actual implementation, as in any engineering or design project, numerous implementation-specific decisions must be made to achieve the developers' specific goals, such as compliance with system-related and business-related constraints, which may vary from one implementation to another.
The term "embodiment" is used herein to mean that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the present application. The appearances of such phrases in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is to be expressly or implicitly understood by one of ordinary skill in the art that the embodiments described in this application may be combined with other embodiments without conflict.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the patent protection. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.

Claims (10)

1. An annotation-based customized return response method is characterized by comprising the following steps:
intercepting an interface response value on an interface through a preset interceptor, and acquiring the interface annotation corresponding to the interface response value through a reflection mechanism;
judging whether a target annotation exists in the interface annotation by a checking method;
if the target annotation exists, acquiring a target response value from the interface response value according to a specific field in the target annotation, and returning the target response value;
if the target annotation does not exist, returning the interface response value.
2. The annotation based custom return response method of claim 1, further comprising:
and presetting the interceptor in an interface layer.
3. The method according to claim 1, wherein the obtaining a target response value from the interface response value according to a specific field in the target note and returning the target response value comprises:
analyzing the specific field in the target annotation to obtain a target field;
acquiring a corresponding response value from the interface response value according to the target field and the specific field, and generating a corresponding response structure;
and assigning the corresponding response value to the response structure to obtain the target response value, and returning the target response value.
4. The annotation based custom return response method of claim 3, wherein the target annotation comprises a json annotation and a jsons annotation, wherein the jsons annotation comprises a plurality of the json annotations.
5. The method according to claim 3, wherein the parsing the specific field in the target annotation to obtain the target field comprises:
when the target annotation is a json annotation, analyzing the specific field in the json annotation to acquire the target field;
and when the target annotation is a jsons annotation, traversing the jsons annotation to obtain the json annotation, and analyzing the specific field in the json annotation to obtain the target field.
6. The annotation based custom return response method of claim 1, further comprising:
and after the interface receives the request, carrying out interface logic processing on the request to obtain the interface response value.
7. An annotation based custom return response apparatus, comprising: the device comprises an interception module, a verification module and a response module;
the interception module is used for intercepting an interface response value on an interface through a preset interceptor and acquiring the interface annotation corresponding to the interface response value through a reflection mechanism;
the checking module is used for judging whether the interface annotation has a target annotation through a checking method;
the response module is used for acquiring a target response value from the interface response value according to a specific field in the target annotation and returning the target response value or;
for returning the interface response value when the target annotation is not present.
8. The annotation-based custom return response device of claim 7, wherein the interception module is further configured to preset the interceptor in an interface layer.
9. A computer device comprising a memory and a processor, wherein the memory has stored therein a computer program, the processor being arranged to execute the computer program to perform the annotation based customized return response method of any one of claims 1 to 6.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the annotation based customized return response method according to any one of claims 1 to 6.
CN202111354083.0A 2021-11-13 2021-11-13 Annotation-based customized return response method, device, equipment and storage medium Pending CN113986996A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111354083.0A CN113986996A (en) 2021-11-13 2021-11-13 Annotation-based customized return response method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111354083.0A CN113986996A (en) 2021-11-13 2021-11-13 Annotation-based customized return response method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113986996A true CN113986996A (en) 2022-01-28

Family

ID=79748724

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111354083.0A Pending CN113986996A (en) 2021-11-13 2021-11-13 Annotation-based customized return response method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113986996A (en)

Similar Documents

Publication Publication Date Title
CN106548262B (en) Scheduling method, device and system for resources for processing tasks
US20200090172A1 (en) Containerization of network services
US9811434B1 (en) Predictive management of on-demand code execution
KR20190082926A (en) Messaging Protocol Communication Management
CN111767143A (en) Transaction data processing method, device, equipment and system
CN112925647A (en) Cloud edge coordination system, and control method and device of cluster resources
CN111552838B (en) Data processing method and device, computer equipment and storage medium
CN109344126B (en) Method and device for processing map, storage medium and electronic device
WO2014206289A1 (en) Method and apparatus for outputting log information
CN107465687B (en) Method, device and terminal for realizing permission configuration
CN109284267A (en) Blog management method and terminal device based on abnormal monitoring
CN112328458A (en) Data processing method and device based on flink data engine
CN109918191A (en) A kind of method and apparatus of the anti-frequency of service request
CN110677475A (en) Micro-service processing method, device, equipment and storage medium
CN110457132B (en) Method and device for creating functional object and terminal equipment
CN105009115B (en) The method and apparatus for obtaining Internet resources
CN116805946A (en) Message request processing method and device, electronic equipment and storage medium
CN108900482A (en) Execution method, server management system and the storage medium of script
CN110580212B (en) Data export method and device of application program, electronic equipment and storage medium
CN116881040A (en) Service operation processing method and device, electronic device and storage medium
CN112235124A (en) Method and device for configuring pico-cell, storage medium and electronic device
CN113986996A (en) Annotation-based customized return response method, device, equipment and storage medium
CN109561048B (en) Communication management method and device
CN109783248A (en) Data access method, device, computer equipment and storage medium
CN105354081A (en) Synchronous service binding method and apparatus

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