Application dynamic configuration optimization method and device, electronic equipment and storage medium

By monitoring resource usage and capturing exceptions within the Spring Boot framework, collecting and structuring log data, and combining this with an artificial intelligence analysis model to dynamically update Bean configurations, the problems of lagging configuration adjustments and low efficiency in context analysis are solved, achieving efficient and intelligent configuration optimization.

CN121958016APending Publication Date: 2026-05-01MACAU INTERNET MEDIA DEV CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
MACAU INTERNET MEDIA DEV CO LTD
Filing Date
2025-12-05
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

In the Spring Boot framework, configuration adjustments are lagging and rely on manual intervention, context analysis and troubleshooting are inefficient, and resource allocation and Bean configuration lack intelligent linkage, resulting in low efficiency in configuration optimization.

Method used

By monitoring resource usage data and capturing operational anomalies, target log data is collected and structured. Input data is generated by combining it with context data. A pre-trained artificial intelligence analysis model is used for joint analysis to output configuration optimization suggestions. The configuration parameters of the Bean are dynamically updated through a configuration refresher.

Benefits of technology

It enables precise problem location and configuration optimization without restarting the application, improving the efficiency and accuracy of configuration adjustments, reducing reliance on human experience, and enhancing the correlation between resource allocation and Bean configuration.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121958016A_ABST
    Figure CN121958016A_ABST
Patent Text Reader

Abstract

The invention discloses an application dynamic configuration optimization method and device, electronic equipment and a storage medium, and the method comprises the steps: in the running process of a target application program based on a Spring Boot framework, monitoring resource use data, and capturing running abnormity; when the resource use exceeds the limit or is abnormal, collecting related target log data in a preset time window, and generating structured first input data; when a user initiates a configuration optimization query, acquiring context data during current operation from a context object of a target application program, and generating structured second input data; a query instruction, first input data and second input data are input into an artificial intelligence analysis model, joint analysis is carried out in combination with historical configuration cases and log data, the problem can be accurately positioned in combination with runtime context and log data, the troubleshooting efficiency is improved, and dependence on artificial experience is reduced; the configuration parameters of the target Bean are dynamically updated through the configuration refresher, so that the configuration change takes effect under the condition that the target application program is not restarted.
Need to check novelty before this filing date? Find Prior Art

Description

Application of dynamic configuration optimization methods, devices, electronic devices and storage media Technical Field

[0001] This invention relates to the field of computer technology, and in particular to a method, apparatus, electronic device, and storage medium for applying dynamic configuration optimization. Background Technology

[0002] In the computer software development industry, the Spring Boot framework is currently the mainstream Java development framework, simplifying the application development process with its "convention over configuration" principle. However, in practical applications, it suffers from shortcomings such as lagging configuration adjustments and reliance on manual intervention, low efficiency in context analysis and troubleshooting, and a lack of intelligent linkage between resource allocation and Bean configuration. Summary of the Invention

[0003] This invention aims to address at least one of the technical problems existing in the prior art. To this end, this invention proposes a dynamic configuration optimization method, apparatus, electronic device, and storage medium that can intelligently locate problems by combining runtime context data and target log data, thereby improving troubleshooting efficiency, reducing reliance on manual intervention, and enhancing the correlation between resource allocation and Bean configuration.

[0004] In a first aspect, embodiments of the present invention provide a dynamic configuration optimization method applied to a target application built using the Spring Boot framework, comprising: during the operation of the target application, when resource usage data exceeds a preset threshold or a runtime exception is detected, collecting target log data related to the excessive resources or runtime exception based on a preset time window, and performing structured processing on the target log data to generate first input data; responding to a user's query command, obtaining the current runtime context data from the context object of the target application, and performing structured processing on the context data to generate second input data; inputting the query command, the first input data, and the second input data into a pre-trained artificial intelligence analysis model to perform joint analysis based on historical configuration cases and historical log data, and outputting configuration optimization suggestions; the configuration optimization suggestions include a list of Beans to be adjusted and the configuration parameters and parameter values ​​of each target Bean in the Bean list; according to the configuration optimization suggestions, dynamically updating the configuration parameters of the target Beans in the context object through a configuration refresher so that the configuration changes take effect without restarting the target application.

[0005] According to some embodiments of the present invention, the resource usage data includes at least one of CPU utilization, memory usage, and the number of active threads in the thread pool. The application dynamic configuration optimization method further includes: collecting the resource usage data during the operation of the target application, and determining that the resource usage data exceeds the preset threshold if the CPU utilization exceeds a preset first threshold, the memory usage exceeds a preset second threshold, and / or the number of active threads in the thread pool exceeds a preset third threshold.

[0006] According to some embodiments of the present invention, the target log data includes log level, timestamp, stack information and module name. The step of collecting log data related to resource overruns or operational anomalies based on a preset time window includes: filtering all log data based on a preset time window, the current time and the timestamp of the log data to obtain intermediate log data; and filtering the intermediate log data based on resource overruns or operational anomalies, the stack information of the log data and the module name to obtain target log data.

