Class loading isolation method and device based on Spring Boot packaging plug-in, equipment and medium

By using the parent delegation mechanism and preset policy matching algorithm to create and allocate class loaders in the Spring Boot project, the problem of class loading conflict in the Spring Boot project is solved, and simple and efficient class loading isolation is achieved, reducing development costs and human intervention.

CN119621182APending Publication Date: 2025-03-14SHANDONG CVICSE MIDDLEWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411720293.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-28
Publication Date
2025-03-14

AI Technical Summary

Technical Problem

In Spring Boot projects, the existing technology is difficult to handle class loading conflicts simply and efficiently, requires in-depth understanding of dependencies, high learning costs, and naming classes may lead to incompatibility with other third-party internal implementations.

Method used

By using the parent delegation mechanism to create the first class loader and the second class loader, and based on the Spring Boot packaging plug-in, the software package is allocated to the corresponding class loader using the preset policy matching algorithm, replacing the Spring Boot original class loader to achieve class loader isolation.

Benefits of technology

It realizes simple and efficient handling of class loading conflicts, reduces the learning cost and integration difficulty of developers, reduces human intervention, and has almost no impact on the structure of existing applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119621182A_ABST
    Figure CN119621182A_ABST
Patent Text Reader

Abstract

The invention discloses a Spring Boot packaging plug-in-based class loading isolation method, device and equipment and a medium, and relates to the technical field of information, and the method comprises the following steps: creating a first class loader and a second class loader by using a parent delegation mechanism; the first class loader is a subclass loader; the second-class loader is a parent-class loader and has a parent-child relationship with the first-class loader; on the basis of Spring Boot packaging plug-ins, distributing the software packages meeting a preset high priority condition to the first type of loaders by utilizing a preset strategy matching algorithm, and distributing the software packages meeting a preset low priority condition to the second type of loaders; and replacing the Spring Boot original class loader based on the obtained first target class loader and the second target class loader to obtain a class loader isolation plug-in, and performing class loading isolation on the target software package with the class conflict by utilizing the class loader isolation plug-in. The class conflict problem can be solved with low cost.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of information technology, and in particular to a class loading isolation method, device, equipment and medium based on Spring Boot packaged plug-in. Background Art

[0002] Currently, in Spring Boot (an open source application framework) projects, you can use the dependency exclusion function of Maven (a project management tool) or Gradle (an open source tool for project automated build) to exclude dependencies that cause conflicts, use Maven Shade Plugin (a Maven shadow plugin) to repackage the application and rename the conflicting classes; use Maven's dependency:tree command or Gradle's dependencies task to analyze the project's dependency tree and find out the conflicting dependencies. However, this method requires a deep understanding of the dependency relationship, which is costly to learn, and naming classes may cause incompatibility with other third-party internal implementations.

[0003] As can be seen from the above, how to simply and efficiently handle class loading conflicts is a problem that needs to be solved urgently. Summary of the invention

[0004] In view of this, the purpose of the present invention is to provide a class loading isolation method, device, equipment and medium based on Spring Boot packaged plug-in, which can simply and efficiently handle class loading conflicts. The specific scheme is as follows:

[0005] In the first aspect, the present application provides a class loading isolation method based on Spring Boot packaged plug-in, including:

[0006] A first class loader and a second class loader are created by using a parent delegation mechanism; the first class loader is a child class loader; the second class loader is a parent class loader and has a parent-child relationship with the first class loader;

[0007] Based on the Spring Boot packaging plug-in and using a preset strategy matching algorithm, the software package that meets the preset high priority condition is assigned to the first class loader to obtain a first target class loader, and the software package that meets the preset low priority condition is assigned to the second class loader to obtain a second target class loader;

[0008] The original Spring Boot class loader is replaced based on the first target class loader and the second target class loader to obtain a class loader isolation plug-in, and the class loader isolation plug-in is used to perform class loading isolation on the target software package where the class conflict occurs.

[0009] Optionally, the creating the first class loader and the second class loader by using a parent delegation mechanism includes:

[0010] The parent-child relationship between the child class loader and the parent class loader in the parent delegation mechanism is utilized to create the first class loader and the second class loader having a parent-child relationship in the Spring Boot project.

[0011] Optionally, the Spring Boot packaging plug-in is based on and uses a preset strategy matching algorithm to assign the software package that meets the preset high priority condition to the first class loader to obtain a first target class loader, and assigns the software package that meets the preset low priority condition to the second class loader to obtain a second target class loader, including:

[0012] Using the Spring Boot packaging plug-in to package the Spring Boot application to obtain the software package;

[0013] A priority judgment is performed on the software package, and based on the judgment result and using a preset strategy matching algorithm, the software package that meets a preset high priority condition is allocated to the first class loader to obtain a first target class loader, and the software package that meets a preset low priority condition is allocated to the second class loader to obtain a second target class loader.

[0014] Optionally, the performing priority judgment on the software package, assigning the software package that meets a preset high priority condition to the first class loader based on the judgment result and using a preset strategy matching algorithm to obtain a first target class loader, and assigning the software package that meets a preset low priority condition to the second class loader to obtain a second target class loader, includes:

[0015] Determining whether the software package meets a preset high priority condition, and if the software package meets the preset high priority condition, allocating the software package that meets the preset high priority condition to the first class loader by using a preset strategy matching algorithm to obtain a first target class loader;

[0016] If the software package does not meet the preset high priority condition, the software package is used as the software package meeting the preset low priority condition, and the software package meeting the preset low priority condition is allocated to the second class loader to obtain the second target class loader using a preset strategy matching algorithm.

[0017] Optionally, replacing the SpringBoot original class loader based on the first target class loader and the second target class loader to obtain a class loader isolation plug-in includes:

[0018] A loader entry corresponding to the Spring Boot original class loader is obtained, and the loader entry is replaced by the first target class loader and the second target class loader to obtain a class loader isolation plug-in.

[0019] Optionally, the using the class loader isolation plug-in to perform class loading isolation on the target software package having a class conflict includes:

[0020] If there is a target software package in which a class conflict occurs, using the first class loader in the class loader isolation plug-in to load the target software package;

[0021] If the first class loader cannot load the target software package, the second class loader in the class loader isolation plug-in is used to load the target software package to obtain the target software package.

[0022] Optionally, the using the class loader isolation plug-in to perform class loading isolation on the target software package having a class conflict includes:

[0023] Introducing the class loader isolation plug-in into a Spring Boot project, and performing plug-in configuration and packaging operations on the Spring Boot project based on the class loader isolation plug-in to obtain a target Spring Boot project;

[0024] The target Spring Boot project is used to isolate the class loading of the target software package where the class conflict occurs.

[0025] In the second aspect, the present application provides a class loading isolation device based on Spring Boot packaged plug-in, including:

[0026] A class loader creation module, used to create a first class loader and a second class loader using a parent delegation mechanism; the first class loader is a child class loader; the second class loader is a parent class loader and has a parent-child relationship with the first class loader;

[0027] A software package allocation module is used to allocate the software package that meets the preset high priority condition to the first class loader based on the Spring Boot packaging plug-in and using a preset strategy matching algorithm to obtain a first target class loader, and allocate the software package that meets the preset low priority condition to the second class loader to obtain a second target class loader;

[0028] A class loading replacement module is used to replace the original Spring Boot class loader based on the first target class loader and the second target class loader to obtain a class loader isolation plug-in, and use the class loader isolation plug-in to perform class loading isolation on the target software package where class conflicts occur.

[0029] In a third aspect, the present application provides an electronic device, including:

[0030] Memory, used to store computer programs;

[0031] A processor is used to execute the computer program to implement the aforementioned class loading isolation method based on Spring Boot packaging plug-in.

[0032] In a fourth aspect, the present application provides a computer-readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the aforementioned class loading isolation method based on Spring Boot packaged plug-in.

