A method of defining a repetition request
By using the spring.factories file and method interceptors in a Java project to intercept duplicate requests, the system slowdown and page jitter caused by duplicate requests were resolved, thus improving system speed and user experience.
Patent Information
- Application Number
- CN202111580949.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-22
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2041-12-22
AI Technical Summary
In the process of writing Java projects, repeated requests can slow down the system and cause page jitter. Existing technologies are unable to effectively solve the impact of repeated requests on the system and affect the user experience.
The system uses annotation configuration embedded in the spring.factories file and method interceptors to intercept duplicate requests. Duplicate requests are detected by annotation configuration units and method interceptors, and exceptions are thrown to terminate duplicate requests.
It improved system speed, enhanced user experience, ensured system stability, and prevented system crashes caused by repeated requests.
Smart Images

Figure CN115563606B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of computer, and the IPC classification number is G06F21 / 14, and specifically relates to a method for limiting repeated requests. BACKGROUND
[0002] In the process of project writing in Java, the problem of affecting the page effect caused by repeated requests often occurs, and multiple requests not only slow down the system speed, but also make the page frequently shake in the opening process, reduce the user experience, and improve the user experience and the use effect of page building. How to better limit Java repeated requests is a problem that needs to be optimized and solved.
[0003] The patent CN201510359311 provides a channel fault early warning method and device, which determines whether the system has failed by counting the number of repeated data information, so as to realize the purpose of real-time monitoring of system working state. However, this patent does not better solve how to affect the system by repeated data information, but only can monitor the system state, and does not have a better solution when the system problem is monitored.
[0004] The patent CN202011108197 is a Jar package encryption method and device based on Springboot. The machine identification information of the Springboot server of the initial Jar package is used to obtain the corresponding initial secret key from the secret key dynamic library, and the updated secret key is used to encrypt the file, so as to avoid data leakage. Although this patent also uses the Springboot server to optimize the system performance, but this patent does not involve the method for limiting repeated requests, and the optimization plug-in used in the method for limiting repeated requests is different.
[0005] Therefore, in view of the problems existing in the prior art, a method for limiting repeated requests is urgently needed, which uses the Springboot server to establish an interface plug-in based repeated request query discrimination, and terminates and throws when repeated requests are found, so as to better improve the running speed of the system. SUMMARY
[0006] In view of the above problems, the application provides a method for limiting repeated requests, characterized in that the spring.factories file is embedded in the system and configured by annotation, and then the method interceptor is used to intercept all methods configured with annotations, and then repeated request judgment is performed.
[0007] Preferably, the annotation configuration is configured by establishing an annotation configuration unit; the method needs to be limited in the annotation configuration unit controller.
[0008] Preferably, the annotation configuration is configured by establishing an annotation configuration unit; the method needs to be limited in the annotation configuration unit controller.
[0009] Preferably, the attribute name and the attribute effective expected value are compared, and the comparison result is used as a node label; when the attribute name and the attribute effective expected value are detected for the first time, the node label is set to 1, and the node label is set to 0 thereafter; and the node with the label 1 is executed.
[0010] Preferably, the annotation configuration unit controller establishes an independent timing annotation mode.
[0011] Preferably, the method interceptor is an annotation-based interception mode, and the method running limited by the annotation configuration unit is intercepted.
[0012] Preferably, the interception method of the method interceptor is to declare login permission and customize permission verification logic, and intercept the node with the node label 0 by calling the specific annotation configuration unit controller.
[0013] Preferably, the method for limiting repeated requests further comprises a repeated running checking unit; the repeated running checking unit judges whether the request is a repeated running request after using the method interceptor.
[0014] Preferably, the spring.factories is configured by establishing a plug-in configuration unit, and the plug-in is embedded in other systems.
[0015] Preferably, the method for limiting repeated requests is based on the springboot automatic configuration mechanism.
[0016] Compared with the prior art, the beneficial effects of the present application are that:
[0017] (1) The spring.factories file is embedded in the springboot automatic configuration mechanism for annotation configuration, then the method interceptor is used to intercept all methods configured with annotations, and then repeated request judgment is performed; if the request is repeated in the repeated request judgment, an exception is thrown, and if the request is not repeated, the original method is run, so as to better solve the repeated request in the running process of the page, thereby better improving the running speed of the system and improving the user experience.
[0018] (2) The application establishes an independent timing annotation method in the annotation configuration unit controller; the independent timing annotation method calls and judges the node label within a set period, when the node label of the node with node label 1 crashes, the attribute name and the attribute effective expected consistent judgment node are reselected as the new node label 1 judgment node. BRIEF DESCRIPTION OF DRAWINGS
[0019] Figure 1 It is a method flow chart for limiting repeated requests. DETAILED DESCRIPTION
[0020] A method for limiting repeated requests, the application first embeds a spring.factories file in the system and performs annotation configuration, then uses a method interceptor to intercept all methods configured with annotations, and then performs repeated request judgment.
[0021] Specifically, if the repeated request judgment is a repeated request, an exception is thrown, and if it is not a repeated request, the original method is run; the spring.factories file is a development mechanism based on interface programming, which is used to expand more services and realize modular programming based on multi-function.
[0022] In an embodiment, the annotation configuration is performed by establishing an annotation configuration unit; the annotation configuration unit controller needs to limit the repeated running of the method.
[0023] In an embodiment, the annotation configuration first configures the attribute characteristics of the annotation; the attribute characteristics include attribute prefix, attribute name and attribute effective expected value.
[0024] In an embodiment, the attribute name and the attribute effective expected value are compared, and the comparison result is used as a node label; when the attribute name and the attribute effective expected value are consistent for the first time, the node label is set to 1, and the node label is set to 0 thereafter; and the node with label 1 is executed.
[0025] In an embodiment, the annotation configuration unit controller establishes an independent timing annotation method.
[0026] In a preferred embodiment, the independent timing annotation method calls and judges the node label within a set period, when the node label of the node with node label 1 crashes, the attribute name and the attribute effective expected consistent judgment node are reselected as the new node label 1 judgment node.
[0027] In an embodiment, the method interceptor is an annotation-based interception mode, and intercepts the method execution limited by the annotation configuration unit.
[0028] In an embodiment, the method interceptor is configured to first declare login permissions and customize the authentication logic that the permissions can pass through, and intercept the node with the node number 0 by calling the specific annotation configuration unit controller.
[0029] In an embodiment, the method for limiting repeated requests further comprises a repeated execution checking unit; the repeated execution checking unit judges whether the request is a repeated execution request after using the method interceptor.
[0030] In an embodiment, the spring.factories is configured to configure the plug-in and embed other systems by establishing a plug-in configuration unit.
[0031] In an embodiment, the method for limiting repeated requests is based on the Spring Boot automatic configuration mechanism.
[0032] Specifically, the Spring Boot is an integrated framework based on Spring, which is used to avoid the problem of configuration errors caused by excessive configuration and complexity of the project as a whole.
[0033] In a preferred embodiment, the Spring Boot is used to quickly develop a project based on the Spring framework, the project in Spring is packaged in the form of a configuration file, and the interface is established to use and modify at any time, which helps developers to quickly insert the required functions without modifying the framework.
Claims
1. A method of defining a repetition request, characterized by, First, the spring.factories file is embedded in the system and annotated configuration, then the method interceptor intercepts all the methods configured with annotations, and then the repeated request judgment is performed; The annotation configuration is configured by establishing an annotation configuration unit; The annotation configuration unit controller needs to limit the repeated running of the method; The annotation configuration first configures the attribute characteristics of the annotation; The attribute characteristics include attribute prefix, attribute name and attribute effective expected value; The attribute name and attribute effective expected value are compared, and the comparison result is used as the node label; When the attribute name and attribute effective expected value are consistent for the first time, the node label is set to 1, and the node label is set to 0 thereafter; And execute the node with label 1; The annotation configuration unit controller establishes an independent timing annotation mode; The method interceptor is an annotation-based interception mode, and intercepts the method running limited by the annotation configuration unit; The interception method of the method interceptor is to declare the login permission and customize the authentication logic that the permission can pass, and intercept the node with node label 0 by calling the specific annotation configuration unit controller.
2. The method of claim 1, wherein, The method of limiting repeated requests also includes a repeated running checking unit; The repeated running checking unit judges whether the request is a repeated running request after using the method interceptor.
3. The method of claim 1, wherein, The spring.factories is configured by establishing a plug-in configuration unit, and the plug-in is embedded in other systems.
4. The method of claim 1, wherein, The method of limiting repeated requests is based on the springboot automatic configuration mechanism.
Citation Information
Patent Citations
Early warning method and device for channel failure
CN105099760B
Jar packet encryption method and device based on Springboot
CN112199645A
Form submitting method and device and storage medium
CN110472173A
Processing method and device for executing distributed lock operation
CN111552474A