[0007] According to some embodiments of the present invention, the context data includes Bean definitions, dependencies, configuration parameters, and current running state. Obtaining the current running context data from the context object of the target application includes: obtaining the Bean definitions, dependencies, configuration parameters, and current running state as current context data from the context object of the target application.

[0008] According to some embodiments of the present invention, the configuration optimization suggestion further includes adjusted expected performance evaluation data. The step of dynamically updating the configuration parameters of the target Bean of the context object through a configuration refresher according to the configuration optimization suggestion includes: filtering each target Bean in the Bean list according to the expected performance evaluation data and a preset performance threshold to obtain the filtered target Beans; and dynamically updating the configuration parameters of the filtered target Beans of the context object through a configuration refresher.

[0009] According to some embodiments of the present invention, the step of dynamically updating the configuration parameters of the target Bean of the context object through a configuration refresher according to the configuration optimization suggestion includes: triggering the dynamic update of the configuration parameters of the target Bean by calling the RefreshEndpoint interface through a configuration refresher according to the configuration optimization suggestion.

[0010] According to some embodiments of the present invention, the step of dynamically updating the configuration parameters of the target Bean of the context object through a configuration refresher based on the configuration optimization suggestions further includes: recording the configuration change data of the target Bean in a configuration change log; performing performance monitoring of the target application for a preset duration based on the expected performance evaluation data, and performing a configuration rollback operation based on the configuration change log if the actual performance evaluation data is lower than the expected performance evaluation data.

[0011] Secondly, embodiments of the present invention provide an application dynamic configuration optimization device applied to a target application built using the Spring Boot framework, comprising: an exception log collection module, used to collect target log data related to the excessive resources or operational exceptions based on a preset time window when resource usage data exceeds a preset threshold or an operational exception is captured during the operation of the target application, and to perform structured processing on the target log data to generate first input data; a context data collection module, used to obtain the currently running context data from the context object of the target application in response to a user's query command, and to perform structured processing on the context data to generate second input data; a data analysis module, used to input the query command, the first input data, and the second input data into a pre-trained artificial intelligence analysis model to perform joint analysis based on historical configuration cases and historical log data, and output configuration optimization suggestions; the configuration optimization suggestions include a list of Beans to be adjusted and the configuration parameters and parameter values ​​of each target Bean in the Bean list; and a configuration update module, used to dynamically update the configuration parameters of the target Beans in the context object through a configuration refresher according to the configuration optimization suggestions, so that the configuration changes take effect without restarting the target application.

[0012] Thirdly, embodiments of the present invention provide an electronic device, including a processor and a memory, wherein the memory stores a computer program, and the processor, when running the computer program, implements the above-described application dynamic configuration optimization method.

[0013] Fourthly, embodiments of the present invention provide a storage medium storing a computer program that, when run, implements the above-described application dynamic configuration optimization method.

[0014] The embodiments of the present invention have at least the following beneficial effects: During the operation of the target application based on the Spring Boot framework, resource usage data is monitored and runtime exceptions are captured; when resource usage exceeds limits or an exception occurs, relevant target log data is collected within a preset time window, and structured first input data is generated to achieve selective collection and provide data support for the artificial intelligence analysis model; when a user initiates a configuration optimization query, the current runtime context data is obtained from the context object of the target application to generate structured second input data; the query command, the first input data, and the second input data are input into a pre-trained artificial intelligence analysis model, and combined with historical configuration cases and log data for joint analysis to output configuration optimization suggestions. In this way, the runtime context and log data can be combined to accurately locate problems, improve troubleshooting efficiency, reduce reliance on human experience, and enhance the correlation between resource allocation and Bean configuration; the configuration parameters of the target Bean are dynamically updated through the configuration refresher, so that configuration changes take effect without restarting the target application.

[0015] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description

[0016] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the description of the embodiments in conjunction with the following drawings, in which: FIG1 is a flowchart of the steps of the application dynamic configuration optimization method according to an embodiment of the present invention; FIG2 is a schematic diagram of the human-computer interaction interface according to an embodiment of the present invention; FIG3 is a principle block diagram of the application dynamic configuration optimization device according to an embodiment of the present invention; and FIG4 is a principle block diagram of the electronic device according to an embodiment of the present invention. Detailed Implementation

[0017] Embodiments of the present invention are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.

[0018] In the description of this invention, "several" means one or more, "multiple" means two or more, "greater than," "less than," "exceeding," etc. are understood to exclude the stated number, and "above," "below," "within," etc. are understood to include the stated number. If "first," "second," etc. are used in the description, they are only for the purpose of distinguishing technical features and should not be construed as indicating or implying relative importance or implicitly indicating the number of indicated technical features or the order of the indicated technical features.

[0019] Spring Boot is an open-source Java framework launched in 2014, designed to simplify the development and deployment of applications based on the Spring ecosystem. Building upon the traditional Spring framework, Spring Boot significantly reduces the amount of boilerplate code and XML configuration required by developers through the "convention over configuration" principle.

[0020] Spring Boot's core features include: Auto-configuration: automatically configuring the Spring application context based on dependencies in the classpath; Actuator: providing operational endpoints such as health checks, metric monitoring, and log management for easy application monitoring and management; and Externalized configuration: supporting flexible configuration of application properties through application.properties or application.yml files, environment variables, command-line arguments, and other methods.