[0033] The present application utilizes a parent delegation mechanism to create a first class loader and a second class loader; the first class loader is a child class loader; the second class loader is a parent class loader and has a parent-child relationship with the first class loader; based on a Spring Boot packaging plug-in and using a preset strategy matching algorithm, the software package that meets a preset high priority condition is assigned to the first class loader to obtain a first target class loader, and the software package that meets a preset low priority condition is assigned to the second class loader to obtain a second target class loader; based on the first target class loader and the second target class loader, the original Spring Boot class loader is replaced to obtain a class loader isolation plug-in, and the class loader isolation plug-in is used to perform class loading isolation on the target software package where a class conflict occurs.

[0034] As can be seen from the above, the present application uses the parent delegation mechanism to customize the first class loader and the second class loader that have a parent-child relationship, and uses the preset strategy matching algorithm to assign priorities to the software packages, assigning the software packages that meet the preset high priority to the first class loader, and assigning the software packages that meet the preset low priority to the second class loader, and replacing the original Spring Boot class loader with the first target class loader and the second target class loader to obtain a class loader isolation plug-in. In this way, the class loader isolation plug-in is used to isolate the class loading of the target software package where the class conflict occurs, solving the class conflict problem. Participating in the construction process in a plug-in manner has almost no impact on the structure of the existing application, and the configuration is simple, which reduces the learning cost and integration difficulty of the developer and reduces human intervention. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0036] Figure 1 A flow chart of a class loading isolation method based on Spring Boot packaged plug-in disclosed in this application;

[0037] Figure 2 A flow chart of a specific class loading isolation method based on Spring Boot packaged plug-in disclosed in this application;

[0038] Figure 3 A schematic diagram of using a class loading isolation plug-in provided for this application;

[0039] Figure 4 This is a schematic diagram of the structure of a class loading isolation device based on Spring Boot packaged plug-in disclosed in this application;

[0040] Figure 5 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION

[0041] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0042] At present, the dependency exclusion function of Maven or Gradle is used to exclude the dependency that causes the conflict, which requires a deep understanding of the dependency relationship, has a high learning cost, and the named class may cause incompatibility with the internal implementation of other third parties. To this end, the present application provides a class loading isolation method based on Spring Boot packaging plug-in, which uses the class loader isolation plug-in to isolate the target software package where the class conflict occurs, thereby solving the class conflict problem. Participating in the construction process in a plug-in-based manner has almost no effect on the structure of existing applications, and the configuration is simple, which reduces the learning cost and integration difficulty of developers and reduces human intervention.

[0043] See also Figure 1 As shown, an embodiment of the present invention discloses a class loading isolation method based on Spring Boot packaged plug-in, including:

[0044] Step S11, using the parent delegation mechanism to create a first class loader and a second class loader; the first class loader is a child class loader; the second class loader is a parent class loader and has a parent-child relationship with the first class loader.

[0045] In this embodiment, a parent delegation mechanism is used to create a first class loader and a second class loader that have a parent-child relationship. Specifically, the use of the parent delegation mechanism to create the first class loader and the second class loader includes: using the parent-child relationship between the child class loader and the parent class loader in the parent delegation mechanism to create the first class loader and the second class loader that have a parent-child relationship in the Spring Boot project. It should be noted that the first class loader and the second class loader are custom created class loaders.

[0046] Step S12: Based on the Spring Boot packaging plug-in and using a preset strategy matching algorithm, the software package that meets the preset high priority condition is assigned to the first class loader to obtain a first target class loader, and the software package that meets the preset low priority condition is assigned to the second class loader to obtain a second target class loader.

[0047] In this embodiment, the Spring Boot packaging plug-in is used to package the Spring Boot application to obtain a software package, and the software package is matched based on a preset policy matching algorithm to allocate the software package that meets the preset high priority condition to the first class loader, and the software package that meets the preset low priority condition to the second class loader. Specifically, the software package that meets the preset high priority condition is allocated to the first class loader based on the Spring Boot packaging plug-in and the preset policy matching algorithm to obtain the first target class loader, and the software package that meets the preset low priority condition is allocated to the second class loader to obtain the second target class loader, including: using the Spring Boot packaging plug-in to package the Spring Boot application to obtain the software package; performing priority judgment on the software package, based on the judgment result and using the preset policy matching algorithm to allocate the software package that meets the preset high priority condition to the first class loader to obtain the first target class loader, and the software package that meets the preset low priority condition is allocated to the second class loader to obtain the second target class loader. It should be pointed out that the priority of the software package can be a user-defined priority, which is not specifically limited here.

