Application loading method, device, storage medium and electronic device
By creating a loader for each third-party dependency package, the problem of class library version conflicts between different third-party dependency packages is solved, lightweight class isolation and stability are achieved, dependency management is simplified, and the maintainability of the system is improved. sex.
Patent Information
- Application Number
- CN202010819784.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-14
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2040-08-14
AI Technical Summary
Different third-party dependency packages may rely on different versions of the same class library, resulting in runtime class conflict errors. Existing solutions such as centralized dependency management and renaming dependency packages have the disadvantages of heavy workload, high cost and poor maintainability. question.
By creating a corresponding third-party loader for each third-party dependency package, each dependency package is loaded separately to avoid class conflicts. Class isolation containers and packaging tools are used for modular development to ensure that each module uses the version it needs without affecting other modules. module.
It achieves lightweight class isolation, reduces the workload of relying on version management, avoids class conflict errors, improves the stability and maintainability of the system, and simplifies the development and operation and maintenance processes.
Smart Images

Figure CN112052044B
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to an application loading method, device, storage medium and electronic device. Background Art
[0002] As various computer languages are increasingly used in the Internet and related fields, a large number of basic libraries written in computer languages have emerged for various applications to choose from. Almost every application cannot avoid relying on a large number of third-party dependency packages. In addition, the content of current projects is becoming more and more complex and the functions are becoming more and more rich, requiring modular development with multi-team collaboration. With the development and popularization of microservices, various frameworks and middleware technologies are also widely used in major companies. With the development of these technologies, a very urgent problem faced by applications is that different third-party dependency packages may rely on different versions of the same class library, and class conflict errors may occur at runtime, causing application exceptions and failure to provide services. Summary of the invention
[0003] In order to solve the above problems, the embodiments of the present application provide an application loading method, device, storage medium and electronic device, which can avoid class conflict errors when the program is running. The technical solution is as follows:
[0004] In a first aspect, an embodiment of the present application provides an application loading method, comprising the following steps:
[0005] Obtain at least one third-party dependency package that the target application depends on;
[0006] Create a third-party loader corresponding to each of the third-party dependency packages;
[0007] The third-party dependency packages corresponding to each of the third-party loaders are loaded respectively through the third-party loaders.
[0008] In a second aspect, an embodiment of the present application provides an application loading device, including:
[0009] A package acquisition unit, used to acquire at least one third-party dependency package that the target application depends on;
[0010] A loader creation unit, used to create a third-party loader corresponding to each of the third-party dependency packages;
[0011] The package loading unit is used to load the third-party dependency packages corresponding to each of the third-party loaders respectively through the third-party loaders.
[0012] In a third aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of any of the above methods when executed by a processor.
[0013] In a fourth aspect, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any one of the above methods when executing the program.
[0014] Different third-party dependency packages may rely on different versions of the same class library. When multiple third-party dependency packages are loaded by the same loader, class conflict errors may occur at runtime. In an embodiment of the present application, each third-party dependency package is loaded separately by a third-party loader corresponding to each third-party dependency package, thereby avoiding the error problem of class conflict caused by different third-party dependency packages relying on different versions of the same class library. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 A flowchart of an application loading method provided in an embodiment of the present application;
[0016] Figure 2 A flowchart of another application loading method provided in an embodiment of the present application;
[0017] Figure 3 A schematic diagram of a process of container startup and class loading provided in an embodiment of the present application;
[0018] Figure 4 A schematic diagram of the structure of an application loading device provided in an embodiment of the present application;
[0019] Figure 5 A schematic diagram of the structure of an electronic device involved in an embodiment of the present application. DETAILED DESCRIPTION
[0020] The present application is further described below in conjunction with the accompanying drawings and embodiments.
[0021] In the following introduction, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance. The following introduction provides multiple embodiments of the present application, and different embodiments can be replaced or combined, so the present application can also be considered to include all possible combinations of the same and / or different embodiments recorded. Therefore, if one embodiment includes features A, B, and C, and another embodiment includes features B and D, then the present application should also be considered to include embodiments containing one or more of all other possible combinations of A, B, C, and D, although the embodiment may not be clearly recorded in the following text.
[0022] The following description provides examples and does not limit the scope, applicability or examples set forth in the claims. Changes may be made to the functions and arrangements of the elements described without departing from the scope of the present application. Various processes or components may be appropriately omitted, substituted or added to each example. For example, the described method may be performed in an order different from the order described, and various steps may be added, omitted or combined. In addition, features described in some examples may be combined in other examples.
[0023] Different third-party dependency packages may rely on different versions of the same class library, and class conflict errors may occur during runtime. To solve the above problems, you can use the project to perform centralized dependency management. Each third-party dependency package only retains one version in the project, and the person in charge defines the version list of the dependency package used by this project, and all modules must abide by this rule. The main disadvantages of the above solution are: the workload of unified dependency management is very large, and the third-party dependency package versions that each module depends on may not be compatible, resulting in a module having to modify its own code due to upgrading the version of the dependency package. The time cost of communicating and unifying each dependency package version is too expensive; each time a module is added or a module is updated, it is necessary to redo the version check of the third-party dependency package. In addition to the time cost, the quality of the software is difficult to guarantee, and it is likely to cause exceptions during runtime.
[0024] You can also solve the class conflict problem caused by referencing multiple third-party dependency packages in the following way. Each third-party module uses a packaging plug-in to repackage the dependent package after changing the package name. This can avoid the appearance of classes and packages with the same name. The main disadvantage of the above solution is that renaming the third-party dependency package will cause very confusing dependency management, and after modifying some basic third-party dependency package names, the upper-level packages that depend on it have to be repackaged. The recursive packaging operation will make the project very confusing, and the usability and maintainability will not be guaranteed at all.
[0025] Based on the above analysis, the embodiment of the present application proposes an application loading solution, which can conveniently implement lightweight class isolation. The project no longer needs to maintain the same list of dependent versions. Each application module uses the version it needs without affecting each other. It is simple and stable. Figure 1 , Figure 1 A schematic diagram of a flow chart of an application loading method provided in an embodiment of the present application, the method comprising:
[0026] S101. Obtain at least one third-party dependency package that a target application depends on.
[0027] The third-party dependency packages that the target application depends on are third-party dependency packages that the target application needs to load or call during operation. The third-party dependency packages may include code packages, middleware packages, framework packages, etc. that perform specific functions.
[0028] The third-party dependency package that the target application depends on can be obtained based on the code of the target application, or based on the packaged code package of the target application. The embodiment of the present application does not limit the method for obtaining the third-party dependency package that the target application depends on.
[0029] S102: Create a third-party loader corresponding to each third-party dependency package.
[0030] The number of third-party loaders is the same as the number of third-party dependency packages. There is a one-to-one correspondence between third-party loaders and third-party dependency packages.
[0031] The loader is used to load the program and place it in the memory so that the program can start running. The steps of loading the program include reading the executable file, writing the contents of the executable file into the memory, and completing other necessary preparations. When the loading is completed, the operating system will hand over control to the loaded program and let the program start running.
[0032] S103: Load the third-party dependency packages corresponding to each third-party loader respectively through the third-party loader.
[0033] The third-party loader corresponding to each third-party dependency package is used to load the corresponding third-party dependency package. By using at least one third-party loader, each third-party dependency package is loaded in an isolated state, thereby eliminating the class conflict problem.
[0034] Further, S103 may include:
[0035] Loading the first-class third-party dependency packages corresponding to each of the third-party loaders respectively through the third-party loader, where the first-class third-party dependency packages correspond to the loaded classes;
[0036] and / or, loading the second-category third-party dependency packages corresponding to each of the third-party loaders respectively through the third-party loader, wherein the second-category third-party dependency packages correspond to classes in the software development kit;
[0037] and / or, loading the third-party dependency packages of the third category corresponding to each of the third-party loaders respectively through the third-party loader, wherein the third-party dependency packages of the third category correspond to classes in other third-party dependency packages called by the third-party dependency packages;
[0038] and / or, respectively loading, through the third-party loader, a fourth-category third-party dependency package corresponding to each of the third-party loaders, the fourth-category third-party dependency package corresponding to a class of the third-party dependency package itself;
[0039] And / or, a fifth type of third-party dependency package corresponding to each of the third-party loaders is loaded respectively through the third-party loader, and the fifth type of third-party dependency package corresponds to a class in the language proxy module.
[0040] The third-party dependency packages may include the first type of third-party dependency packages, the second type of third-party dependency packages, the third type of third-party dependency packages, the fourth type of third-party dependency packages, and the fifth type of third-party dependency packages. By dividing the third-party dependency packages into different types of code packages, the loading process of the third-party dependency packages can be made more efficient.
[0041] Further, S103 may include:
[0042] In the order of the first category of third-party dependency packages, the second category of third-party dependency packages, the third category of third-party dependency packages, the fourth category of third-party dependency packages and the fifth category of third-party dependency packages, the third-party dependency packages corresponding to each third-party loader are loaded respectively through the third-party loader.
[0043] The third-party dependency packages may include the first type of third-party dependency packages, the second type of third-party dependency packages, the third type of third-party dependency packages, the fourth type of third-party dependency packages, and the fifth type of third-party dependency packages. By dividing the third-party dependency packages into different types of code packages and loading them in sequence, the running speed of the target application can be improved and system resources can be saved.
[0044] Furthermore, the method further comprises:
[0045] Create an application loader;
[0046] The code package of the target application is loaded through the application loader.
[0047] The target application code may call a class library, and the version of the class library called by the target application is different from the version of the class library referenced in the third-party dependency package. Alternatively, the target application code package may define multiple classes, and the names of the classes in the target application may be the same as the names of the classes in multiple third-party dependency packages. Therefore, if the same loader is used to load the third-party dependency package and the target application code package, class conflicts may also occur.
[0048] In the embodiment of the present application, different loaders are used to load the code package of the target application and the third-party dependency package respectively, which can solve the problem of conflict between the classes called or defined in the target application and the classes in the third-party dependency package.
[0049] Further, the loading of the code package of the target application by the application loader includes:
[0050] Loading a first category of application code packages through the application loader, where the first category of application code packages corresponds to a loaded class;
[0051] and / or, loading a second type of application code package through the application loader, the second type of application code package corresponding to a class in a software development kit;
[0052] and / or, loading a third category application code package through the application loader, wherein the third category application code package corresponds to a class in other third-party dependency packages;
[0053] and / or, loading a fourth category application code package through the application loader, the fourth category application code package corresponding to a class in the own module;
[0054] And / or, a fifth type of application code package is loaded through the application loader, and the fifth type of application code package corresponds to a class in the language agent module.
[0055] The target application code package may include the first application code package, the second application code package, the third application code package, the fourth application code package and the fifth application code package. By dividing the target application code package into different categories of code packages, the loading process of the target application code package can be made more efficient.
[0056] Further, the loading of the code package of the target application by the application loader includes:
[0057] The code package of the target application is loaded by the application loader in the order of the first category application code package, the second category application code package, the third category application code package, the fourth category application code package and the fifth category application code package.
[0058] The code packages of the target application may include the first category application code packages, the second category application code packages, the third category application code packages, the fourth category application code packages and the fifth category application code packages. By dividing the code packages of the target application into different categories of code packages and loading them in sequence, the running speed of the target application can be improved and system resources can be saved.
[0059] The program loading method provided in the embodiment of the present application can avoid class conflict errors caused by different versions of the same class library being relied upon by different third-party dependency packages, thereby ensuring the smooth execution of the target application.
[0060] See also Figure 2 , Figure 2A flowchart of another application loading method provided in an embodiment of the present application, the method comprising:
[0061] S201. Obtain at least one third-party dependency package that the target application depends on.
[0062] The method of the embodiment of the present application can be applied to an application developer who uses a third-party dependency package to develop a project. First, obtain at least one third-party dependency package that the target application depends on. The third-party dependency package may have a specific format to facilitate the packaging process of the following step S202.
[0063] Furthermore, the providers of the third-party dependency packages may be middleware developers or independent business module developers, etc. These providers may reference the class isolation container packaging tool in the project engineering and package the code into a package in the first format during the project packaging phase.
[0064] The class isolation container packaging tool is a tool that can be used by the provider of the third-party dependency package to package related codes into a package in the first format.
[0065] S202: Package the target application code and the at least one third-party dependency package into a code package in a predetermined format.
[0066] The developer of the target application may package the code of the target application and the third-party dependency package obtained in step S201 into a code package in a predetermined second format.
[0067] It should be noted that the code package in the first format and the code package in the second format may have the same format or different formats, which can achieve the packaging purpose of the embodiment of the present application, and the third-party dependency package that the target application depends on can be obtained through the following S203.
[0068] Furthermore, the developer of the target application may reference the class isolation container packaging tool in the project engineering, and package the code of the target application into a package in the second format during the project packaging phase.
[0069] The class isolation container packaging tool can also be used by the developer of the above-mentioned target application to package related codes into a package in the second format.
[0070] S203: Based on the code package in the predetermined format, obtain at least one third-party dependency package that the target application depends on.
[0071] S204: Create a third-party loader corresponding to each third-party dependency package.
[0072] S205. Load the third-party dependency packages corresponding to each of the third-party loaders respectively through the third-party loaders.
[0073] In the application loading method provided in the embodiment of the present application, a packaging method is proposed, which can package the target application into a predetermined format, so that when the target application is running, different third-party dependency packages that the target application depends on can be loaded using multiple separate loaders through packages in the predetermined format, thereby avoiding the possibility of class conflicts and solving the problem of class conflicts conveniently and efficiently.
[0074] The present application also provides a packaging method, including:
[0075] The third-party module is packaged into a third-party dependency package in a first predetermined format, and the third-party code package is packaged with the code of the target application into a code package in a second predetermined format. The code package in the second predetermined format is used to obtain at least one third-party dependency package that the target application depends on, and each third-party loader is loaded separately through the third-party loader corresponding to each third-party dependency package.
[0076] The above packaging method provided in the embodiment of the present application can be applied to the provider of the third-party dependency package. The provider of the third-party dependency package can be a middleware developer or an independent business module developer, etc. These providers can refer to the class isolation container packaging tool in the project engineering, and package the code into a third-party dependency package in the first format during the project packaging stage.
[0077] Furthermore, the providers of the third-party dependency packages may be middleware developers or independent business module developers, etc. These providers may reference the class isolation container packaging tool in the project engineering and package the code into a package in the first format during the project packaging phase.
[0078] The class isolation container packaging tool is a tool that can be used to package the relevant codes of the provider of the third-party dependency package into a package in the first format.
[0079] Application developers can package the third-party dependency packages in the first format into code packages in the second format. During the project operation phase, different third-party dependency packages that the target application depends on can be obtained based on the code packages in the second format, and loaded using multiple separate loaders, thereby avoiding the occurrence of class conflicts.
[0080] To make the method of the embodiment of the present application easier to understand, a specific implementation process is explained in Java language below. The solution of the embodiment of the present application introduces the concept of class isolation container (Container) and provides a modular development solution based on loader (Classloader). It can be widely used in project development that relies on multiple modules.
[0081] For example, in a microservice-based architecture, applications often rely on independent modules such as service-oriented frameworks and database middleware. There is a high probability that there will be conflicts in dependency packages between the business dependencies and the various middleware modules. This technology product can solve this problem quickly and easily.
[0082] Users of the solution of the embodiments of the present application may include module developers and application developers.
[0083] Module developers, such as middleware developers or independent business module developers, refer to the class isolation container packaging tool in the project engineering, and package the code into the required first format jar package during the project packaging phase. The packaging process is automatically completed by the tool, and users do not have to do any development work.
[0084] Application developers, such as developers who use middleware to complete the development of other business modules, use the third-party dependency jar packages in a specific format packaged by application module developers for development during the development phase, and introduce the jar package of the class isolation container at the same time, and use the packaging tool provided by the class isolation container to package the code and dependencies into a jar package in the second format.
[0085] Application developers can use the application startup method to start the process corresponding to the jar package in the second format. For example, by entering the command "java-jar application.jar", the function of isolating and loading the third-party dependent packages in the second format is automatically realized. The implementation of the entire class isolation loading is transparent to the user, and the application developer does not need to modify the code.
[0086] Figure 3 A schematic diagram of a process of container startup and class loading provided in an embodiment of the present application. Figure 3 As shown in the figure, the detailed operation process inside the class isolation container is as follows:
[0087] Step 1: After the container is started, first scan all third-party dependency packages in the class path to find all third-party dependency packages (Plugin) generated using specific packaging technology;
[0088] Step 2: Create a PluginClassLoader for each third-party dependency package, use this Classloader to load the exported classes in the third-party package, and save them to SharedClassLoader;
[0089] Step 3: Generate a BizClassLoader for the business code to load the business's own classes and other third-party dependency packages called by the business.
[0090] The class loading order is: classes in the cache of this Classloader --> classes in the JDK class library --> exported classes of Plugin --> classes in this Plugin package --> JavaAgent class.
[0091] The Plugin module is used to export classes in third-party dependency packages or other third-party dependency packages called in the target application. The Biz module is used to export classes in third-party dependency packages or its own modules in the target application.
[0092] The method provided in the embodiment of the present application allows business developers to focus on business-related matters without having to worry about class conflicts between different modules. The method provided in the embodiment of the present application has the beneficial effects of reducing the communication and coordination costs of developers, reducing the possibility of abnormalities during operation, reducing the troubleshooting difficulty of development and operation personnel, and improving the stability of services.
[0093] See also Figure 4 , Figure 4 Schematic diagram of the structure of an application loading device provided in an embodiment of the present application. Figure 4 As shown, the application loading device includes:
[0094] A package acquisition unit 401 is used to acquire at least one third-party dependency package that the target application depends on;
[0095] A loader creation unit 402, used to create a third-party loader corresponding to each of the third-party dependency packages;
[0096] The package loading unit 403 is used to load the third-party dependency packages corresponding to each of the third-party loaders respectively through the third-party loaders.
[0097] Furthermore, the package loading unit 403 is specifically used for:
[0098] Loading the first-class third-party dependency packages corresponding to each of the third-party loaders respectively through the third-party loader, where the first-class third-party dependency packages correspond to the loaded classes;
[0099] and / or, loading the second-category third-party dependency packages corresponding to each of the third-party loaders respectively through the third-party loader, wherein the second-category third-party dependency packages correspond to classes in the software development kit;
[0100] and / or, loading the third-party dependency packages of the third category corresponding to each of the third-party loaders respectively through the third-party loader, wherein the third-party dependency packages of the third category correspond to classes in other third-party dependency packages called by the third-party dependency packages;
[0101] and / or, respectively loading, through the third-party loader, a fourth-category third-party dependency package corresponding to each of the third-party loaders, the fourth-category third-party dependency package corresponding to a class of the third-party dependency package itself;
[0102] And / or, a fifth type of third-party dependency package corresponding to each of the third-party loaders is loaded respectively through the third-party loader, and the fifth type of third-party dependency package corresponds to a class in the language proxy module.
[0103] Furthermore, the package loading unit 403 is specifically used for:
[0104] In the order of the first category of third-party dependency packages, the second category of third-party dependency packages, the third category of third-party dependency packages, the fourth category of third-party dependency packages and the fifth category of third-party dependency packages, the third-party dependency packages corresponding to each third-party loader are loaded respectively through the third-party loader.
[0105] Furthermore, the device also includes:
[0106] An application loading unit 404, used to create an application loader;
[0107] The code package of the target application is loaded through the application loader.
[0108] Furthermore, the application loading unit 404 is specifically used for:
[0109] Loading a first category of application code packages through the application loader, where the first category of application code packages corresponds to a loaded class;
[0110] and / or, loading a second type of application code package through the application loader, the second type of application code package corresponding to a class in a software development kit;
[0111] and / or, loading a third category application code package through the application loader, wherein the third category application code package corresponds to a class in other third-party dependency packages;
[0112] and / or, loading a fourth category application code package through the application loader, the fourth category application code package corresponding to a class in the own module;
[0113] And / or, a fifth type of application code package is loaded through the application loader, and the fifth type of application code package corresponds to a class in the language agent module.
[0114] Furthermore, the application loading unit 404 is specifically used for:
[0115] The code package of the target application is loaded by the application loader in the order of the first category application code package, the second category application code package, the third category application code package, the fourth category application code package and the fifth category application code package.
[0116] Furthermore, the device also includes:
[0117] A packaging unit 405 is used to obtain at least one third-party dependency package that the target application depends on;
[0118] Packing the target application code and the at least one third-party dependency package into a code package in a predetermined format;
[0119] The packet acquisition unit 401 is specifically used for:
[0120] Based on the code package in the predetermined format, at least one third-party dependency package that the target application depends on is obtained.
[0121] Those skilled in the art can clearly understand that the technical solutions of the embodiments of the present application can be implemented with the help of software and / or hardware. The "unit" and "module" in this specification refer to software and / or hardware that can independently complete or cooperate with other components to complete specific functions, where the hardware can be, for example, FPGA (Field-Programmable Gate Array), IC (Integrated Circuit), etc.
[0122] Each processing unit and / or module of the embodiments of the present application may be implemented by an analog circuit that implements the functions described in the embodiments of the present application, or may be implemented by software that executes the functions described in the embodiments of the present application.
[0123] The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the steps of the above-mentioned application loading method are implemented. The computer-readable storage medium may include, but is not limited to, any type of disk, including a floppy disk, an optical disk, a DVD, a CD-ROM, a micro drive, and a magneto-optical disk, a ROM, a RAM, an EPROM, an EEPROM, a DRAM, a VRAM, a flash memory device, a magnetic card or an optical card, a nanosystem (including a molecular memory IC), or any type of medium or device suitable for storing instructions and / or data.
[0124] See also Figure 5 , which shows a schematic diagram of the structure of an electronic device involved in an embodiment of the present application, and the electronic device can be used to implement the application loading method provided in the above embodiment. Specifically:
[0125] The memory 1020 can be used to store software programs and modules, and the processor 1080 executes various functional applications and data processing by running the software programs and modules stored in the memory 1020. The memory 1020 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the terminal device (such as audio data, a phone book, etc.), etc. In addition, the memory 1020 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 1020 may also include a memory controller to provide the processor 1080 and the input unit 1030 with access to the memory 1020.
[0126] The input unit 1030 can be used to receive input digital or character information, and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control. Specifically, the input unit 1030 may include a touch-sensitive surface 1031 (e.g., a touch screen, a touch pad or a touch frame). The touch-sensitive surface 1031, also known as a touch display screen or a touch pad, can collect user touch operations on or near it (e.g., operations performed by a user using a finger, a stylus or any other suitable object or accessory on or near the touch-sensitive surface 1031), and drive the corresponding connection device according to a pre-set program. Optionally, the touch-sensitive surface 1031 may include a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into touch point coordinates, and then sends it to the processor 1080, and can receive and execute commands sent by the processor 1080. In addition, the touch-sensitive surface 1031 can be implemented using various types such as resistive, capacitive, infrared, and surface acoustic wave.
[0127] The display unit 1040 can be used to display information input by the user or information provided to the user and various graphical user interfaces of the terminal device, which can be composed of graphics, text, icons, videos and any combination thereof. The display unit 1040 may include a display panel 1041. Optionally, the display panel 1041 may be configured in the form of LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode), etc. Further, the touch-sensitive surface 1031 may cover the display panel 1041. When the touch-sensitive surface 1031 detects a touch operation on or near it, it is transmitted to the processor 1080 to determine the type of the touch event, and then the processor 1080 provides a corresponding visual output on the display panel 1041 according to the type of the touch event. Although the touch-sensitive surface 1031 and the display panel 1041 can be implemented as two independent components to implement input and output functions, in some embodiments, the touch-sensitive surface 1031 can be integrated with the display panel 1041 to implement input and output functions.
[0128] The processor 1080 is the control center of the terminal device. It uses various interfaces and lines to connect various parts of the entire terminal device. By running or executing software programs and / or modules stored in the memory 1020 and calling data stored in the memory 1020, it executes various functions of the terminal device and processes data, thereby monitoring the terminal device as a whole. Optionally, the processor 1080 may include one or more processing cores; wherein the processor 1080 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface and application programs, etc., and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 1080.
[0129] Specifically in this embodiment, the display unit of the terminal device is a touch screen display, and the terminal device also includes a memory, and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors. The one or more programs include steps to implement the above-mentioned application loading method.
[0130] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0131] The functional units in the embodiments of the present application may all be integrated into one processing unit, or each unit may be a separate unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0132] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. An application loading method, characterized in that: The method comprises: Obtain at least one third-party dependency package that the target application depends on; the third-party dependency package is determined based on a code package in a second predetermined format, and the code package in the second predetermined format is obtained by packaging the code of the target application and the third-party dependency package in a first predetermined format; Creating a third-party loader corresponding to each third-party dependency package; wherein the third-party loader and the third-party dependency package are in a one-to-one correspondence; the third-party dependency package corresponding to each third-party loader includes: a class of the first category, a class of the second category, a class of the third category, a class of the fourth category, and a class of the fifth category; Load the third-party dependency packages corresponding to each of the third-party loaders respectively through the third-party loader; The third-party dependency packages corresponding to each third-party loader are loaded respectively through the third-party loader, including: According to the order of the first category of classes, the second category of classes, the third category of classes, the fourth category of classes and the fifth category of classes, the third category of classes corresponding to each third-party dependency package corresponding to the third-party loader is loaded respectively by the third-party loader; wherein the first category of classes corresponds to the loaded classes, the second category of classes corresponds to the classes in the software development kit, the third category of classes corresponds to the classes in other third-party dependency packages called by the third-party dependency package, the fourth category of classes corresponds to the classes of the third-party dependency package itself, and the fifth category of classes corresponds to the classes in the language proxy module; Create an application loader; Loading the code package of the target application through the application loader; wherein the code package of the target application includes: classes of the first category, classes of the second category, classes of the third category, classes of the fourth category, and classes of the fifth category; The step of loading the code package of the target application by the application loader includes: The code package of the target application is loaded by the application loader in the order of the classes of the first category in the code package of the target application, the classes of the second category in the code package of the target application, the classes of the third category in the code package of the target application, the classes of the fourth category in the code package of the target application, and the classes of the fifth category in the code package of the target application; wherein the classes of the first category in the code package of the target application correspond to the classes that have been loaded, the classes of the second category in the code package of the target application correspond to the classes in the software development kit, the classes of the third category in the code package of the target application correspond to the classes in other third-party dependent packages, the classes of the fourth category in the code package of the target application correspond to the classes in its own module, and the classes of the fifth category in the code package of the target application correspond to the classes in the language agent module.
2. The method according to claim 1, characterized in that The method further comprises: Acquire at least one third-party dependency package in the first predetermined format that the target application depends on; The code of the target application and the at least one third-party dependency package in the first predetermined format are packaged into a code package in the second predetermined format through a class isolation container packaging tool.
3. An application loading device, characterized in that: The device comprises: a package acquisition unit, configured to acquire at least one third-party dependency package on which the target application depends; the third-party dependency package is determined based on a code package in a second predetermined format, wherein the code package in the second predetermined format is obtained by packaging the code of the target application and the third-party dependency package in a first predetermined format; A loader creation unit, used to create a third-party loader corresponding to each of the third-party dependency packages; wherein the third-party loader and the third-party dependency package are in a one-to-one correspondence; the third-party dependency package corresponding to each of the third-party loaders includes: a class of the first category, a class of the second category, a class of the third category, a class of the fourth category, and a class of the fifth category; A package loading unit, used to load the third-party dependency packages corresponding to each of the third-party loaders respectively through the third-party loader; The package loading unit is further used to: load the third-party dependency packages corresponding to each third-party loader respectively through the third-party loader in the order of the first class of classes, the second class of classes, the third class of classes, the fourth class of classes and the fifth class of classes; wherein the first class of classes corresponds to the loaded classes, the second class of classes corresponds to the classes in the software development kit, the third class of classes corresponds to the classes in other third-party dependency packages called by the third-party dependency package, the fourth class of classes corresponds to the classes of the third-party dependency package itself, and the fifth class of classes corresponds to the classes in the language proxy module; An application loading unit, used to create an application loader; The application loading unit is further used to load the code package of the target application through the application loader; wherein the code package of the target application includes: classes of the first category, classes of the second category, classes of the third category, classes of the fourth category, and classes of the fifth category; Wherein, the application loading unit is further used to: load the code package of the target application through the application loader in the order of the first category of classes in the code package of the target application, the second category of classes in the code package of the target application, the third category of classes in the code package of the target application, the fourth category of classes in the code package of the target application and the fifth category of classes in the code package of the target application; wherein the first category of classes in the code package of the target application corresponds to the classes that have been loaded, the second category of classes in the code package of the target application corresponds to the classes in the software development kit, the third category of classes in the code package of the target application corresponds to the classes in other third-party dependent packages, the fourth category of classes in the code package of the target application corresponds to the classes in its own module, and the fifth category of classes in the code package of the target application corresponds to the classes in the language agent module.
4. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method described in any one of claims 1 and 2 are implemented.
5. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the method described in any one of claims 1 and 2 are implemented.