[0021] Due to its rapid startup, low invasiveness, and excellent microservice support, Spring Boot has become the de facto standard framework for building modern Java enterprise applications and cloud-native microservices.

[0022] However, in practical applications, the Spring Boot framework still suffers from the following key issues: Delayed configuration adjustments and reliance on manual intervention: In the Spring framework, objects that constitute the application backbone and are managed by the Spring IoC container are called Beans. That is, Beans are objects instantiated, assembled, and otherwise managed by the Spring IoC container. Traditional Spring Boot application configurations (such as Bean parameters and resource thresholds) need to be statically defined through application.properties or application.yml files. Modifications require a restart of the application to take effect, making it unable to cope with real-time business load changes. Furthermore, configuration optimization relies on developer experience and is difficult to accurately match the application's runtime state.

[0023] Low efficiency in context analysis and troubleshooting: Developers need to manually query Spring Context information (such as Bean dependencies and container status) through logging tools (such as Logback and Log4j). When an exception occurs or resource utilization is too high, log data needs to be manually filtered, which is time-consuming and has low accuracy in locating problems.

[0024] Lack of intelligent linkage between resource allocation and bean configuration: In existing technologies, although Spring Boot's @RefreshScope annotation supports dynamic configuration refresh, the refresh triggering conditions (such as changes in the configuration center) are disconnected from the actual resource load of the application (such as CPU utilization and memory usage), making it impossible to achieve closed-loop optimization of "resource load-configuration adjustment" by combining the evaluation results of artificial intelligence analysis models.

[0025] Therefore, this embodiment discloses a dynamic configuration optimization method applied to a target application built using the Spring Boot framework. Referring to Figure 1, the dynamic configuration optimization method includes steps S100 to S400. It should be noted that the numbering of the steps in this embodiment is only for ease of review and understanding, and does not limit the execution order of the steps. The content of each step is described in detail below: S100: During the operation of the target application, when resource usage data exceeds a preset threshold or an operational exception is detected, target log data related to the excessive resources or operational exception is collected based on a preset time window, and the target log data is structured to generate first input data; for example, during the operation of the target application, the resource usage status of the target application is continuously monitored, and possible operational exception events are listened for. When any resource usage data exceeds a preset threshold, or when an operational anomaly not processed by the target application is successfully captured, a log collection mechanism is automatically triggered based on a preset time window. This mechanism collects target log data associated with the over-limited resources or the abnormal event and performs structured processing on the collected target log data. This structured processing includes, but is not limited to, field extraction, timestamp alignment, anomaly context association, and format standardization, thereby generating the first input data that meets the input requirements of the artificial intelligence analysis model.

[0026] In a preferred application example, a dedicated exception logging component can be integrated into the target application. This component, based on the Actuator module provided by the Spring Boot framework, obtains various runtime metrics of the target application in real time through the Actuator module's metrics interface, enabling dynamic monitoring of resource usage data. Simultaneously, the exception logging component is registered as a listener for ApplicationEvent events to capture critical application lifecycle events (such as ContextRefreshedEvent) and custom or framework-thrown exception events (such as ExceptionEvent), effectively identifying and intercepting globally uncaught runtime exceptions. When resource usage exceeds limits or exceptions occur, target log data related to the exceeded resources or runtime exceptions is collected.

[0027] It is important to emphasize that the target log data collected in this embodiment is not an indiscriminate recording of all logs, but rather limited to a preset time window to ensure the high relevance and contextual integrity of the acquired data. By collecting log data on demand and precisely, not only can storage overhead and processing burden be significantly reduced, but also irrelevant noise data can be avoided from interfering with subsequent analysis. The structured first input data can be directly used as the joint input of the artificial intelligence analysis model, supporting intelligent linkage and dynamic optimization between resource allocation strategies and Bean configuration parameters in the Spring container. Furthermore, the structured target log data can be easily extended to visual monitoring platforms (as shown by P2 in Figure 2), alarm systems, or automated operation and maintenance toolchains. For example, in the human-computer interaction interface of the front-end component, the target log data can be displayed in the form of a timeline with keyword highlighting (e.g., red for exception types, yellow for high-resource modules), supporting developers to export log files (e.g., CSV, TXT formats) with one click, further improving the system's observability and self-healing capabilities.

[0028] S200: In response to the user's query command, obtain the current runtime context data from the target application's context object, and perform structured processing on the context data to generate the second input data. For example, to improve human-computer interaction efficiency and real-time response capabilities, a front-end interactive component with a human-computer interaction interface and a back-end service component based on the SSE (Server-Sent Events) protocol can be integrated into the target application. After the target application starts, the user can initiate specific configuration diagnostic or optimization query requests by accessing the human-computer interaction interface of the front-end component (see Figure 2). A persistent long-term connection channel is established between the front-end component and the back-end service component, allowing the user to submit query commands at any time during the operation of the target application. For example, when the user observes that the application experiences response delays, lag, or abnormal resource usage, they can input query commands in natural language form through the human-computer interaction interface (as shown by P1 in Figure 2), such as: "Please query the current JVM memory usage," "Analyze whether there are bean dependency conflicts in the current Spring Context and provide optimization suggestions," or "Evaluate the rationality of the connection pool configuration of the data source bean and recommend parameter adjustment schemes."