[0048] It can be understood that the priority of the software package is judged. If the software package meets the preset high priority condition, the software package that meets the preset high priority condition is allocated to the first class loader using the preset strategy matching algorithm to obtain the first target class loader; if the software package does not meet the preset high priority condition, it is characterized that the software package meets the preset low priority condition, and the software package that meets the preset low priority condition is allocated to the second class loader using the preset strategy matching algorithm to obtain the second target class loader. Specifically, the priority determination of the software package, based on the determination result and using a preset policy matching algorithm, allocating the software package that meets a preset high priority condition to the first class loader to obtain a first target class loader, and allocating the software package that meets a preset low priority condition to the second class loader to obtain a second target class loader, includes: determining whether the software package meets a preset high priority condition, and if the software package meets the preset high priority condition, allocating the software package that meets the preset high priority condition to the first class loader using a preset policy matching algorithm to obtain a first target class loader; if the software package does not meet the preset high priority condition, treating the software package as the software package that meets a preset low priority condition, and allocating the software package that meets the preset low priority condition to the second class loader using a preset policy matching algorithm to obtain a second target class loader.

[0049] Step S13: Replace the original Spring Boot class loader based on the first target class loader and the second target class loader to obtain a class loader isolation plug-in, and use the class loader isolation plug-in to perform class loading isolation on the target software package where the class conflict occurs.

[0050] In this embodiment, after obtaining the first target class loader and the second target class loader, the loader entry of the Spring Boot original class loader is replaced based on the first target class loader and the second target class loader to obtain a class loader isolation plug-in. Specifically, the replacement of the Spring Boot original class loader based on the first target class loader and the second target class loader to obtain the class loader isolation plug-in includes: obtaining the loader entry corresponding to the Spring Boot original class loader, replacing the loader entry with the first target class loader and the second target class loader to obtain the class loader isolation plug-in.

[0051] It is understandable that when the class loader isolation plug-in is used to perform class loading isolation, if there is a target software package with a class conflict, the first class loader is used to load the target software package; if the first class loader cannot load the target software package, the second class loader is used to load the target software package. Specifically, the use of the class loader isolation plug-in to perform class loading isolation on the target software package with a class conflict includes: if there is a target software package with a class conflict, the first class loader in the class loader isolation plug-in is used to load the target software package; if the first class loader cannot load the target software package, the second class loader in the class loader isolation plug-in is used to load the target software package to obtain the target software package.

[0052] Furthermore, when using the class loader isolation plug-in, the class loader isolation plug-in can be introduced into the Spring Boot project, such as through the pom.xml file, and a custom plug-in configuration is performed and the entire SpringBoot project is packaged and constructed to obtain a target Spring Boot project, and then the target Spring Boot project is used to perform class loading isolation on the target software package where the class conflict occurs. Specifically, the use of the class loader isolation plug-in to perform class loading isolation on the target software package where the class conflict occurs includes: introducing the class loader isolation plug-in into the Spring Boot project, and performing plug-in configuration and packaging operations on the Spring Boot project based on the class loader isolation plug-in to obtain the target Spring Boot project; and using the target Spring Boot project to perform class loading isolation on the target software package where the class conflict occurs.

[0053] As can be seen from the above, the present application uses the parent delegation mechanism to customize the first class loader and the second class loader that have a parent-child relationship, and uses the preset strategy matching algorithm to assign priorities to the software packages, assigning the software packages that meet the preset high priority to the first class loader, and assigning the software packages that meet the preset low priority to the second class loader, and replacing the original Spring Boot class loader with the first target class loader and the second target class loader to obtain a class loader isolation plug-in. In this way, the class loader isolation plug-in is used to isolate the class loading of the target software package where the class conflict occurs, solving the class conflict problem. Participating in the construction process in a plug-in manner has almost no impact on the structure of the existing application, and the configuration is simple, which reduces the learning cost and integration difficulty of the developer and reduces human intervention.

