External class loading method, device, medium, equipment and program product

By detecting and loading the attribute configuration in the preset configuration file, external class loading in the bank information system of the Java technology stack is realized, which solves the time-consuming and costly problem of system redeployment and reduces management costs.

CN113377456BActive Publication Date: 2024-10-01AGRICULTURAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110713926.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-25
Publication Date
2024-10-01
Estimated Expiration
2041-06-25

AI Technical Summary

Technical Problem

In a bank information system based on Java technology stack, as the project scale grows, the time-consuming and operating costs of system redeployment become considerable, resulting in high management costs. It is difficult to effectively reduce these costs with existing technology.

Method used

By detecting whether there is a preset configuration file configured under the framework program, obtain the preset attribute configuration and load the external load class from the corresponding path of the preset application system deployment environment, use the virtual machine and container class loader for security verification and initialization, add Load path information to load external load classes to implement external class loading of the application system.

Benefits of technology

There is no need to rebuild and deploy the framework program, only the default configuration files need to be updated or added, which significantly reduces the time and operating costs of system redeployment and improves management efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113377456B_ABST
    Figure CN113377456B_ABST
Patent Text Reader

Abstract

The present application provides an external class loading method, device, medium, equipment and program product. The method provided in the embodiment of the present application detects that a preset configuration file is configured under the framework program, and obtains the preset attribute configuration in the preset configuration file, and then loads the external loading class from the corresponding path of the environment where the preset application system is deployed according to the preset attribute configuration, so that when the application system needs to add a new functional program or modify an existing functional program, only the preset configuration file to be added or modified is needed, without rebuilding and deploying the framework program, which effectively reduces the time-consuming system redeployment and the management cost expenditure caused by the operation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of Internet technology, and in particular to an external class loading method, device, medium, equipment and program product. Background Art

[0002] At present, in the process of building banking information systems, information systems built based on Java technology stack gradually occupy an increasing proportion. Among them, the operating environment of application systems built based on Java technology stack widely adopts WebSphere container of International Business Machines (IBM).

[0003] In the construction of information systems based on the Java technology stack, as the scale of the program continues to expand, minor local modifications to the project theoretically require regression testing of the entire project. Even if the modification boundaries are confirmed through code-level version management to avoid a large number of regression testing tasks, the reconstruction of the project will have to face the operation of redeployment.

[0004] It can be seen that as the scale of the project continues to grow, the time and operation of system redeployment is a considerable management cost expenditure, resulting in higher costs for system redeployment. Summary of the invention

[0005] The embodiments of the present application provide an external class loading method, apparatus, medium, device and program product to effectively reduce the time consumption of system redeployment and the management cost expenditure caused by the operation.

[0006] In a first aspect, an embodiment of the present application provides an external class loading method, which is applied to a preset application system, wherein the preset application system includes: a framework program and at least one functional program, wherein the functional program implements a function based on a class; the method includes:

[0007] If it is detected that a preset configuration file is configured under the framework program, then the preset attribute configuration in the preset configuration file is obtained, and the preset configuration file is used to configure the loading path information of the external loading class;

[0008] The external loading class is loaded from the corresponding path of the environment where the preset application system is deployed according to the preset attribute configuration.

[0009] In a possible design, the step of loading the external loading class from a corresponding path of the environment where the preset application system is deployed according to the preset attribute configuration includes:

[0010] According to the preset attribute configuration, a preset container class loader is called to load the preset bytecode file corresponding to the external loading class into the memory;

[0011] In the running state of the virtual machine, performing security verification on the preset bytecode file;

[0012] If the verification is successful, the preset container class loader allocates memory to the class variables of the externally loaded class and performs initialization operations on the class variables;

[0013] The virtual machine references the loading path information and executes the constructor of the externally loaded class;

[0014] During the startup of the application system, the loading path information is added to the scanning path of the application system by acquiring the preset container class loader to load the external loading class.

[0015] In a possible design, the application system startup process includes:

[0016] The first container, the second container and the third container are started in sequence, and in the initialization phase of the third container, the loading path information is added to the scanning path of the application system by acquiring the preset container class loader to load the external loading class.

[0017] In a possible design, during the startup of the application system, after acquiring the preset container class loader and adding the loading path information to the scanning path of the application system to load the external loading class, the method further includes:

[0018] During the initialization phase of the third container, the preset reusable component is registered and updated through dependency injection through the third container.

[0019] In a possible design, the external class loading method further includes:

[0020] Acquire configuration instructions to configure the preset configuration file under the framework program according to the configuration instructions.

[0021] In a possible design, the external class loading method further includes:

[0022] A configuration instruction is obtained to reconfigure the preset configuration file configured under the framework program according to the configuration instruction.

[0023] In a second aspect, an embodiment of the present application provides an external class loading device, including:

[0024] An acquisition module, used for acquiring a preset attribute configuration in a preset configuration file when detecting that a preset configuration file is configured under the framework program, wherein the preset configuration file is used to configure loading path information of an external loading class;

[0025] The processing module is used to load the external loading class from the corresponding path of the environment where the preset application system is deployed according to the preset attribute configuration.

[0026] In a possible design, the processing module is specifically used to:

[0027] According to the preset attribute configuration, a preset container class loader is called to load the preset bytecode file corresponding to the external loading class into the memory;

[0028] In the running state of the virtual machine, performing security verification on the preset bytecode file;

[0029] If the verification is successful, the preset container class loader allocates memory to the class variables of the externally loaded class and performs initialization operations on the class variables;

[0030] The virtual machine references the loading path information and executes the constructor of the externally loaded class;

[0031] During the startup of the application system, the loading path information is added to the scanning path of the application system by acquiring the preset container class loader to load the external loading class.

[0032] In a possible design, the processing module is specifically used to:

[0033] The first container, the second container and the third container are started in sequence, and in the initialization phase of the third container, the loading path information is added to the scanning path of the application system by acquiring the preset container class loader to load the external loading class.

[0034] In a possible design, the processing module is further used to: during the initialization phase of the third container, register and update the preset reusable components through the third container through dependency injection.

[0035] In a possible design, the acquisition module is also used to acquire configuration instructions to configure the preset configuration file under the framework program according to the configuration instructions.

[0036] In a possible design, the acquisition module is also used to acquire configuration instructions to reconfigure the preset configuration file configured under the framework program according to the configuration instructions.

[0037] In a third aspect, an embodiment of the present application further provides an electronic device, including:

[0038] Processor; and

[0039] a memory for storing a computer program for the processor;

[0040] The processor is configured to implement any one of the external class loading methods in the first aspect by executing the computer program.

[0041] In a fourth aspect, an embodiment of the present application further provides a storage medium on which a computer program is stored, and when the program is executed by a processor, any one of the external class loading methods in the first aspect is implemented.

[0042] In a fifth aspect, an embodiment of the present application further provides a computer program product, including a computer program, which, when executed by a processor, implements any one of the external class loading methods in the first aspect.

[0043] The embodiments of the present application provide an external class loading method, apparatus, medium, device and program product, which detects that a preset configuration file is configured under a framework program, obtains the preset attribute configuration in the preset configuration file, and then loads the external loading class from the corresponding path of the environment where the preset application system is deployed according to the preset attribute configuration. When the application system needs to add a new functional program or modify an existing functional program, only the preset configuration file to be added or modified needs to be added, without rebuilding and deploying the framework program, thereby effectively reducing the time-consuming system redeployment and the management cost expenditure caused by the operation. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0045] Figure 1 is an application scenario diagram of an external class loading method according to an exemplary embodiment of the present application;

[0046] Figure 2 is a flowchart of an external class loading method according to an exemplary embodiment of the present application;

[0047] Figure 3 is a flowchart of an external class loading method according to another exemplary embodiment of the present application;

[0048] Figure 4is a schematic diagram of the structure of an external class loading device according to an exemplary embodiment of the present application;