[0029] Upon receiving a user's query, the backend service component invokes the embedded Spring context resolver. Using the ApplicationContext interface provided by the Spring Boot framework, it dynamically retrieves context data related to the query from the target application's runtime context object. This context data includes, but is not limited to: metadata of registered beans, dependency graphs, scope configurations, lifecycle states, injection methods, and related configuration properties. The retrieved raw context data undergoes structured processing, including field mapping, dependency modeling, configuration item standardization, and semantic alignment, ultimately generating a clearly structured and semantically explicit second input data.

[0030] It's important to note that log data collection involves continuous monitoring during application runtime, but targeted collection of target log data is only triggered when specific conditions are met (such as exceeding resource usage limits or catching unhandled exceptions). Contextual data acquisition, on the other hand, is driven by user-initiated queries, featuring on-demand, real-time, and interactive characteristics. This data collection architecture, combining "passive triggering + active querying," allows for the simultaneous integration of collected target log data (first input data) and current runtime context data (second input data) when a user requests configuration optimization. This provides multi-dimensional, highly relevant joint input to the AI ​​analysis model, supporting more accurate root cause analysis, configuration assessment, and intelligent optimization suggestion generation.

[0031] S300: Input the query command, the first input data, and the second input data into the pre-trained artificial intelligence analysis model to perform joint analysis based on historical configuration cases and historical log data, and output configuration optimization suggestions. The configuration optimization suggestions include a list of Beans to be adjusted and the configuration parameters and parameter values ​​of each target Bean in the Bean list. For example, the artificial intelligence analysis model is an intelligent inference engine trained with a large amount of historical operation and maintenance data. The training data covers structured historical log data generated during the past operation of the target application and the associated historical configuration cases. In some application examples, the artificial intelligence analysis model can adopt a supervised learning-based architecture, such as building it under mainstream deep learning frameworks like TensorFlow 2.x, and using labeled sample datasets for end-to-end training. In other application examples, to improve the model's generalization ability and deployment efficiency, it can be fine-tuned or transferred to existing large language models (such as DeepSeek) for domain adaptation, enabling the large language model to understand the semantics of Spring Boot application configuration and provide services externally through standardized API interfaces, facilitating integration with the exception log collection component and backend service components mentioned above.

[0032] Upon receiving a query command in natural language from a user, the query command, along with the synchronously acquired first and second input data, are fed into the AI ​​analysis model. The AI ​​analysis model integrates runtime context data and target log data, performs joint analysis based on historical configuration cases and historical log data, and outputs configuration optimization suggestions. This improves the accuracy of problem localization and response speed, and reduces reliance on human experience.

[0033] The configuration optimization suggestions include a list of beans to be adjusted. This list provides one or more target beans for adjustment, along with their configuration parameters and corresponding values. For example, in the Spring Boot framework, bean configuration metadata is carried by the BeanDefinition interface, containing key elements such as class name, bean name, scope, autowiring mode, initialization / destroy callback methods (initMethod / destroyMethod), and property key-value pairs. Intelligent suggestions can adjust frequently created beans with non-shared state in high-concurrency scenarios from the default singleton scope to prototype, avoiding unnecessary object reuse that leads to state pollution or memory accumulation. Similarly, for database access bottlenecks caused by improper connection pool configuration, adjustments to parameters such as maximum connections and idle timeout can be recommended to optimize resource utilization and reduce garbage collection (GC) pressure.

[0034] S400. Based on configuration optimization suggestions, the configuration parameters of the target bean in the context object are dynamically updated through the configuration refresher so that configuration changes take effect without restarting the target application.

[0035] For example, in some application examples, the configuration refresher is implemented based on the scope management mechanism provided by the Spring Boot framework. Specifically, the `@RefreshScope` annotation can be used to mark beans that need to support dynamic updates. Upon receiving a configuration optimization suggestion, the configuration refresher parses the target bean identifier and recommended configuration parameters and values ​​contained in the suggestion, and writes these new configurations to an external configuration center (such as Spring Cloud Config Server) or a local configuration cache associated with the target application. Subsequently, the configuration refresher actively calls the configuration center's interface to trigger the configuration refresh process in the Spring context. In this way, bean instances annotated with `@RefreshScope` can be reloaded to use the updated configuration parameters the next time they are injected or invoked, while other unaffected beans retain their original state, thus achieving fine-grained, non-intrusive dynamic configuration updates.

[0036] In other application examples, if the target Bean does not directly use @RefreshScope, or if a more flexible control strategy is required, the configuration refresher can also intercept the target Bean's property access or initialization process through a custom RefreshScope proxy class, and inject new configuration values ​​at runtime, thus achieving the same effect without restarting.