[0054] It can be seen from the above embodiments that the class loader isolation plug-in constructed based on the first class loader and the second class loader in the present application performs class loading isolation on the conflicting target software package. Therefore, the process of constructing the class loader isolation plug-in based on the first class loader and the second class loader is described.

[0055] See also Figure 2 As shown, the embodiment of the present invention discloses a specific class loading isolation method based on Spring Boot packaged plug-in, including:

[0056] This embodiment improves the existing class loader architecture of Spring Boot, creates a first class loader and a second class loader with a parent-child relationship based on a parent delegation mechanism, wherein the first class loader is a child class loader and the second class loader is a parent class loader; by modifying the launch method in the Spring Boot packaging plug-in and using a preset strategy matching algorithm to perform strategy matching on each software package, the software packages are divided into several maps (sets) with different priorities, and resources are allocated to different class loaders according to different priorities, and the class loader that meets the preset high priority condition is set as a child class loader, that is, the software package that meets the preset high priority condition is allocated to the first class loader to obtain the first target class loader, and the software package that meets the preset low priority condition is allocated to the second class loader to obtain the second target class loader; then the loading priority of the existing parent delegation mechanism is modified, and the priority is changed to the child class loader first loading, and if it cannot be loaded, it will be loaded by the parent class loader. Finally, the original class loader entry of Spring Boot is replaced with the customized first class loader and second class loader, so that after packaging, the software packages are all loaded by the first class loader, thereby realizing class loading isolation.

[0057] Figure 3 A schematic diagram of using a class loading isolation plug-in provided in this embodiment, after replacing the original Spring Boot class loader based on the first target class loader and the second target class loader to obtain the class loader isolation plug-in, the class loading isolation plug-in is introduced into the Spring Boot project and then a customized plug-in configuration is performed, and the entire project is packaged and built, and finally the completed application can achieve class loading isolation. That is, the target Spring Boot project that introduces the class loading isolation plug-in can class load isolation for the target software package that has class conflicts.

[0058] As can be seen from the above, when packaging an application, class loading is isolated for target software packages that may have class conflicts, and they are loaded by different class loaders. Class loading isolation is used in the construction process in a plug-in manner, which has almost no impact on the structure of existing applications. Through seamless integration with the Spring Boot ecosystem, the learning cost and integration difficulty of developers are reduced, and human intervention is reduced.

[0059] Accordingly, see Figure 4 As shown, the present application also provides a class loading isolation device based on Spring Boot packaged plug-in, including:

[0060] The class loader creation module 11 is used to create a first class loader and a second class loader by using a parent delegation mechanism; the first class loader is a child class loader; the second class loader is a parent class loader and has a parent-child relationship with the first class loader;

[0061] The software package allocation module 12 is used to allocate the software package that meets the preset high priority condition to the first class loader based on the Spring Boot packaging plug-in and using a preset strategy matching algorithm to obtain a first target class loader, and allocate the software package that meets the preset low priority condition to the second class loader to obtain a second target class loader;

[0062] The class loading replacement module 13 is used to replace the original Spring Boot class loader based on the first target class loader and the second target class loader to obtain a class loader isolation plug-in, and use the class loader isolation plug-in to perform class loading isolation on the target software package where class conflicts occur.

[0063] As can be seen from the above, the present application uses the parent delegation mechanism to customize the first class loader and the second class loader that have a parent-child relationship, and uses the preset strategy matching algorithm to assign priorities to the software packages, assigning the software packages that meet the preset high priority to the first class loader, and assigning the software packages that meet the preset low priority to the second class loader, and replacing the original Spring Boot class loader with the first target class loader and the second target class loader to obtain a class loader isolation plug-in. In this way, the class loader isolation plug-in is used to isolate the class loading of the target software package where the class conflict occurs, solving the class conflict problem. Participating in the construction process in a plug-in manner has almost no impact on the structure of the existing application, and the configuration is simple, which reduces the learning cost and integration difficulty of the developer and reduces human intervention.

[0064] In some specific implementations, the class loader creation module 11 may specifically include:

[0065] The class loader creation completion unit is used to create the first class loader and the second class loader in the Spring Boot project that have a parent-child relationship by using the parent-child relationship between the child class loader and the parent class loader in the parent delegation mechanism.

[0066] In some specific implementations, the software package distribution module 12 may specifically include:

[0067] A software package acquisition unit, used to package the Spring Boot application using a Spring Boot packaging plug-in to obtain the software package;

[0068] The software package allocation completion unit is used to judge the priority of the software package, and based on the judgment result and using a preset strategy matching algorithm, allocate the software package that meets the preset high priority condition to the first class loader to obtain a first target class loader, and allocate the software package that meets the preset low priority condition to the second class loader to obtain a second target class loader.

[0069] In some specific implementations, the software package distribution module 12 may specifically include:

[0070] a first software package allocation unit, configured to determine whether the software package satisfies a preset high priority condition, and if the software package satisfies the preset high priority condition, allocate the software package satisfying the preset high priority condition to the first class loader by using a preset strategy matching algorithm to obtain a first target class loader;

[0071] The second software package allocation unit is used to, if the software package does not meet the preset high priority condition, use the software package as the software package that meets the preset low priority condition, and use the preset strategy matching algorithm to allocate the software package that meets the preset low priority condition to the second class loader to obtain a second target class loader.

[0072] In some specific implementations, the class loading replacement module 13 may specifically include:

[0073] The class loader replacement completion unit is used to obtain a loader entry corresponding to the Spring Boot original class loader, and replace the loader entry with the first target class loader and the second target class loader to obtain a class loader isolation plug-in.

[0074] In some specific implementations, the class loading replacement module 13 may specifically include:

[0075] a first software package loading unit, configured to load the target software package by using the first class loader in the class loader isolation plug-in if there is a target software package with a class conflict;

[0076] The second software package loading unit is used to load the target software package using the second class loader in the class loader isolation plug-in to obtain the target software package if the first class loader cannot load the target software package.

[0077] Furthermore, the present application also discloses an electronic device. Figure 5 It is a structural diagram of an electronic device 20 shown according to an exemplary embodiment, and the content in the figure cannot be regarded as any limitation on the scope of use of this application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input and output interface 25 and a communication bus 26. Among them, the memory 22 is used to store a computer program, and the computer program is loaded and executed by the processor 21 to implement the relevant steps in the class loading isolation method based on the Spring Boot packaged plug-in disclosed in any of the aforementioned embodiments. In addition, the electronic device 20 in this embodiment can specifically be an electronic computer.

[0078] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.

[0079] In addition, the memory 22 as a carrier for storing resources may be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon may include an operating system 221, a computer program 222, etc., and the storage method may be temporary storage or permanent storage.

[0080] The operating system 221 is used to manage and control the hardware devices and computer program 222 on the electronic device 20, which can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the class loading isolation method based on Spring Boot packaged plug-in executed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks.

[0081] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the aforementioned disclosed class loading isolation method based on Spring Boot packaged plug-in is implemented. For the specific steps of the method, reference can be made to the corresponding contents disclosed in the aforementioned embodiment, and no further description will be given here.

[0082] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0083] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0084] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0085] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0086] The technical solution provided by the present application is introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for general technicians in this field, according to the idea of ​​the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A class loading isolation method based on Spring Boot packaged plug-in, characterized in that: include: A first class loader and a second class loader are created using a parent delegation mechanism; the first class loader is a child class loader; The second class loader is a parent class loader and has a parent-child relationship with the first class loader; Based on the Spring Boot packaging plug-in and using a preset strategy matching algorithm, the software package that meets the preset high priority condition is assigned to the first class loader to obtain a first target class loader, and the software package that meets the preset low priority condition is assigned to the second class loader to obtain a second target class loader; The original Spring Boot class loader is replaced based on the first target class loader and the second target class loader to obtain a class loader isolation plug-in, and the class loader isolation plug-in is used to perform class loading isolation on the target software package where the class conflict occurs.