[0049] Figure 5 It is a schematic diagram of the structure of an electronic device according to an exemplary embodiment of the present application. DETAILED DESCRIPTION

[0050] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0051] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0052] First, the terms involved in this application are explained:

[0053] Java: Java is an object-oriented programming language that is powerful and easy to use. As a representative of static object-oriented programming languages, Java implements object-oriented theory very well, allowing programmers to perform complex programming with an elegant way of thinking.

[0054] JVM: Java Virtual Machine, Java Virtual Machine, is a specification for computing devices. It is a fictional computer that simulates various computer functions on an actual computer. It is the basic environment that the runtime environment of Java applications depends on.

[0055] Web container: A Web container is a service program. There is a program that provides corresponding services on a port of the server, and this program processes requests sent from the client, such as the Tomcat container in JAVA and IBM's WebSphere.

[0056] WebSphere: WebSphere is IBM's software platform that includes the entire middleware infrastructure, such as servers, services, and tools, required to write, run, and monitor 24 / 7 industrial-strength on-demand Web applications and cross-platform, cross-product solutions.

[0057] Class loader: Java Classloader is part of the Java Runtime Environment and is responsible for dynamically loading Java classes into the memory space of the Java virtual machine. Classes are usually loaded on demand, that is, they are loaded only when the class is used for the first time.

[0058] External loading: By specifying a specific file system path, the class files under the path are loaded into the JVM.

[0059] External loading path: A specific file system path used to store class files or jar files that need to be loaded externally.

[0060] Spring: Spring is a lightweight inversion of control and aspect-oriented container framework.

[0061] JavaBean: JavaBean is a reusable component written in Java language. To write JavaBean, the class must be concrete and public and have a no-parameter constructor. JavaBean exposes member properties of internal domains by providing public methods that conform to consistent design patterns.

[0062] In the process of developing applications based on the Java technology stack, as the scale of applications continues to grow, the number of classes contained in a project grows rapidly. For packages that have been put into production and are already running stably, modifications to individual programs in the project, or the addition or deletion of individual applications, require the entire package to be rebuilt. In theory, the reconstruction of the package requires regression testing of the entire project, and the latest built package has to be redeployed in the production environment. As the scale of the program continues to grow, the implementation and management costs required to redeploy the package, especially for cluster deployment, are becoming increasingly high.

[0063] In the face of increasingly large and uncontrollable applications, splitting the application into reasonable modules and effectively decoupling the application framework-level code and specific function code will significantly enhance the flexibility of the application. At the same time, it can strengthen the stability of the main framework operation and avoid the failure of local program updates causing the entire application to be unavailable. In the face of abnormal updates of functional modules, when problems are found in the production environment, the version can be quickly rolled back or a repaired version can be deployed.

[0064] After the application structure is divided into the main framework and various application modules, an external class loading mechanism is required to achieve effective integration of functional module code and framework code.

[0065] At the same time, Java development based on the Spring framework has become the mainstream de facto development standard in the industry. Loading the functional module code of the application through an external path not only needs to meet the requirements of being correctly loaded and called by the JVM, but also needs to meet the requirements of being correctly managed by the Spring container to load the beans, and solve the problem of correctly registering and updating the external path class after loading and dependency injection with other beans.

[0066] For the above problem, one solution in the prior art is to directly modify the WEB-INF / lib file path under the WAR package deployment path after the application is deployed, directly replace the jar files that need to be updated, and directly add or delete the jar files that need to be added or deleted. Since the WEB-INF / lib path under the WAR package deployment path is the default class loading path of the Web container, the modification of the jar files under this path can be directly perceived by the application, and the update of class loading and the management of the Spring container will also take effect.

[0067] Another solution is to implement a custom class loader by inheriting Java's AppClassLoader to dynamically load class files or jar files into the JVM.