[0037] It is important to note that the configuration refresh triggering method can be flexibly selected as either automatic triggering mode or manual confirmation mode, depending on the actual operation and maintenance strategy. Automatic triggering mode automatically executes the configuration writing and refresh operations after the AI ​​analysis model outputs optimization suggestions and passes credibility verification, suitable for low-risk, high-frequency optimization scenarios. Manual confirmation mode, on the other hand, displays the content to be adjusted and the expected impact through a human-computer interaction interface after generating configuration optimization suggestions. The configuration refresher then performs the actual update operation after the user reviews and confirms the suggestions, meeting the needs of high-security or strong compliance scenarios.

[0038] Therefore, during the operation of the target application based on the Spring Boot framework, resource usage data is monitored and runtime exceptions are captured. When resource usage exceeds limits or an exception occurs, relevant target log data is collected within a preset time window, and structured first input data is generated to achieve selective collection and provide data support for the artificial intelligence analysis model. When a user initiates a configuration optimization query, the current runtime context data is obtained from the target application's context object to generate structured second input data. The query command, first input data, and second input data are input into a pre-trained artificial intelligence analysis model, and combined with historical configuration cases and log data for joint analysis to output configuration optimization suggestions. This approach can accurately locate problems by combining runtime context and log data, improve troubleshooting efficiency, reduce reliance on human experience, and enhance the correlation between resource allocation and Bean configuration. The configuration parameters of the target Bean are dynamically updated through a configuration refresher, so that configuration changes take effect without restarting the target application.

[0039] In some application examples, resource usage data includes at least one of CPU utilization, memory usage, and the number of active threads in the thread pool. The application dynamic configuration optimization method also includes: collecting resource usage data during the operation of the target application, and determining that the resource usage data exceeds the preset threshold if the CPU utilization exceeds a preset first threshold, the memory usage exceeds a preset second threshold, and / or the number of active threads in the thread pool exceeds a preset third threshold.

[0040] For example, thresholds can be pre-configured for different types of resource metrics: for instance, a first threshold (e.g., 80%) can be configured for CPU utilization, a second threshold (85%) for memory usage, and a third threshold (e.g., 90%) for the number of active threads in the thread pool. When any resource metric is detected to meet the corresponding over-limit condition—that is, CPU utilization exceeds the first threshold, memory usage exceeds the second threshold, and / or the number of active threads in the thread pool exceeds the third threshold—it is determined that the current resource usage data has exceeded the preset threshold, thereby triggering the subsequent target log collection process. This achieves automated and selective data collection, reducing the reliance on manual intervention.

[0041] It should be noted that the above thresholds can be statically configured or dynamically adjusted based on the actual deployment environment, application load characteristics, or operation and maintenance strategies. Furthermore, the resource limit exceeding judgment logic supports flexible combinations of conditions. It can adopt a lenient strategy of "triggering if any limit is exceeded," or, in specific scenarios, a strict strategy of "triggering only if multiple indicators exceed limits simultaneously" can be configured to avoid misjudgments caused by momentary fluctuations. In addition, the resource usage data collection process is continuous and low-overhead, typically relying on lightweight monitoring infrastructure mechanisms such as Spring Boot Actuator and Micrometer, ensuring timely and accurate data input for anomaly detection and configuration optimization without affecting the main business performance of the target application.

[0042] In some application examples, the target log data includes log level, timestamp, stack trace, and module name. Log data related to resource overruns or operational anomalies is collected based on a preset time window, including: filtering all log data based on the preset time window, the current time, and the timestamp of the log data to obtain intermediate log data; and filtering the intermediate log data based on resource overruns or operational anomalies, the stack trace of the log data, and the module name to obtain the target log data.

[0043] For example, in order to ensure that the collected target log data is highly correlated with the current resource overrun event or operational anomaly, the target log data is accurately extracted from the original log data within a preset time window.

[0044] Specifically, based on the moment when resource limits are detected or operational anomalies are captured, a preliminary filter is performed on all log data continuously generated by the target application during its operation, using a preset time window (e.g., 5 seconds before and 2 seconds after). By comparing the timestamp of each log record with the upper and lower boundaries of the time window, log entries within the time window are retained, thus obtaining intermediate log data. In this way, historical or future log data that is irrelevant to the current event in time can be excluded, which helps to narrow down the data scope for subsequent analysis.

[0045] Next, based on the nature of the current triggering event (i.e., resource overrun type or specific exception type), log entries logically related to the current event are further filtered according to the stack trace information and module name in the intermediate log data. For example, if the triggering condition is memory usage overrun, log data from memory-intensive modules (such as caching services or big data processing components) or stack trace information containing keywords such as OutOfMemoryError are prioritized; if the triggering condition is thread pool saturation, the focus is on log data related to the task submission module or asynchronous executor. By matching event characteristics with the structured fields of the log data, log data directly related to the current resource overrun or runtime exception can be filtered from the intermediate log data to obtain the target log data.

[0046] In some application examples, context data includes bean definitions, dependencies, configuration parameters, and current runtime state. Obtaining the current runtime context data from the target application's context object includes: obtaining bean definitions, dependencies, configuration parameters, and current runtime state as current context data from the target application's context object.