2. According to the class loading isolation method based on Spring Boot packaged plug-in according to claim 1, it is characterized in that: The method of creating the first class loader and the second class loader by using the parent delegation mechanism includes: The parent-child relationship between the child class loader and the parent class loader in the parent delegation mechanism is utilized to create the first class loader and the second class loader having a parent-child relationship in the Spring Boot project.

3. According to the class loading isolation method based on Spring Boot packaged plug-in according to claim 1, it is characterized in that: The method of allocating the software package that meets the preset high priority condition to the first class loader based on the Spring Boot packaging plug-in and using a preset strategy matching algorithm to obtain a first target class loader, and allocating the software package that meets the preset low priority condition to the second class loader to obtain a second target class loader includes: Using the Spring Boot packaging plug-in to package the Spring Boot application to obtain the software package; A priority judgment is performed on the software package, and based on the judgment result and using a preset strategy matching algorithm, the software package that meets a preset high priority condition is allocated to the first class loader to obtain a first target class loader, and the software package that meets a preset low priority condition is allocated to the second class loader to obtain a second target class loader.

4. The class loading isolation method based on Spring Boot packaged plug-in according to claim 3 is characterized in that: The step of determining the priority of the software package, assigning the software package that meets a preset high priority condition to the first class loader based on the determination result and using a preset strategy matching algorithm to obtain a first target class loader, and assigning the software package that meets a preset low priority condition to the second class loader to obtain a second target class loader, comprises: Determining whether the software package meets a preset high priority condition, and if the software package meets the preset high priority condition, allocating the software package that meets the preset high priority condition to the first class loader by using a preset strategy matching algorithm to obtain a first target class loader; If the software package does not meet the preset high priority condition, the software package is used as the software package meeting the preset low priority condition, and the software package meeting the preset low priority condition is allocated to the second class loader to obtain the second target class loader using a preset strategy matching algorithm.

5. The class loading isolation method based on Spring Boot packaged plug-in according to claim 1 is characterized in that: The replacing the Spring Boot original class loader based on the first target class loader and the second target class loader to obtain a class loader isolation plug-in includes: A loader entry corresponding to the Spring Boot original class loader is obtained, and the loader entry is replaced by the first target class loader and the second target class loader to obtain a class loader isolation plug-in.

6. The class loading isolation method based on Spring Boot packaged plug-in according to claim 1 is characterized in that: The method of utilizing the class loader isolation plug-in to perform class loading isolation on the target software package having class conflicts includes: If there is a target software package in which a class conflict occurs, using the first class loader in the class loader isolation plug-in to load the target software package; If the first class loader cannot load the target software package, the second class loader in the class loader isolation plug-in is used to load the target software package to obtain the target software package.

7. The class loading isolation method based on Spring Boot packaged plug-in according to any one of claims 1 to 6 is characterized in that: The method of utilizing the class loader isolation plug-in to perform class loading isolation on the target software package having class conflicts includes: Introducing the class loader isolation plug-in into a Spring Boot project, and performing plug-in configuration and packaging operations on the Spring Boot project based on the class loader isolation plug-in to obtain a target Spring Boot project; The target Spring Boot project is used to isolate the class loading of the target software package where the class conflict occurs.

8. A class loading isolation device based on Spring Boot packaged plug-in, characterized in that: include: A class loader creation module, used to create a first class loader and a second class loader using a parent delegation mechanism; the first class loader is a child class loader; The second class loader is a parent class loader and has a parent-child relationship with the first class loader; A software package allocation module is used to allocate the software package that meets the preset high priority condition to the first class loader based on the Spring Boot packaging plug-in and using a preset strategy matching algorithm to obtain a first target class loader, and allocate the software package that meets the preset low priority condition to the second class loader to obtain a second target class loader; A class loading replacement module is used to replace the original SpringBoot class loader based on the first target class loader and the second target class loader to obtain a class loader isolation plug-in, and use the class loader isolation plug-in to perform class loading isolation on the target software package where class conflicts occur.

9. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor is used to execute the computer program to implement the class loading isolation method based on the SpringBoot packaging plug-in as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: Used to store a computer program, wherein when the computer program is executed by a processor, the class loading isolation method based on the Spring Boot packaged plug-in according to any one of claims 1 to 7 is implemented.