Plug-in loading method for Excel format updating
Through a plug-in loading method for Excel format update, the plug-in loading complexity and performance problems in the existing technology are solved, and efficient, stable and flexible plug-in management is achieved, suitable for a variety of frameworks and tools.
Patent Information
- Application Number
- CN202411687688.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-25
- Publication Date
- 2025-03-11
AI Technical Summary
In the prior art, plug-in loading methods have technical complexity, performance impact, security and stability issues for Excel format updates, and are subject to limitations of frameworks and tools.
Provides a plug-in loading method, including starting the plug-in loader, obtaining configuration information of configuration files, creating a plug-in listener, checksum loading plug-ins, registering plug-in classes to Spring containers, and implementing dynamic start-stop management.
It realizes a simple and reliable, low-cost and low memory loading method, avoids the limitations of the framework and tools, and improves system stability and performance.
Smart Images

Figure CN119597366A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of data extraction and dynamic loading, and relates to a plug-in loading method for Excel format update. Background Art
[0002] In today's information society, data processing has become an indispensable part of all walks of life, and Excel, as a widely used spreadsheet software, carries a large amount of diverse business data. With the continuous growth and change of business needs, the number of Excel documents we face is not only huge, but also their formats are becoming increasingly diverse and distinctive. In this context, the traditional system development model, that is, every time you face a new Excel format type, you need to add new logical branches to the existing code to adapt to its specificity. Over time, the code base is like a tangled jungle that is difficult to sort out and maintain. The reuse rate of the code is reduced, but the coupling between modules is constantly increasing. Any small change may trigger a chain reaction, increasing the potential risk of bugs and the difficulty of debugging.
[0003] Secondly, frequent iterative releases not only consume a lot of manpower and material resources, but also seriously affect the stability of the system and user experience. Each version update requires a series of tedious processes such as design, coding, testing, and deployment, during which there may be risks such as compatibility issues and data loss. In addition, users have to frequently upgrade the system, interrupting their normal work flow and reducing work efficiency.
[0004] One way to solve this problem is plug-in development and management. The core concept is to encapsulate the function of processing specific Excel formats into independent plug-in modules. Each plug-in focuses on processing one or a type of format and interacts with the main system through a standardized interface. In this way, when a new Excel format needs to be supported, only the corresponding plug-in needs to be developed and dynamically loaded into the system without making any modifications to the main system source code. This design pattern greatly reduces the bloat of the code and realizes the modularization and decoupling of functions.
[0005] Specifically, the advantages of plug-in solutions are reflected in the following aspects:
[0006] 1. Reduce code complexity
[0007] 2. Respond to changes quickly
[0008] 3. Enhance system stability
[0009] 4. Improve resource utilization
[0010] In addition, the benefits of plug-in solutions include: modular design, dynamic loading mechanism, flexible scalability, loose coupling and high cohesion.
[0011] However, in the prior art, the technical problem of the plug-in solution lies in the plug-in loading method, especially the plug-in loading method for Excel format update, which is mainly reflected in the following deficiencies:
[0012] 1. Increased technical complexity: increased logical difficulty and high technical difficulty
[0013] 2. Performance impact: longer loading time and increased memory usage
[0014] 3. Security and stability issues: security vulnerability risk and decreased stability
[0015] 4. Limitations of frameworks and tools: limitations of closed source frameworks and framework updates and maintenance
[0016] 5. Restrictions in specific implementations: such as access restrictions on interfaces and classes and restrictions on Activity startup. Summary of the invention
[0017] In view of the deficiencies in the prior art, the present invention provides a plug-in loading method for Excel format update, comprising the following steps:
[0018] S100: Start the host main program, complete the initialization of the main program core service and have the ability to respond to external components, and then start the plug-in loader to load the plug-in;
[0019] S200: The plug-in loader obtains configuration information of the configuration file, including the plug-in ID, version, description, path, and startup status;
[0020] S300: Determine whether the configuration information of the configuration file is obtained, if yes, execute step S400, otherwise, execute step S200;
[0021] S400: The plug-in loader creates a plug-in listener for communication between the main program and the plug-in and for monitoring the life cycle events of the plug-in, including starting and stopping the plug-in;
[0022] S500: The plug-in loader loads each plug-in one by one from the directory according to the plug-in configuration information, wherein:
[0023] The plug-in loader verifies the data information of each plug-in, including ID and version, to ensure that it matches the records in the configuration file and prevent compatibility issues caused by version mismatch;
[0024] The plugin loader checks the startup status of each plugin and only loads plugins that are in the enabled state to achieve dynamic start and stop management of each plugin;
[0025] After successfully loading the plug-in class, the plug-in loader registers the plug-in class with the Spring container to form a plug-in context;
[0026] S600: Determine whether all plug-ins have completed registration and there is no abnormality. If yes, execute step S700; otherwise, execute step S600;
[0027] S700: The plug-in loader reads the data template of the plug-in package, saves the data template content to the memory and binds it to the current plug-in, and completes the plug-in startup.
[0028] Preferably, the design of the configuration file follows the principle of convention over configuration and is written in YAML or properties format.
[0029] Preferably, step S500 includes the following steps:
[0030] S501: Upload the plug-in package to the host;
[0031] S502: decompress the plug-in package and verify the content information of the plug-in package, including configuration file information and data template information;
[0032] S503: Using the class loader provided by Java, load the corresponding Java file in the plug-in package into the memory.
[0033] Preferably, the host operating system is a Windows operating system.
[0034] Preferably, the data template is written in Json format.
[0035] Preferably, the plugin loader is pf4j.
[0036] Preferably, the plug-in loader registers the plug-in into the Spring container using Spring Boot's automatic configuration method.
[0037] Preferably, the main program is used to initialize core services and respond to external components, and to start the plug-in loader.
[0038] The beneficial effects of the present invention are: simple and reliable, low cost, low memory usage, and not limited by frameworks and tools. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 It is the overall flow chart of the present invention;
[0040] Figure 2This is an example diagram of a configuration file written in properties format in an embodiment of the present invention;
[0041] Figure 3 This is an example diagram of a data template format written in Json format in an embodiment of the present invention. DETAILED DESCRIPTION
[0042] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.
[0043] like Figure 1 As shown, the method of the present invention comprises the following steps:
[0044] S100: Start the host main program, complete the initialization of the main program core service and have the ability to respond to external components, and then start the plug-in loader to load the plug-in.
[0045] in,
[0046] The main program is used to initialize core services and respond to external components, and to start the plug-in loader.
[0047] This application does not limit the specific type of the main program, as long as it can initialize core services and respond to external components, and can start the plug-in loader.
[0048] This application does not limit the operating system of the host, and this embodiment uses Windows as the operating system.
[0049] The embodiment of the present application adopts the CAS3200 clue investigation and analysis system as the main program, and its specific usage method is not described in detail.
[0050] S200: The plug-in loader obtains configuration information of the configuration file, including the plug-in ID, version, description, path, and startup status;
[0051] The present application does not limit the specific type of the plug-in loader. The plug-in loader used in the embodiment of the present application is pf4j.
[0052] The design of the configuration file follows the principle of convention over configuration and uses YAML or properties.
[0053] Format writing.
[0054] Figure 2 FIG. 1 shows an example of a configuration file written in properties format in an embodiment of the present invention. Figure 2 Only part of the configuration file is shown.
[0055] S300: Determine whether the configuration information of the configuration file is obtained, if yes, execute step S400, otherwise, execute step S200;
[0056] S400: The pf4j plug-in loader creates a plug-in listener to communicate between the main program CAS3200 clue investigation and analysis system and the plug-in and monitor the plug-in's life cycle events, including the start and stop of the plug-in;
[0057] S500: The pf4j plug-in loader loads each plug-in from the directory one by one according to the plug-in configuration information, where:
[0058] The pf4j plugin loader verifies the data information of each plugin, including ID and version, to ensure that it matches the records in the configuration file and prevent compatibility issues caused by version mismatch;
[0059] The pf4j plugin loader checks the startup status of each plugin and only loads plugins that are in the enabled state to achieve dynamic start and stop management of each plugin;
[0060] After successfully loading the plug-in class, the pf4j plug-in loader registers the plug-in class with the Spring container to form a plug-in context;
[0061] This application does not limit the way to register the plug-in to the Spring container. In this embodiment, the pf4j plug-in loader registers the plug-in to the Spring container using the automatic configuration method of Spring Boot.
[0062] S600: Determine whether all plug-ins have completed registration and there is no abnormality. If yes, execute step S700; otherwise, execute step S600;
[0063] S700: The pf4j plug-in loader reads the data template of the plug-in package, saves the data template content to the memory and binds it to the current plug-in, completing the plug-in startup.
[0064] This application does not limit the writing format of the data template. In this embodiment, the data template is written in Json format.
[0065] Figure 3 An example diagram of a data template format written in Json format in an embodiment of the present invention. For the sake of simplicity, Figure 3 Only part of the data template is shown
[0066] The method provided by the present invention solves the technical problem that there is no simple, reliable, low-cost, low-memory-occupying plug-in loading method for Excel format update in the prior art.
[0067] It should be understood that the present invention is not limited to the above examples. For those skilled in the art, improvements or changes can be made based on the above description. All these improvements and changes should fall within the scope of protection of the claims attached to the present invention.
Claims
1. A plug-in loading method for Excel format update, characterized in that The following steps are involved: S100: Start the host main program, complete the initialization of the main program core service and have the ability to respond to external components, and then start the plug-in loader to load the plug-in; S200: The plug-in loader obtains configuration information of the configuration file, including the plug-in ID, version, description, path, and startup status; S300: Determine whether the configuration information of the configuration file is obtained, if yes, execute step S400, otherwise, execute step S200; S400: The plug-in loader creates a plug-in listener for communication between the main program and the plug-in and for monitoring the life cycle events of the plug-in, including starting and stopping the plug-in; S500: The plug-in loader loads each plug-in one by one from the directory according to the plug-in configuration information, wherein: The plug-in loader verifies the data information of each plug-in, including ID and version, to ensure that it matches the records in the configuration file and prevent compatibility issues caused by version mismatch; The plugin loader checks the startup status of each plugin and only loads plugins that are in the enabled state to achieve dynamic start and stop management of each plugin; After successfully loading the plug-in class, the plug-in loader registers the plug-in class with the Spring container to form a plug-in context; S600: Determine whether all plug-ins have completed registration and there is no abnormality. If yes, execute step S700; otherwise, execute step S600; S700: The plug-in loader reads the data template of the plug-in package, saves the data template content to the memory and binds it to the current plug-in, and completes the plug-in startup.
2. A plug-in loading method for Excel format update according to claim 1, characterized in that: The design of the configuration file follows the principle of convention over configuration and uses YAML or properties. Format writing.
3. A plug-in loading method for Excel format update according to claim 1, characterized in that: Step S500 includes the following steps: S501: Upload the plug-in package to the host; S502: decompress the plug-in package and verify the content information of the plug-in package, including configuration file information and data template information; S503: Using the class loader provided by Java, load the corresponding Java file in the plug-in package into the memory.
4. A plug-in loading method for Excel format update according to claim 3, characterized in that: The host operating system is Windows.
5. A plug-in loading method for Excel format update according to claim 3, characterized in that: The data template is written in Json format.
6. A plug-in loading method for Excel format update according to claim 1, characterized in that: The plugin loader is pf4j.
7. A plug-in loading method for Excel format update according to claim 1, characterized in that: The plugin loader uses Spring Boot's automatic configuration to register the plugin with the Spring container.
8. A plug-in loading method for Excel format update according to claim 1, characterized in that: The main program is used to initialize core services and respond to external components, and to start the plug-in loader.