[0047] For example, when performing configuration diagnostics or optimization queries, the context object of the target application (such as an ApplicationContext instance in the Spring Boot framework) is invoked to dynamically obtain core information such as Bean definitions, dependencies, configuration parameters, and current runtime status as the current runtime context data. The Bean definition describes the basic metadata of each Bean, such as the Bean name, corresponding class name, scope, initialization and destruction callback methods, etc.; dependencies reflect the injection and reference topology between Beans, including direct dependencies, circular dependencies, and optional dependencies; configuration parameters cover attribute values ​​injected into Beans through configuration files (such as application.yml), annotations (such as @Value), or programmatic methods, such as database connection pool size, cache expiration time, and thread pool core parameters; the current runtime status includes runtime dynamic information such as whether the Bean has been initialized, whether it is actively used, and whether there are any lifecycle exceptions. Through the standard interfaces provided by ApplicationContext (such as getBeanDefinitionNames(), getBeanFactory(), containsBean(), etc.), the configuration and state information consistent with the current Spring context can be completely extracted as the current context data. The current context data is then processed into structured second input data for subsequent joint analysis with log data and user query commands.

[0048] In some application examples, configuration optimization suggestions also include adjusted expected performance evaluation data. Based on the configuration optimization suggestions, the configuration parameters of the target beans of the context object are dynamically updated through the configuration refresher. This includes: filtering each target bean in the bean list based on the expected performance evaluation data and preset performance thresholds to obtain the filtered target beans; and dynamically updating the configuration parameters of the filtered target beans of the context object through the configuration refresher.

[0049] For example, expected performance evaluation data can be reflected in the estimated changes of key performance indicators, such as the reduction in CPU utilization, the reduction in peak memory usage, the shortening of thread pool queuing latency, and the percentage decrease in garbage collection frequency, in order to quantify the performance benefits that configuration changes may bring.

[0050] Before performing dynamic configuration updates, the target beans in the bean list are filtered based on expected performance evaluation data and preset performance thresholds to ensure that only configuration items with significant optimization potential or meeting the minimum performance improvement thresholds are updated. Specifically, the expected performance evaluation data corresponding to each target bean in the configuration optimization suggestions is compared with the preset performance thresholds. These performance thresholds can be dynamically configured based on operation and maintenance strategies, service level agreements, or historical baselines. For example, they may require "memory usage to be reduced by at least 5%" or "thread blocking time to be reduced by more than 100 milliseconds." Target beans whose expected performance improvement reaches or exceeds the corresponding performance thresholds are then selected. This results in a filtered list of target beans, ensuring that subsequent update operations are more targeted.

[0051] The configuration refresher dynamically updates the configuration parameters of the filtered target beans at runtime. This process does not require restarting the target application, and the new configuration will take effect on the next bean instantiation or property access.

[0052] In some application examples, step S400, based on configuration optimization suggestions, dynamically updates the configuration parameters of the target Bean of the context object through a configuration refresher, including: based on configuration optimization suggestions, triggering dynamic updates of the target Bean's configuration parameters by calling the RefreshEndpoint interface through the configuration refresher.

[0053] For example, the RefreshEndpoint interface is provided by the Actuator module of the Spring Boot framework, typically corresponding to the HTTP endpoint / actuator / refresh. Calling the RefreshEndpoint interface through a configuration refresher can trigger configuration parameter updates for beans marked as supporting dynamic refresh in the target application context. Specifically, the configuration refresher writes the target beans and their recommended configuration parameters, included in the configuration optimization suggestions, to the external configuration source (such as Spring Cloud Config Server) or local configuration cache associated with the target application, and actively initiates a refresh request to the RefreshEndpoint interface. The refresh request triggers the configuration reloading mechanism within the Spring context, causing all beans declared with the @RefreshScope annotation to reinitialize their instances based on the updated configuration the next time they are accessed, thus achieving runtime dynamic application of configuration parameters.

[0054] It's important to note that hot updates of the target bean's configuration can only be achieved in this way if the target bean is explicitly annotated with `@RefreshScope`. Unannotated singleton beans remain unchanged throughout the application's lifecycle and are unaffected by this refresh. Therefore, the target bean to be updated must be pre-included in dynamic scope management to ensure the effectiveness and controllability of the configuration refresh operation. Furthermore, calls to the `RefreshEndpoint` interface can be executed automatically by the configuration refresher or triggered after manual confirmation, balancing automation efficiency with operational security.

[0055] In some application examples, step S400, based on configuration optimization suggestions, dynamically updates the configuration parameters of the target Bean of the context object through a configuration refresher, and then includes: recording the configuration change data of the target Bean to the configuration change log; performing performance monitoring on the target application for a preset duration based on the expected performance evaluation data, and performing a configuration rollback operation based on the configuration change log if the actual performance evaluation data is lower than the expected performance evaluation data.

[0056] For example, after the configuration parameters are dynamically updated, it is necessary to track and manage the updated performance to ensure that the optimization effect meets expectations and has the ability to self-heal from failures. This involves structurally recording the configuration change data of the target Bean, including the target Bean identifier, configuration parameter values ​​before and after the change, change timestamp, execution source, etc., in the configuration change log. Then, a performance monitoring window of a preset duration (e.g., 5 minutes, 10 minutes, or dynamically set according to business cycles) is initiated. During this period, the actual running performance indicators of the target application are continuously collected, such as CPU utilization, memory usage, request latency, error rate, thread pool utilization, etc. Based on the collected performance indicators, actual performance evaluation data is generated, and this actual performance evaluation data is compared and analyzed with the expected performance evaluation data included in the configuration optimization suggestions.