[0068] However, in the first solution mentioned above, directly modifying the WEB-INF / lib folder under the deployment path of the WAR package after the application is deployed usually requires the same user permissions as the WAR program deployment permissions. This permission is a specific operation permission of the WebSphere management system and is usually not open to application deployment personnel and operation and maintenance personnel. This control of this permission is necessary and reasonable. The deployment and normal operation and maintenance of the application should not have system-level management permissions to implement application-level operations. Therefore, in terms of the rationality of the operation and maintenance of the production system, the above solution is usually not feasible. It is difficult and should not be necessary to obtain this permission for regular deployment and emergency updates of the program.

[0069] In the second solution mentioned above, the application uses a custom class loader to load external class files or jar files to load classes into the JVM. Since the classes loaded by the custom class loader are different from the WebSphere container class loader, the classes loaded by the custom class loader cannot be recognized by other classes managed by the WebSphere container, so the problem of Bean registration and dependency injection cannot be solved. For programs that do not involve the Spring framework, class loading into the JVM and calling can be achieved, but Bean management cannot be achieved, which does not meet the requirements for Spring framework programs.

[0070] At present, the Spring framework, as a lightweight framework that is widely used in the Java field and has been proven to be very successful in practice, has become the de facto framework standard for current Java program development. Applications developed based on the Spring framework are managed by Spring containers for beans. Therefore, programs developed based on the Spring framework have higher requirements for dynamic Java class loading, that is, dynamically loaded classes must not only be correctly loaded and used by the JVM, but also meet the integrity requirements of the Spring container for bean management. That is, if the dynamically loaded class needs to be registered as a bean, the dynamic loading process needs to solve the problem of registering the bean with the Spring container and updating the dependency injection information of other beans for this loaded class.

[0071] The present application aims to customize an independent external class loading path for the main application of the application system based on the WebSphere container, load the independent class files or jar files under the path into the main application, and meet the Spring Bean management integrity requirements of the main application. That is, the WebSphere container where the mainstream Web application runs dynamically specifies a specific external file system path as the class loading path by obtaining the Web container class loader, loads the application jar file of the external file system into the JVM, and realizes the registration and dependency injection update of Spring Bean.

[0072] Figure 1 : is an application scenario diagram of an external class loading method according to an exemplary embodiment of the present application. Figure 1 As shown, the external class loading method provided by the present application is applied to a preset application system 100, which includes: a framework program 110 and at least one functional program, for example, a first functional program 121, a second functional program 122 and a third functional program 123, wherein each functional program implements its function based on a class. On the basis of the original functional program, a new functional program, such as an external loading class 124, can also be added.

[0073] Among them, generally speaking, in a complete application system, there is only one framework program, and there can be multiple functional programs. The functional program is loaded into the framework program through the external loading function of the device, and is combined with the framework program to provide external services. When the application system needs to add a new functional program or modify an existing functional program, it is only necessary to deploy the functional program package (jar file or class file) to be added or modified under the external loading path (or update and overwrite the original functional program package under the external loading path), without rebuilding and deploying the framework program. The deployment of the functional program is only a file migration operation, and the external loading path can be a path that can be accessed by ordinary users of the application program, without the need for application system user permissions or administrator users.

[0074] Figure 2 It is a flowchart of an external class loading method shown in the present application according to an example embodiment.

[0075] like Figure 2 As shown, the external class loading method provided in this embodiment includes:

[0076] Step 101: Detect that a preset configuration file is configured under the framework program.

[0077] Step 102: Obtain the preset attribute configuration in the preset configuration file.

[0078] Step 103: Load the external loading class from the corresponding path of the environment where the preset application system is deployed according to the preset attribute configuration.

[0079] In this embodiment, it can be detected that a preset configuration file is configured under the framework program, wherein, if it is detected that a preset configuration file is configured under the framework program, wherein the preset configuration file is used to configure the loading path information of the external loading class, for example: oac.properties configuration file. Then the preset property configuration in the preset configuration file is obtained, for example: batchjarspath4linux property configuration.

[0080] After detecting that a preset configuration file is configured under the framework program, the external loading class can be loaded from the corresponding path of the environment where the preset application system is deployed according to the preset property configuration.

