Micro-application hot deployment method and system supporting Spring annotation
By supporting the micro-application hot deployment method with Spring annotations, and creating independent class loaders and Spring sub-containers, the problems of low deployment efficiency, limited development models, and class loading conflicts in the power engineering industry are solved, achieving efficient and stable micro-application deployment and updates.
Patent Information
- Application Number
- CN202511363512.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-23
- Publication Date
- 2026-01-16
AI Technical Summary
Traditional monolithic or microservice architectures in the power engineering industry suffer from problems such as low deployment efficiency, limited development models, class loading conflicts, and severe interface coupling. They are particularly difficult to deploy efficiently and upgrade independently in scenarios involving rapid iteration of multiple business systems and low-code development.
We adopt a micro-application hot deployment method that supports Spring annotations. We receive the micro-application JAR package through the web management platform, create an independent class loader and Spring sub-container, and realize component scanning, registration and dependency injection. We use a service gateway to manage interfaces in a unified manner and avoid class loading conflicts and dependency pollution.
It supports standard Spring annotation development, enabling zero-learning-cost integration, improving deployment efficiency, supporting one-click deployment and second-level updates, ensuring the independence of micro-applications and system stability, and is suitable for the power engineering full lifecycle data connectivity platform.
Smart Images

Figure CN121349500A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer software, and particularly relates to a micro application hot deployment method and system supporting Spring annotation. BACKGROUND
[0002] With the deepening of the digital transformation of the electric power engineering industry, it is urgent to build a unified data foundation to realize the penetration and service of the whole life cycle data from design, construction to operation. Traditional monolithic architecture or micro service architecture has problems such as low deployment efficiency, limited development mode, class loading conflict and the like when dealing with rapid iteration of multiple business systems, third-party micro applications and low-code development scenarios. SUMMARY
[0003] The main purpose of the embodiment of the present application is to provide a micro application hot deployment method and system supporting Spring annotation, which can solve the problems of limited micro application development mode, low deployment efficiency and class loading conflict.
[0004] To achieve the above-mentioned purpose, one aspect of the embodiment of the present application provides a micro application hot deployment method supporting Spring annotation, comprising the following steps:
[0005] Receiving a micro application JAR package uploaded through a Web management platform, wherein the micro application JAR package is defined based on Spring annotation;
[0006] Creating an independent class loader and an independent Spring sub-container;
[0007] Loading the micro application JAR package through the class loader, and performing component scanning, registration and dependency injection through the Spring sub-container;
[0008] Registering the REST interface of the micro application to a service gateway to obtain a deployed micro application.
[0009] In some embodiments, the method further comprises the step of defining the micro application JAR package based on Spring annotation, wherein the step of defining the micro application JAR package based on Spring annotation specifically comprises:
[0010] Defining REST interface and service components using the Spring annotation;
[0011] Injecting a platform general service agent using the Spring annotation to obtain the micro application JAR package;
[0012] The platform general service comprises a three-dimensional engine, a search engine and a process engine.
[0013] In some embodiments, creating an independent class loader and an independent Spring sub-container specifically includes:
[0014] Create a separate class loader for each of the micro-applications;
[0015] The class loading method is overridden in the class loader to obtain the created class loader, and class isolation is achieved through the class loader.
[0016] In some embodiments, creating an independent class loader and an independent Spring sub-container specifically includes:
[0017] Create a separate Spring sub-container for each of the micro-applications;
[0018] The Spring sub-container is initialized to obtain the created Spring sub-container, and context isolation is achieved through the Spring sub-container.
[0019] In some embodiments, loading the micro-application JAR package through the class loader and performing component scanning, registration, and dependency injection through the Spring sub-container to obtain the deployed micro-application specifically includes:
[0020] The microapplication JAR package is loaded according to the class name using the class loader.
[0021] The micro-application JAR package is parsed to obtain metadata, which includes an entry class for launching the micro-application and a scanning path for discovering annotation classes.
[0022] Based on the metadata, set the scan path for the Spring sub-container;
[0023] Component scanning is performed according to the scanning path to obtain the target annotation class;
[0024] The target annotation class is registered to the Spring sub-container to obtain the corresponding Bean definition. Then, dependency registration is performed based on the Bean definition to obtain the deployed micro-application.
[0025] In some embodiments, the method further includes:
[0026] The REST interface of the micro-application is registered with the service gateway, and the REST interface is exposed through the service gateway. The micro-applications then make calls to each other through the service gateway.
[0027] In some embodiments, the method further includes:
[0028] When updating the micro-application, the old Spring sub-container is destroyed and the old class loader is unloaded;
[0029] A new class loader and a new Spring sub-container are created. The updated micro-application JAR package is loaded through the new class loader and the new Spring sub-container to realize the micro-application update.
[0030] To achieve the above objectives, another aspect of this application proposes a microapplication hot deployment system supporting Spring annotations, comprising:
[0031] The Web upload module is used to receive micro-application JAR packages uploaded through the Web management platform. The micro-application JAR packages are defined based on Spring annotations.
[0032] The class loader and sub-container management module is used to create independent class loaders and independent Spring sub-containers;
[0033] The deployment management module is used to load the micro-application JAR package through the class loader, and perform component scanning, registration and dependency injection through the Spring sub-container to obtain the deployed micro-application.
[0034] To achieve the above objectives, another aspect of this application provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the method described above.
[0035] To achieve the above objectives, another aspect of the embodiments of this application proposes a computer program product, including a computer program that, when executed by a processor, implements the aforementioned method.
[0036] The embodiments of this application include at least the following beneficial effects: The micro-application hot deployment method and system supporting Spring annotations in this application first receive the micro-application JAR package uploaded through a web management platform. The micro-application JAR package is defined based on Spring annotations. Then, an independent class loader and an independent Spring sub-container are created. The class loader loads the micro-application JAR package, and the Spring sub-container performs component scanning, registration, and dependency injection to obtain the deployed micro-application. On the one hand, this application supports standard Spring annotation development, allowing developers to access the application with zero learning cost without having to learn proprietary APIs, effectively overcoming the limitations of development models. On the other hand, uploading the micro-application JAR package through a web management platform enables one-click deployment, improving deployment efficiency. In addition, by creating an independent class loader and Spring sub-container for the micro-application, dual isolation is achieved based on the class loader and Spring sub-container, avoiding class loading conflicts and dependency pollution. Attached Figure Description
[0037] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the embodiments of this application are described below. It should be understood that the drawings described below are only for the purpose of clearly illustrating some embodiments of the technical solutions in this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0038] Figure 1 A flowchart illustrating the steps of a microapplication hot deployment method supporting Spring annotations, as provided in one embodiment of this application;
[0039] Figure 2 This is a schematic diagram of the system connection for microapplication hot deployment provided in one embodiment of this application;
[0040] Figure 3 This is a schematic diagram of the structure of a microapplication hot deployment system supporting Spring annotations provided in one embodiment of this application;
[0041] Figure 4 This is a schematic diagram of the hardware structure of an electronic device provided in one embodiment of this application. Detailed Implementation
[0042] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to limit it. In the following description, when referring to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with those of this application; they are merely examples of apparatuses and methods consistent with some aspects of the embodiments of this application as detailed in the appended claims.
[0043] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0044] Before providing a detailed description of the embodiments of this application, some of the nouns and terms involved in the embodiments of this application will be explained first. The nouns and terms involved in the embodiments of this application are subject to the following interpretations.
[0045] OSGi (Open Services Gateway Initiative) is a Java-based application modularization framework. Through a special class loading mechanism, it enables physical modularization rather than logical modularization at the package level. OSGi allows developers to decompose applications into independent modules called bundles, which can be installed, uninstalled, and updated at runtime without affecting other parts of the system. This modular approach improves software flexibility, maintainability, and scalability.
[0046] Spring Boot Plugins are tools used in Spring Boot projects to support plugin-based development. They help developers modularize certain functionalities in Spring Boot applications and manage and use them as plugins.
[0047] JPF (Java PathFinder) is a model checking tool for Java programs. It analyzes and verifies the execution path of a Java program using techniques such as state space search and symbolic execution. JPF can be used to detect errors, deadlocks, data races, and other problems in programs, helping developers improve software quality and reliability.
[0048] With the advancement of digital transformation in the power engineering industry, there is an urgent need to build a unified data foundation to achieve the integration and service-orientation of data throughout the entire lifecycle of design, construction, and operation and maintenance. Traditional monolithic or microservice architectures face the following technical bottlenecks when dealing with rapid iterations of multiple business systems, third-party micro-applications, and low-code development scenarios:
[0049] 1. Low deployment efficiency: Updates to business modules require restarting the main service, affecting the stability of the online system and making it impossible to achieve "uninterrupted updates";
[0050] 2. Limited development model: Existing plugin systems often require developers to follow proprietary interfaces or configuration formats, and do not support the mainstream Spring annotation programming model, resulting in high development threshold and closed ecosystem;
[0051] 3. Class loading conflict: When multiple micro-applications use different versions of dependencies or classes with the same name are loaded by different class loaders, it is easy to cause a ClassCastException (an exception thrown when attempting to cast an instance of a class to an incompatible class type).
[0052] 4. Severe interface coupling: Micro-applications directly reference each other's classes, resulting in tight module coupling and difficulty in independent upgrades;
[0053] 5. Service integration difficulties: The lack of a secure call mechanism for common platform services (such as 3D engine, search engine, and process engine) limits the ability to expand the capabilities of the low-code platform.
[0054] While existing technologies such as OSGi, Spring Boot Plugin, and JPF offer modularity, they generally suffer from complex configurations, high learning curves, poor integration with the Spring ecosystem, and incomplete hot update support. Some hot deployment solutions rely on JVM probes or bytecode enhancements, which pose compatibility and stability risks.
[0055] In view of this, this application proposes a method for hot deployment of micro-applications supporting Spring annotations. First, it receives a micro-application JAR package uploaded via a web management platform. This micro-application JAR package is defined based on Spring annotations. Then, it creates an independent class loader and an independent Spring sub-container. The class loader loads the micro-application JAR package, and the Spring sub-container performs component scanning, registration, and dependency injection, resulting in a deployed micro-application. This application supports standard Spring annotation development, allowing developers to integrate with zero learning cost without needing to learn proprietary APIs, effectively overcoming the limitations of traditional development models. Furthermore, uploading the micro-application JAR package via a web management platform enables one-click deployment, improving deployment efficiency. Additionally, by creating an independent class loader and Spring sub-container for the micro-application, dual isolation is achieved, avoiding class loading conflicts and dependency pollution.
[0056] Reference Figure 1 and Figure 2 , Figure 1 This is a flowchart illustrating the steps of a microapplication hot deployment method supporting Spring annotations, as provided in one embodiment of this application. Figure 2 This is a schematic diagram of the system connection for hot deployment of micro-applications according to an embodiment of this application. This embodiment of the application proposes a method for hot deployment of micro-applications that supports Spring annotations. The method may include, but is not limited to, the following steps S101 to S103:
[0057] Step S101: Receive the micro-application JAR package uploaded through the Web management platform. The micro-application JAR package is defined based on Spring annotations.
[0058] Specifically, this application embodiment supports one-click deployment and seamless online updates via uploading JAR packages through a web interface. Developers only need to upload the micro-application JAR package defined based on Spring annotations to the web management platform. The system will automatically parse the metadata, such as the entry class, scanning path, and dependency declarations. Subsequently, the system will create a custom class loader to load the class files in the JAR package and initialize the Spring sub-container, completing component scanning and bean registration. The entire process does not require restarting the main service, enabling rapid deployment and seamless updates of micro-applications.
[0059] As an optional implementation, the method for hot deployment of micro-applications supported by Spring annotations also includes the step of defining a micro-application JAR package based on Spring annotations. This step of defining a micro-application JAR package based on Spring annotations can be further divided into the following steps S1011 and S1012:
[0060] Step S1011: Define REST interfaces and service components using Spring annotations;
[0061] Step S1012: Use Spring annotations to inject the platform's general service proxy to obtain the micro-application JAR package;
[0062] The platform's general services include a 3D engine, a search engine, and a process engine.
[0063] Specifically, the business function modules are first encapsulated into independent JAR files, supporting development using Spring standard annotations. This includes defining REST interfaces using `@RestController`, defining service components using `@Service` and `@Component`, and injecting platform-wide service proxies (such as search, workflow, and 3D engine clients) using `@Autowired`. Each micro-application can contain an independent configuration file, loaded and bound by the Spring sub-container, with its scope limited to the current micro-application. Furthermore, the micro-application skeleton code can be generated and packaged through a low-code platform's visual configuration.
[0064] Step S102: Create an independent class loader and an independent Spring sub-container;
[0065] Specifically, this application's embodiments implement class and context isolation between micro-applications based on a custom class loader and a Spring sub-container. An independent class loader is created for each micro-application, ensuring that class files for different micro-applications are loaded by their respective class loaders, avoiding class conflicts. Simultaneously, an independent Spring sub-container is initialized for each micro-application to manage its Bean definitions and dependency injection, guaranteeing the independent operation of each micro-application.
[0066] As an optional implementation, step S102 can be further divided into the following steps S1021 and S1022:
[0067] Step S1021: Create an independent class loader for each micro-application;
[0068] Step S1022: Override the class loading method in the class loader to obtain the created class loader, and achieve class isolation through the class loader.
[0069] Specifically, a microapp class loader (MicroAppClassLoader) is created that inherits from the URL class loader (URLClassLoader), and the loadClass method is overridden. In the loadClass method, the current class loader prioritizes loading the microapp's private classes, ensuring that the loading of these classes is independent of other microapps and the main application. For public model classes (such as DTOs and Entities), loading is delegated to a parent class loader (such as the system class loader) to avoid version conflicts of the same public classes across different microapps. Furthermore, this approach effectively isolates third-party library dependencies, preventing these dependencies from polluting the main application's classpath, thereby ensuring the stability of the entire system and the independence between microapps.
[0070] As an optional implementation, step S102 can be further divided into steps S1023 and S1024:
[0071] Step S1023: Create an independent Spring sub-container for each micro-application;
[0072] Step S1024: Initialize the Spring sub-container to obtain the created Spring sub-container, and implement context isolation through the Spring sub-container.
[0073] Specifically, a separate Spring sub-container (MicroApplicationContext) is created for each micro-application, inheriting from the annotation-based application context (AnnotationConfigApplicationContext). During initialization, the Spring sub-container scans the package paths specified by the micro-application and automatically registers classes annotated with `@Component` (to mark a class as a Spring component), `@Service` (to mark a service layer class), and `@RestController` (to mark a class as a RESTful web controller). Simultaneously, it loads the micro-application's specific configuration file and binds configuration properties using the `@ConfigurationProperties` annotation, achieving annotation-based configuration management. Furthermore, the Spring sub-container manages the lifecycle of beans within the micro-application, supporting annotations such as `@PostConstruct` (a method executed after bean initialization), `@PreDestroy` (a method executed before bean destruction), and `ApplicationRunner` (an interface executed when the Spring application starts), ensuring correct bean initialization and destruction. In this way, each micro-application has its own independent Spring context, achieving context isolation and guaranteeing the independence and stability between micro-applications.
[0074] Step S103: Load the micro-application JAR package through the class loader, and perform component scanning, registration and dependency injection through the Spring sub-container to obtain the deployed micro-application.
[0075] Specifically, after creating a custom class loader and a Spring sub-container, the system uses the custom class loader to load the class files of the micro-application, and uses the Spring sub-container to perform component scanning, registration, and dependency injection. Finally, the system exposes the REST interface of the micro-application through the service gateway, enabling independent loading, component management, dependency injection, and hot deployment of the micro-application. At the same time, the service gateway enables interface isolation and unified management.
[0076] As an optional implementation, step S103 can be further divided into the following steps S1031 and S1032:
[0077] Step S1031: Load the micro-application JAR package according to the class name using the class loader;
[0078] Step S1032: Parse the micro-application JAR package to obtain metadata, which includes the entry class used to start the micro-application and the scanning path used to discover annotation classes.
[0079] Specifically, the process first receives the micro-application's JAR file from the web management interface and parses its metadata for subsequent loading and configuration. This metadata includes: the entry class, the main class of the micro-application used to start it; the scan path, the package paths that Spring needs to scan to discover annotated classes (such as @Component, @Service, etc.); and dependency declarations, other libraries or modules that the micro-application depends on. Then, the class loader loads the micro-application JAR package based on the class names. The class loader reads the class files in the JAR file, loads them into memory, parses the class files into bytecode, and defines these bytecode files as Java classes using the `defineClass` method.
[0080] Step S1033: Based on the metadata, set the scan path for the Spring sub-container;
[0081] Step S1034: Perform component scanning according to the scanning path to obtain the target annotation class;
[0082] Step S1035: Register the target annotation class into the Spring sub-container to obtain the corresponding Bean definition, and then perform dependency registration based on the Bean definition to obtain the deployed micro-application.
[0083] Specifically, based on the parsed metadata, the scanning paths of the Spring sub-container are set, explicitly specifying which package paths need to be scanned. During the component scanning phase, the Spring sub-container uses these paths to find and identify classes annotated with `@Component`, `@Service`, `@Controller`, `@RestController`, etc. Subsequently, these annotated classes are registered in the Spring sub-container, generating corresponding Bean definitions. Based on these Bean definitions, the Spring sub-container performs dependency injection operations. For example, when a `@Service` class depends on a `@Repository` class, Spring automatically injects this dependency. Furthermore, the Spring sub-container can also access beans from the main application, enabling the reuse of main application functionality.
[0084] As an optional implementation, the micro-application hot deployment method supporting Spring annotations further includes the following step S104:
[0085] Step S104: Register the REST interface of the micro-application to the service gateway, expose the REST interface through the service gateway, and make calls between the micro-applications through the service gateway.
[0086] Specifically, all interfaces annotated with `@RequestMapping` in the micro-applications are registered with a unified service gateway, generating routing rules in the form of ` / api / plugin / {appName} / **`. All micro-application interfaces are exposed uniformly through the service gateway to achieve interface standardization and centralized management. Micro-applications communicate via RESTful API calls through the service gateway, using JSON data format. To further ensure system stability, direct local calls between micro-applications are explicitly prohibited; all interactions must go through the service gateway to avoid potential class loading conflicts and dependency issues.
[0087] As an optional implementation, the micro-application hot deployment method supporting Spring annotations further includes the following steps S105 and S106:
[0088] Step S105: When updating the micro-application, destroy the old Spring sub-container and unload the old class loader;
[0089] Step S106: Create a new class loader and a new Spring sub-container. Using the new class loader and the new Spring sub-container, load the updated micro-application JAR package to update the micro-application.
[0090] Specifically, when a micro-application needs to be updated, the old instance is stopped, the @PreDestroy callback is triggered, the old Spring sub-container (MicroApplicationContext) is destroyed and the old class loader (MicroAppClassLoader) is unloaded, the class loader reference is released, then a new class loader and Spring sub-container are created, the updated micro-application JAR package is loaded, and finally the interface is re-registered, smoothly switching traffic. The whole process does not require restarting the main service and is imperceptible to the user.
[0091] The above describes the micro-application hot deployment method supporting Spring annotations according to embodiments of this application. It can be recognized that, compared with the prior art, embodiments of this application have the following advantages:
[0092] First, it supports standard Spring annotation development, allowing developers to integrate with zero learning cost without having to learn proprietary APIs, effectively overcoming the limitations of development models.
[0093] Second, one-click deployment and hot updates can be achieved by uploading JAR files via the web interface. Business logic changes can be launched in seconds without restarting the main service. This can improve the deployment efficiency of micro-applications, improve the response speed of data services, support the data connectivity of the entire life cycle of power engineering, and is suitable for the integrated data foundation platform of power engineering industry design, construction and operation.
[0094] Third, by creating independent class loaders and Spring sub-containers for micro-applications, developers can use annotations such as @RestController, @Service, and @Autowired to develop plugins and achieve automatic registration and execution, thus achieving dual isolation and avoiding class loading conflicts and dependency pollution.
[0095] Fourth, by uniformly exposing interfaces through a service gateway, interface-level communication and data decoupling are achieved, ensuring cross-application communication security;
[0096] Fifth, it is deeply integrated with low-code platforms, can automatically generate and publish micro-applications, and supports the access of third-party micro-application tools to extend platform capabilities, making it highly scalable.
[0097] Reference Figure 3 This application also provides a microapplication hot deployment system that supports Spring annotations, including:
[0098] The Web upload module is used to receive micro-application JAR packages uploaded through the Web management platform. The micro-application JAR packages are defined based on Spring annotations.
[0099] The class loader and sub-container management module is used to create independent class loaders and independent Spring sub-containers;
[0100] The deployment management module is used to load the micro-application JAR package through the class loader, and perform component scanning, registration and dependency injection through the Spring sub-container to obtain the deployed micro-application.
[0101] It is understood that the content of the above method embodiments is applicable to this system embodiment. The specific functions implemented in this system embodiment are the same as those in the above method embodiments, and the beneficial effects achieved are also the same as those achieved in the above method embodiments.
[0102] This application also provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the above-described method. This electronic device can be any smart terminal, including tablet computers, in-vehicle computers, etc.
[0103] It is understood that the content of the above method embodiments is applicable to this device embodiment. The specific functions implemented by this device embodiment are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0104] Please see Figure 4 , Figure 4 The hardware structure of an electronic device according to another embodiment is illustrated. The electronic device includes:
[0105] The processor 1001 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this application.
[0106] The memory 1002 can be implemented as a read-only memory (ROM), static storage device, dynamic storage device, or random access memory (RAM). The memory 1002 can store the operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 1002 and is called and executed by the processor 1001 using the methods described in the embodiments of this application.
[0107] Input / output interface 1003 is used to implement information input and output;
[0108] The communication interface 1004 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).
[0109] Bus 1005 transmits information between various components of the device (e.g., processor 1001, memory 1002, input / output interface 1003, and communication interface 1004);
[0110] The processor 1001, memory 1002, input / output interface 1003 and communication interface 1004 are connected to each other within the device via bus 1005.
[0111] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described method.
[0112] It is understood that the content of the above method embodiments is applicable to this storage medium embodiment. The specific functions implemented in this storage medium embodiment are the same as those in the above method embodiments, and the beneficial effects achieved are also the same as those achieved in the above method embodiments.
[0113] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.
[0114] It is understood that the content of the above method embodiments is applicable to the embodiments of this program product. The specific functions implemented by the embodiments of this program product are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0115] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0116] The embodiments described in this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided by the embodiments of this application. As those skilled in the art will know, with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.
[0117] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of this application, and may include more or fewer steps than shown, or combine certain steps, or different steps.
[0118] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0119] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or suitable combinations thereof.
[0120] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0121] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0122] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0123] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0124] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0125] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0126] The preferred embodiments of the present application have been described above with reference to the accompanying drawings, but this does not limit the scope of the claims of the present application. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and substance of the embodiments of the present application shall be within the scope of the claims of the present application.
Claims
1. A micro-application hot deployment method supporting Spring annotations, characterized in that, The method comprises the following steps: receiving a micro application JAR package uploaded through a web management platform, the micro application JAR package being defined based on Spring annotations; creating an independent class loader and an independent Spring sub-container; loading the micro application JAR package through the class loader and performing component scanning, registration and dependency injection through the Spring sub-container to obtain a deployed micro application.
2. The method of claim 1, wherein, The method further comprises the step of defining the micro application JAR package based on Spring annotations, and the step of defining the micro application JAR package based on Spring annotations specifically comprises: defining REST interfaces and service components using the Spring annotations; injecting a platform general service agent using the Spring annotations to obtain the micro application JAR package; wherein the platform general service comprises a three-dimensional engine, a search engine and a process engine.
3. The method of claim 1, wherein, The step of creating an independent class loader and an independent Spring sub-container specifically comprises: creating an independent class loader for each micro application; rewriting a class loading method in the class loader to obtain a created class loader, and realizing class isolation through the class loader.
4. The method of claim 1, wherein, The step of creating an independent class loader and an independent Spring sub-container specifically comprises: creating an independent Spring sub-container for each micro application; initializing the Spring sub-container to obtain a created Spring sub-container, and realizing context isolation through the Spring sub-container.
5. The method of claim 1, wherein, The step of loading the micro application JAR package through the class loader and performing component scanning, registration and dependency injection through the Spring sub-container to obtain a deployed micro application specifically comprises: loading the micro application JAR package according to a class name through the class loader; parsing the micro application JAR package to obtain meta information, the meta information comprising an entry class for starting the micro application and a scanning path for discovering annotated classes; setting a scanning path of the Spring sub-container according to the meta information; performing component scanning according to the scanning path to obtain target annotated classes; registering the target annotated classes in the Spring sub-container to obtain corresponding Bean definitions, and further performing dependency registration according to the Bean definitions to obtain a deployed micro application.
6. The method of claim 1, wherein, The method further comprises: registering REST interfaces of the micro applications to a service gateway, exposing the REST interfaces through the service gateway, and calling between the micro applications through the service gateway.
7. The method according to any one of claims 1 to 6, characterized in that, The method further comprises: when updating the micro applications, destroying an old Spring sub-container and uninstalling an old class loader; creating a new class loader and a new Spring sub-container, loading an updated micro application JAR package through the new class loader and the new Spring sub-container, and realizing micro application updating.
8. A micro application hot deployment system supporting Spring annotation, characterized in that, The method comprises: A web upload module is configured to receive a micro application JAR package uploaded through a web management platform, the micro application JAR package being defined based on Spring annotations; A class loader and sub-container management module is configured to create an independent class loader and an independent Spring sub-container; A deployment management module is configured to load the micro application JAR package through the class loader and perform component scanning, registration and dependency injection through the Spring sub-container to obtain a deployed micro application.
9. An electronic device, comprising: The electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the method in any one of claims 1 to 7 when executing the computer program.
10. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to implement the method in any one of claims 1 to 7.