[0057] If the actual performance evaluation data within the monitoring window does not reach the expected level—for example, if the improvement in key indicators is less than the preset tolerance threshold, or if performance degradation occurs (such as increased response time or higher error rate)—it is determined that the current configuration change has failed to achieve the optimization goal and may even introduce new stability risks. In this case, a configuration rollback operation will be automatically triggered: based on the configuration state before the change saved in the aforementioned configuration change log, the original parameter values ​​are reloaded through the configuration refresher, and the RefreshEndpoint interface is called again to restore the target Bean to its configuration state before the change, thereby quickly eliminating adverse effects and ensuring the stability of the target application.

[0058] Referring to Figure 3, based on the same technical concept as the application dynamic configuration method described above, this embodiment also provides an application dynamic configuration optimization device, applied to applications using Spring... The target application built using the Boot framework includes: an exception log collection module 110, which collects target log data related to excessive resources or operational anomalies based on a preset time window when resource usage data exceeds a preset threshold or an operational anomaly is detected during the operation of the target application, and performs structured processing on the target log data to generate first input data; a context data collection module 120, which, in response to a user's query command, obtains the current runtime context data from the context object of the target application, and performs structured processing on the context data to generate second input data; a data analysis module 130, which inputs the query command, the first input data, and the second input data into a pre-trained artificial intelligence analysis model to perform joint analysis based on historical configuration cases and historical log data, and outputs configuration optimization suggestions; the configuration optimization suggestions include a list of Beans to be adjusted and the configuration parameters and parameter values ​​of each target Bean in the Bean list; and a configuration update module 140, which, according to the configuration optimization suggestions, dynamically updates the configuration parameters of the target Beans in the context object through a configuration refresher so that configuration changes take effect without restarting the target application.

[0059] During the execution of the target application based on the Spring Boot framework, resource usage data is monitored and runtime exceptions are captured. When resource usage exceeds limits or an exception occurs, relevant target log data is collected within a preset time window, generating structured first input data to achieve selective collection and provide data support for the artificial intelligence analysis model. When a user initiates a configuration optimization query, the current runtime context data is obtained from the target application's context object to generate structured second input data. The query command, first input data, and second input data are input into a pre-trained artificial intelligence analysis model, which performs joint analysis with historical configuration cases and log data to output configuration optimization suggestions. This approach can accurately locate problems by combining runtime context and log data, improving troubleshooting efficiency, reducing reliance on human experience, and enhancing the correlation between resource allocation and Bean configuration. The configuration parameters of the target Bean are dynamically updated through a configuration refresher, so that configuration changes take effect without restarting the target application.

[0060] It should be noted that the inventive concept of this application dynamic configuration device embodiment is the same as that of the application dynamic configuration method embodiment described above. For the contents not covered in this application dynamic configuration device embodiment, please refer to the application dynamic configuration method embodiment described above, and they will not be repeated here.

[0061] Referring to Figure 4, this embodiment also provides an electronic device, including a processor 210 and a memory 220. The memory 220 stores a computer program, and the processor 210 executes the computer program to implement the above-described application dynamic configuration optimization method. The specific content of the application dynamic configuration optimization method can be found above and will not be repeated here. During the execution of the target application based on the Spring Boot framework, resource usage data is monitored and runtime exceptions are captured. When resource usage exceeds limits or an exception occurs, relevant target log data is collected within a preset time window, generating structured first input data to achieve selective collection and provide data support for the artificial intelligence analysis model. When a user initiates a configuration optimization query, the current runtime context data is obtained from the target application's context object to generate structured second input data. The query command, first input data, and second input data are input into a pre-trained artificial intelligence analysis model, which performs joint analysis with historical configuration cases and log data to output configuration optimization suggestions. This approach can accurately locate problems by combining runtime context and log data, improving troubleshooting efficiency, reducing reliance on human experience, and enhancing the correlation between resource allocation and Bean configuration. The configuration parameters of the target Bean are dynamically updated through a configuration refresher, so that configuration changes take effect without restarting the target application.

[0062] This embodiment also provides a storage medium storing a computer program. When the computer program is run, it implements the above-described application dynamic configuration optimization method. The specific content of the application dynamic configuration optimization method can be found above and will not be repeated here. During the execution of the target application based on the Spring Boot framework, resource usage data is monitored and runtime exceptions are captured. When resource usage exceeds limits or an exception occurs, relevant target log data is collected within a preset time window, and structured first input data is generated to achieve selective collection and provide data support for the artificial intelligence analysis model. When a user initiates a configuration optimization query, the current runtime context data is obtained from the target application's context object, generating structured second input data. The query command, first input data, and second input data are input into a pre-trained artificial intelligence analysis model, combined with historical configuration cases and log data for joint analysis, outputting configuration optimization suggestions. This allows for accurate problem localization by combining runtime context and log data, improving troubleshooting efficiency, reducing reliance on human experience, and enhancing the correlation between resource allocation and Bean configuration. The configuration parameters of the target Bean are dynamically updated through a configuration refresher, enabling configuration changes to take effect without restarting the target application.