[0081] In this embodiment, a special configuration file is set in the framework program of the preset application system, and its file name may be "oac.properties". The external loading path is configured in the batchjarspath4linux property of the file, and its value is the external loading path string. For example, the batchjarspath4linux property configuration in the oac.properties configuration file may be / appl / oacxapuser / oacpublib / . Then the preset application system provided by the present application will read the jar file or class file from the external path corresponding to / appl / oacxapuser / oacpublib / of the environment where the current preset application system is deployed and load it into the JVM. However, if the framework program is not configured with the oac.properties configuration file, the preset application system will not read any external path for external class loading when it is started. At this time, the preset application system will start normally without externally loaded classes.

[0082] In this embodiment, by detecting that a preset configuration file is configured under the framework program and obtaining the preset property configuration in the preset configuration file, the external loading class is loaded from the corresponding path of the environment where the preset application system is deployed according to the preset property configuration. When the application system needs to add a new functional program or modify an existing functional program, only the preset configuration file to be added or modified is needed, without rebuilding and deploying the framework program, which effectively reduces the time-consuming system redeployment and the management cost expenditure caused by the operation.

[0083] In addition, specifically, by obtaining the Web container's own class loader for reflection call, the external path pre-configured by the framework program is added to the class loading path of the JVM, so that the JVM will read the path when loading each jar and class file from the class loading path at startup, thereby achieving the goal of loading the jar files and class files in the external path into the JVM. At the same time, since the loading timing is earlier than the startup time of the Spring framework, the java classes involved in the externally loaded class and jar files are declared as Beans, which will automatically implement the container registration and dependency injection management of Beans. It can be seen that the external class loading method provided by this application fully reuses the loading mechanism of the container class loader, avoiding the problems that cannot be solved by dependency injection of custom class loaders and the manual registration of Spring container beans.

[0084] Figure 3 It is a flowchart of an external class loading method according to another example embodiment of the present application.

[0085] like Figure 3As shown, the external class loading method provided in this embodiment includes:

[0086] Step 301: Detect that a preset configuration file is configured under the framework program.

[0087] Step 302: Obtain the preset attribute configuration in the preset configuration file.

[0088] Step 303: According to the preset attribute configuration, the preset container class loader is called to load the preset bytecode file corresponding to the external loading class into the memory.

[0089] Step 304: While the virtual machine is running, security verification is performed on the preset bytecode file.

[0090] Step 305: If the verification is successful, the preset container class loader allocates memory for the class variables of the externally loaded class and performs initialization operations on the class variables.

[0091] Step 306: The virtual machine references the loading path information and executes the constructor of the externally loaded class.

[0092] Step 307: During the startup of the application system, by acquiring a preset container class loader, the loading path information is added to the scanning path of the application system to load the external loading class.

[0093] In this embodiment, it can be detected that a preset configuration file is configured under the framework program, wherein, if it is detected that a preset configuration file is configured under the framework program, wherein the preset configuration file is used to configure the loading path information of the external loading class, for example: oac.properties configuration file. Then the preset property configuration in the preset configuration file is obtained, for example: batchjarspath4linux property configuration.

[0094] After detecting that a preset configuration file is configured under the framework program, the external loading class can be loaded from the corresponding path of the environment where the preset application system is deployed according to the preset property configuration.

[0095] In this embodiment, a special configuration file is set in the framework program of the preset application system, and its file name may be "oac.properties". The external loading path is configured in the batchjarspath4linux property of the file, and its value is the external loading path string. For example, the batchjarspath4linux property configuration in the oac.properties configuration file may be / appl / oacxapuser / oacpublib / . Then the preset application system provided by the present application will read the jar file or class file from the external path corresponding to / appl / oacxapuser / oacpublib / of the environment where the current preset application system is deployed and load it into the JVM. However, if the framework program is not configured with the oac.properties configuration file, the preset application system will not read any external path for external class loading when it is started. At this time, the preset application system will start normally without externally loaded classes.

[0096] After detecting that the oac.properties file is correctly configured, the class loading operation in the external loading path can be performed as follows:

[0097] First, according to the preset attribute configuration, the preset container class loader is called to load the preset bytecode file corresponding to the external loading class into the memory. Specifically, the Class bytecode file can be loaded into the memory after calling the loading method of the WebSphere container class loader.

[0098] Then, in the running state of the virtual machine, the security of the preset bytecode file is verified. Specifically, after calling the loading method of the WebSphere container class, the binary code of the Java class is merged into the running state of the JVM to ensure that the loaded class information complies with the virtual machine specification and has no security issues.

[0099] Then, if the verification is passed, the preset container class loader allocates memory for the class variables of the externally loaded class and initializes the class variables. Specifically, the Web container class loader can be used to allocate memory for the class variables of the class to be loaded and initialize these variables.

[0100] Then, the virtual machine references the loading path information and executes the constructor of the externally loaded class. Specifically, the JVM replaces the symbolic reference of the constant with the real address reference, and at this stage, the constructor of the Web container class loader will be executed.

[0101] Finally, during the startup of the application system, the loading path information is added to the scanning path of the application system by obtaining the preset container class loader to load the external loading class.

[0102] In the above embodiment, for the application system startup process, the first container, the second container and the third container may be started in sequence, so that in the initialization phase of the third container, by obtaining the preset container class loader, the loading path information is added to the scanning path of the application system to load the external loading class. Among them, the first container may be a Web Container, the second container may be a Servelet Container, and the third container may be a Spring Context. Among them, in the initialization phase of the third container, the preset reusable components are registered and dependency injection updated through the third container. Specifically, in the initialization phase of the Spring container, by obtaining the class loader of the WebSphere container, the custom external loading path value is added to the class scanning path, so that the external class under the external loading path is loaded into the JVM by the class loader.

[0103] Figure 4 It is a structural diagram of an external class loading device shown in the present application according to an example embodiment.

[0104] like Figure 4 As shown, the external class loading device 400 provided in this embodiment includes:

[0105] The acquisition module 401 is used to acquire the preset attribute configuration in the preset configuration file when it is detected that a preset configuration file is configured under the framework program, and the preset configuration file is used to configure the loading path information of the external loading class;

[0106] The processing module 402 is used to load the external loading class from the corresponding path of the environment where the preset application system is deployed according to the preset attribute configuration.

[0107] In a possible design, the processing module 402 is specifically configured to:

[0108] According to the preset attribute configuration, a preset container class loader is called to load the preset bytecode file corresponding to the external loading class into the memory;

[0109] In the running state of the virtual machine, performing security verification on the preset bytecode file;

[0110] If the verification is successful, the preset container class loader allocates memory to the class variables of the externally loaded class and performs initialization operations on the class variables;

[0111] The virtual machine references the loading path information and executes the constructor of the externally loaded class;

[0112] During the startup of the application system, the loading path information is added to the scanning path of the application system by acquiring the preset container class loader to load the external loading class.

[0113] In a possible design, the processing module 402 is specifically configured to:

[0114] The first container, the second container and the third container are started in sequence, and in the initialization phase of the third container, the loading path information is added to the scanning path of the application system by acquiring the preset container class loader to load the external loading class.

[0115] In a possible design, the processing module 402 is further used to: during the initialization phase of the third container, register and update the preset reusable component through the third container through dependency injection.

[0116] In a possible design, the acquisition module 401 is further used to acquire configuration instructions to configure the preset configuration file under the framework program according to the configuration instructions.

[0117] In a possible design, the acquisition module 401 is further used to acquire configuration instructions to reconfigure the preset configuration file configured under the framework program according to the configuration instructions.

[0118] The external class loading device provided in this embodiment can be used to execute the steps in the above method embodiment. For details not disclosed in the device embodiment of this application, please refer to the method embodiment of this application.

[0119] Figure 5 is a schematic diagram of the structure of an electronic device according to an exemplary embodiment of the present application. Figure 5 As shown, this embodiment provides an electronic device 500, including:

[0120] processor 501; and,

[0121] A memory 502, used to store executable instructions of the processor, and the memory may also be a flash memory;