[0063] The embodiments of the present invention have been described in detail above with reference to the accompanying drawings. However, the present invention is not limited to the above embodiments. Within the scope of knowledge possessed by those skilled in the art, various changes can be made without departing from the spirit of the present invention.

Claims

1. A dynamic configuration optimization method applied to a target application built using the Spring Boot framework, characterized in that, include: During the operation of the target application, when resource usage data exceeds a preset threshold or an operational anomaly is detected, target log data related to the excessive resources or operational anomaly is collected based on a preset time window, and the target log data is structured to generate first input data; in response to the user's query command, the current runtime context data is obtained from the context object of the target application, and the context data is structured to generate second input data; the query command, the first input data, and the second input data are input into a pre-trained artificial intelligence analysis model to perform joint analysis based on historical configuration cases and historical log data, and output configuration optimization suggestions; The configuration optimization suggestions include a list of beans to be adjusted, as well as the configuration parameters and parameter values ​​of each target bean in the list; Based on the configuration optimization suggestions, the configuration parameters of the target Bean in the context object are dynamically updated through a configuration refresher so that the configuration changes take effect without restarting the target application.

2. The application dynamic configuration optimization method according to claim 1, characterized in that, The resource usage data includes at least one of CPU utilization, memory usage, and the number of active threads in the thread pool. The application dynamic configuration optimization method further includes: collecting the resource usage data during the operation of the target application, and determining that the resource usage data exceeds the preset threshold if the CPU utilization exceeds a preset first threshold, the memory usage exceeds a preset second threshold, and / or the number of active threads in the thread pool exceeds a preset third threshold.

3. The application dynamic configuration optimization method according to claim 1 or 2, characterized in that, The target log data includes log level, timestamp, stack information, and module name. The step of collecting log data related to resource overruns or operational anomalies based on a preset time window includes: filtering all log data based on the preset time window, the current time, and the timestamp of the log data to obtain intermediate log data; and filtering the intermediate log data based on resource overruns or operational anomalies, the stack information of the log data, and the module name to obtain target log data.

4. The application dynamic configuration optimization method according to claim 1, characterized in that, The context data includes Bean definitions, dependencies, configuration parameters, and current running status. Obtaining the current running context data from the context object of the target application includes: obtaining the Bean definitions, dependencies, configuration parameters, and current running status as current context data from the context object of the target application.

5. The application dynamic configuration optimization method according to claim 1, characterized in that, The configuration optimization suggestion also includes adjusted expected performance evaluation data. The step of dynamically updating the configuration parameters of the target Bean of the context object through the configuration refresher according to the configuration optimization suggestion includes: filtering each target Bean in the Bean list according to the expected performance evaluation data and a preset performance threshold to obtain the filtered target Bean; and dynamically updating the configuration parameters of the filtered target Bean of the context object through the configuration refresher.

6. The application dynamic configuration optimization method according to claim 1 or 5, characterized in that, The step of dynamically updating the configuration parameters of the target Bean of the context object through a configuration refresher according to the configuration optimization suggestion includes: triggering the dynamic update of the configuration parameters of the target Bean by calling the RefreshEndpoint interface through the configuration refresher according to the configuration optimization suggestion.

7. The application dynamic configuration optimization method according to claim 5, characterized in that, The step of dynamically updating the configuration parameters of the target Bean of the context object through a configuration refresher according to the configuration optimization suggestions further includes: recording the configuration change data of the target Bean to a configuration change log; performing performance monitoring on the target application for a preset duration based on the expected performance evaluation data; and performing a configuration rollback operation based on the configuration change log if the actual performance evaluation data is lower than the expected performance evaluation data.

8. A dynamic configuration optimization device for application, applied to a target application built using the Spring Boot framework, characterized in that, include: An abnormal log collection module is used to collect target log data related to the excessive resources or operational abnormalities based on a preset time window when resource usage data exceeds a preset threshold or an operational abnormality is detected during the operation of the target application, and to perform structured processing on the target log data to generate first input data. The context data acquisition module is used to respond to the user's query command, obtain the current runtime context data from the context object of the target application, and perform structured processing on the context data to generate second input data; The data analysis module is used to input the query command, the first input data and the second input data into a pre-trained artificial intelligence analysis model to perform joint analysis based on historical configuration cases and historical log data, and output configuration optimization suggestions. The configuration optimization suggestions include a list of beans to be adjusted, as well as the configuration parameters and parameter values ​​of each target bean in the list; The configuration update module is used to dynamically update the configuration parameters of the target Bean of the context object through a configuration refresher according to the configuration optimization suggestions, so that the configuration changes take effect without restarting the target application.

9. An electronic device comprising a processor and a memory, wherein the memory stores a computer program, characterized in that, When the processor runs the computer program, it is used to implement the application dynamic configuration optimization method as described in any one of claims 1 to 7.

10. A storage medium storing a computer program, characterized in that, When the computer program is run, it implements the application dynamic configuration optimization method as described in any one of claims 1 to 7.