[0122] The processor 501 is configured to execute each step in the above method by executing the executable instructions.

[0123] Optionally, the memory 502 may be independent or integrated with the processor 501 .

[0124] When the memory 502 is a device independent of the processor 501, the electronic device 500 may further include:

[0125] The bus 503 is used to connect the processor 501 and the memory 502 .

[0126] This embodiment further provides a readable storage medium, in which a computer program is stored. When at least one processor of an electronic device executes the computer program, the electronic device executes each step in the above method.

[0127] This embodiment also provides a program product, which includes a computer program stored in a readable storage medium. At least one processor of the electronic device can read the computer program from the readable storage medium, and at least one processor executes the computer program so that the electronic device implements each step in the above method.

[0128] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.

[0129] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. An external class loading method, characterized in that: Applied to a preset application system, the preset application system includes: a framework program and at least one functional program, the functional program implements functions based on classes; the method includes: If it is detected that a preset configuration file is configured under the framework program, then the preset attribute configuration in the preset configuration file is obtained, and the preset configuration file is used to configure the loading path information of the external loading class; Loading an external loading class from a corresponding path in the environment where the preset application system is deployed according to the preset attribute configuration; The step of loading the external loading class from the corresponding path of the environment where the preset application system is deployed according to the preset attribute configuration includes: According to the preset attribute configuration, a preset container class loader is called to load the preset bytecode file corresponding to the external loading class into the memory; In the running state of the virtual machine, performing security verification on the preset bytecode file; If the verification is successful, the preset container class loader allocates memory to the class variables of the externally loaded class and performs initialization operations on the class variables; The virtual machine references the loading path information and executes the constructor of the externally loaded class; During the startup of the application system, the loading path information is added to the scanning path of the application system by acquiring the preset container class loader to load the external loading class; The application system startup process includes: The first container, the second container and the third container are started in sequence, so that in the initialization phase of the third container, the loading path information is added to the scanning path of the application system by acquiring the preset container class loader to load the external loading class; During the startup of the application system, after the loading path information is added to the scanning path of the application system by acquiring the preset container class loader to load the external loading class, the method further includes: During the initialization phase of the third container, the preset reusable component is registered and updated through dependency injection through the third container.

2. The external class loading method according to claim 1, characterized in that: Also includes: Acquire configuration instructions to configure the preset configuration file under the framework program according to the configuration instructions.

3. The external class loading method according to claim 1, characterized in that: Also includes: A configuration instruction is obtained to reconfigure the preset configuration file configured under the framework program according to the configuration instruction.

4. An external class loading device, characterized in that: include: An acquisition module, used for acquiring a preset attribute configuration in a preset configuration file when detecting that a preset configuration file is configured under the framework program, wherein the preset configuration file is used to configure loading path information of an external loading class; A processing module, configured to load an external loading class from a corresponding path of an environment where a preset application system is deployed according to the preset attribute configuration; The processing module is specifically configured to call a preset container class loader according to the preset attribute configuration to load the preset bytecode file corresponding to the external loading class into the memory; In the running state of the virtual machine, performing security verification on the preset bytecode file; If the verification is successful, the preset container class loader allocates memory to the class variables of the externally loaded class and performs initialization operations on the class variables; The virtual machine references the loading path information and executes the constructor of the externally loaded class; During the startup of the application system, the loading path information is added to the scanning path of the application system by acquiring the preset container class loader to load the external loading class; The processing module is specifically used to start the first container, the second container and the third container in sequence, so as to obtain the preset container class loader in the initialization stage of the third container, add the loading path information to the scanning path of the application system, and load the external loading class; The processing module is further used to register and update the preset reusable components through the third container through dependency injection during the initialization phase of the third container.

5. An electronic device, characterized in that: include: processor; as well as a memory for storing a computer program for the processor; The processor is configured to implement the external class loading method according to any one of claims 1 to 3 by executing the computer program.

6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the external class loading method according to any one of claims 1 to 3 is implemented.

7. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the external class loading method according to any one of claims 1 to 3 is implemented.