A method for loading application modules, a client and a server

By dynamically loading the application module, the required modules are loaded on the client according to the dependencies returned by the server, which solves the problems of cumbersome and large size of application maintenance in the existing technology, and realizes efficient application maintenance and independent event notification, improving Maintainability of the application.

CN113064662BActive Publication Date: 2024-12-10BEIJING WODONG TIANJUN INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010001638.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-01-02
Publication Date
2024-12-10
Estimated Expiration
2040-01-02

AI Technical Summary

Technical Problem

In the prior art, the server merges multiple application modules into a whole file and issues them to the client, resulting in cumbersome application maintenance process and large application volume of client installation. Especially when a certain application module is updated or added, it is necessary to Re-merge and issue all modules to affect maintainability.

Method used

By sending application requests to the server, receiving and dynamically loading the required application modules according to the dependencies, the client can directly call the locally stored modules or download them from the server, realizing separate updates and reducing installation volumes, and independently using event broadcast communications To apply module code, avoid code coupling.

Benefits of technology

It simplifies the application maintenance process, reduces the application volume installed by the client, improves the application maintainability, and does not need to change the event notification mechanism. Even if the application module is updated, it will not affect communication.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113064662B_ABST
    Figure CN113064662B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for loading an application module, a client and a server, and relates to the field of computer technology. A specific implementation of the method includes: sending an application request for a first application module to a server; receiving a dependency relationship about the first application module returned by the server according to the application request, wherein the dependency relationship indicates that the first application module depends on one or more second application modules; and loading the second application module according to the dependency relationship to apply the first application module. This implementation can realize dynamic loading of application modules, improve the maintainability of applications, and reduce the size of applications installed by the client.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method for loading an application module, a client, and a server. Background Art

[0002] With the development of computer technology, users can handle various electronic transactions through multiple applications with different functions, such as placing online orders through the corresponding applications of smart stores or realizing online communication through communication applications.

[0003] An application generally includes multiple application modules. In the prior art, the server side of developing an application generally merges multiple application modules corresponding to an application into an integral file and sends it to the client side so that the client side can install and use the application through the integral file.

[0004] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art:

[0005] Since the server merges multiple application modules into an overall file and sends it to the client, once an application module is updated or a new application module is added, the server needs to merge multiple application modules again and send it to the client, and the client needs to update the application according to the overall file re-sent by the server, which makes the application maintenance process more cumbersome. In addition, the client installs multiple application modules according to the file sent by the server, which also causes the size of the application installed by the client to be larger. Summary of the invention

[0006] In view of this, an embodiment of the present invention provides a method, a client, and a server for loading an application module, which can realize dynamic loading of application modules, improve the maintainability of applications, and reduce the size of applications installed by the client.

[0007] To achieve the above objective, according to one aspect of an embodiment of the present invention, a method for loading an application module is provided.

[0008] A method for loading an application module according to an embodiment of the present invention includes:

[0009] Sending an application request for the first application module to the server;

[0010] receiving a dependency relationship about the first application module returned by the server according to the application request, wherein the dependency relationship indicates that the first application module depends on one or more second application modules;

[0011] The second application module is loaded according to the dependency relationship to apply the first application module.

[0012] Optionally,

[0013] The loading of the second application module according to the dependency relationship includes:

[0014] Determining whether the second application module is stored locally;

[0015] If yes, calling the second application module stored locally;

[0016] If not, download the second application module from the server.

[0017] Optionally,

[0018] The dependency relationship also indicates version information of the second application module;

[0019] When the second application module is stored locally, the method further includes:

[0020] Determining whether the version information of the second application module stored locally is consistent with the version information of the second application module indicated by the dependency relationship;

[0021] If yes, executing the calling of the second application module stored locally;

[0022] If not, download the second application module from the server.

[0023] Optionally,

[0024] The application, the first application module, includes:

[0025] Determining whether the first application module is stored locally;

[0026] If yes, calling the first application module stored locally;

[0027] If not, download the first application module from the server.

[0028] Optionally,

[0029] The dependency relationship also indicates version information of the second application module;

[0030] When the first application module is stored locally, the method further includes:

[0031] Determining whether the version information of the first application module stored locally is consistent with the version information of the first application module indicated by the dependency relationship;

[0032] If yes, executing the calling of the first application module stored locally;

[0033] If not, download the second application module from the server.

[0034] Optionally,

[0035] The event notification mechanism between the first application module and the second application module, and / or between multiple second application modules is independent of the first application module and the second application module, so that when the first application module and / or the second application module loaded this time are different from the first application module and / or the second application module loaded last time, there is no need to change the event notification mechanism.

[0036] Optionally,

[0037] The event broadcast communication is used to implement an event notification mechanism between the first application module and the second application module, and / or between a plurality of the second application modules, which is independent of the first application module and the second application module.

[0038] To achieve the above objective, according to another aspect of an embodiment of the present invention, a method for loading an application module is provided.

[0039] A method for loading an application module according to an embodiment of the present invention includes: receiving an application request for a first application module sent by a client;

[0040] According to the application request, the dependency relationship about the first application module is determined, and the dependency relationship is sent to the client, wherein the dependency relationship indicates that the first application module depends on one or more second application modules, so that the client loads the second application module according to the dependency relationship and applies the first application module.

[0041] Optionally, the method further comprises:

[0042] Acquire registration information of a first application module, where the registration information indicates one or more second application modules that the first application module depends on;

[0043] A dependency relationship between the first application module and the second application module is established according to the registration information.

[0044] Optionally, the method further comprises:

[0045] receiving update information about the first application module;

[0046] The first application module is updated according to the update information.

[0047] To achieve the above objective, according to another aspect of an embodiment of the present invention, a client for loading an application module is provided.

[0048] A client for loading an application module according to an embodiment of the present invention comprises: a request sending module, a dependency receiving module and an application loading module; wherein:

[0049] The request sending module is used to send an application request for the first application module to the server;

[0050] The dependency relationship receiving module is used to receive the dependency relationship about the first application module returned by the server according to the application request, wherein the dependency relationship indicates that the first application module depends on one or more second application modules;

[0051] The application loading module is used to load the second application module according to the dependency relationship to apply the first application module.

[0052] To achieve the above objective, according to another aspect of an embodiment of the present invention, a server for loading an application module is provided.

[0053] A server for loading an application module according to an embodiment of the present invention includes: a request receiving module and a dependency sending module; wherein:

[0054] The request receiving module is used to receive an application request for the first application module sent by the client;

[0055] The dependency sending module is used to determine the dependency of the first application module according to the application request, and send the dependency to the client, wherein the dependency indicates that the first application module depends on one or more second application modules, so that the client loads the second application module according to the dependency and applies the first application module.

[0056] To achieve the above objective, according to another aspect of an embodiment of the present invention, an electronic device for loading an application module is provided.

[0057] An electronic device for loading an application module according to an embodiment of the present invention comprises: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement a method for loading an application module according to an embodiment of the present invention.

[0058] To achieve the above objective, according to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided.

[0059] A computer-readable storage medium according to an embodiment of the present invention stores a computer program, and when the program is executed by a processor, a method for loading an application module according to an embodiment of the present invention is implemented.

[0060] One embodiment of the above invention has the following advantages or beneficial effects: when using an application, the client sends an application request about a first application module to the server according to demand, and when receiving the dependency relationship about the first application module returned by the server according to the application request, the second application module is loaded according to one or more second application modules that the first application module depends on as indicated by the dependency relationship, and the first application module is applied. This realizes the dynamic loading of the first application module according to the dependency relationship returned by the server according to the demand of using the application.

[0061] Furthermore, when loading the first / second application module, if the first / second application module is stored locally, the first / second application module can be directly called, and if the first / second application module is not stored locally, the client can download the corresponding first / second application module from the server. This makes it unnecessary for the client to store all application modules corresponding to the application, and when the application module needs to be loaded, the corresponding application module can be downloaded from the server in a timely manner, thereby reducing the size of the application installed by the client, simplifying the maintenance process of the application, and improving the maintainability of the application.

[0062] Furthermore, the server may update the first application module according to the received update information about the first application module, thereby realizing independent update of the application module without being affected by other application modules having dependencies thereon, thereby further improving the maintainability of the application.

[0063] In addition, the event notification mechanism between the first / second application modules in the client is independent of the first / second application modules, so that when the first / second application module loaded this time is different from the first / second application module loaded previously due to an update of the first / second application module or the re-download of the first / second application module, there is no need to change the event notification mechanism, so that the first / second application modules communicate through custom events, avoiding coupling at the code or file level, thereby further improving the maintainability of the application.

[0064] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0065] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0066] Figure 1 is a schematic diagram of main steps of a method for loading an application module applied to a client according to an embodiment of the present invention;

[0067] Figure 2 is a schematic diagram of dependency relationships between multiple application modules according to an embodiment of the present invention;

[0068] Figure 3 is a schematic diagram of main steps of loading a first / second application module according to an embodiment of the present invention;

[0069] Figure 4 is a schematic diagram of another main step of loading a first / second application module according to an embodiment of the present invention;

[0070] Figure 5 is a schematic diagram of an event notification mechanism between application modules according to an embodiment of the present invention;

[0071] Figure 6 is a schematic diagram of implementing communication between multiple application modules through event broadcasting according to an embodiment of the present invention;

[0072] Figure 7 is a schematic diagram of another embodiment of the present invention wherein multiple application modules communicate with each other through event broadcasting;

[0073] Figure 8 is a schematic diagram of main steps of a method for loading an application module applied to a server according to an embodiment of the present invention;

[0074] Fig. 9 is a schematic diagram of main steps of a method for implementing loading of an application module by interaction between a client and a server according to an embodiment of the present invention;

[0075] Fig.10 is a schematic diagram of main modules of a client for loading an application module according to an embodiment of the present invention;

[0076] Fig.11 is a schematic diagram of main modules of a server for loading an application module according to an embodiment of the present invention;

[0077] Fig.12 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;

[0078] Fig.13 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0079] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0080] It should be pointed out that the embodiments of the present invention and the technical features therein may be combined with each other without conflict.

[0081] Figure 1 It is a schematic diagram of main steps of a method for loading an application module according to an embodiment of the present invention.

[0082] like Figure 1 As shown, a method for loading an application module according to an embodiment of the present invention, when applied to a client, mainly includes the following steps S101 to S103:

[0083] Step S101: sending an application request for a first application module to a server.

[0084] Typically, the client generates an application request for the first application module based on a user trigger. Specifically, the client can determine the business logic to be called based on the user trigger, and determine the application module corresponding to the business logic to be called. In an embodiment of the present invention, the application module is the first application module. At this time, the client sends an application request for the first application module to the server.

[0085] Step S102: receiving the dependency relationship about the first application module returned by the server according to the application request, wherein the dependency relationship indicates that the first application module depends on one or more second application modules.

[0086] On the server side, multiple application modules can be pre-registered. Taking the first application module as an example, the server can obtain the registration information of the first application module, which indicates one or more second application modules that the first application module depends on; and build the dependency relationship between the first application module and the second application module according to the registration information.

[0087] The dependency relationship means that the loading or running of one application module will affect the other application module. In other words, the loading or running of one application module requires the assistance of the other application module. For example, the loading or running of application module A requires the calling of application module B first, so application module A depends on application module B; or, the functional implementation of application module A is based on the functional implementation of application module B, which also means that application module A depends on application module B. For another example, when programmers write application module A, they need to know the existence of application module B and the functions provided by application module B, which also means that application module A depends on application module B.

[0088] Here, the developer of the application module can upload the development file of the first application module to the server, and fill in the version information of the first application module and the identification information of one or more second application modules that the first application module depends on, so as to register the first application module on the server. After successful registration, the server will return the unique identification of the first application module as the basis for subsequent search for the first application module.

[0089] It is understandable that the server can register multiple application modules. Since each module indicates the application module it depends on when registering, the server can establish a dependency graph of multiple registered application modules based on the dependency relationship and unique identifiers of the multiple application modules. The dependency graph can represent the dependency relationship between two application modules through directed arrows. The direction of the arrow points to the dependent application module. For example, application module A depends on application module B, and application module B depends on application module C. The dependency graph can be as follows: Figure 2 As shown, A, B, and C in this example are unique identifiers of each application module. Of course, the server can also record the dependency relationship between multiple registered application modules in other ways. Furthermore, the server can also identify the storage address of each application module when recording the dependency relationship, so that the client can load the corresponding application module later.

[0090] When the server receives an application request regarding a first application module, it can determine the dependency relationship regarding the first application module from the recorded dependencies between multiple application modules based on the unique identifier of the first application module indicated in the application request, and the dependency relationship indicates one or more second application modules on which the first application module depends.

[0091] It can be understood that when the first application module depends on multiple second application modules, the multiple second application modules are in a hierarchical dependency relationship. For example, the second application modules that the first application module depends on are the second application module K1, the second application module K2, and the second application module K3, wherein the first application module depends on the second application module K1, the second application module K1 depends on the second application module K2, and the second application module K2 depends on the second application module K3.

[0092] After determining one or more second application modules that the first application module depends on, the server can return the dependency relationship of the first application module to the client through the dependency list. Specifically, the server can first create an empty dependency list, store the module information of the first application module (such as unique identification, version information and storage address, etc.) in the dependency list, and then first find the second application module K1 that the first application module depends on based on the unique identification of the first application module, and then store the module information of the second application module K1 (such as unique identification, version information and storage address, etc.) in the dependency list, and then continue to find the second application module K2 that the second application module K1 depends on, and also store the module information of the second application module K2 in the dependency list. Similarly, after finding the second application module K3 that the second application module K2 depends on, the module information of the second application module K3 is also stored in the dependency list.

[0093] After storing the module information of the first application module and all the second application modules on which the first application module depends in the dependency list, the information of each module in the dependency list can be sorted so that the dependent second application module is placed before the first application module. In this example, the arrangement of each application module in the dependency list can be as shown in Table 1, so that the client can download and instantiate the corresponding application modules in the order of the dependency list, thereby ensuring that the dependent application modules are downloaded and instantiated first, and ensuring that the problem of being unable to reference the dependent application modules will not occur later.

[0094] Table 1

[0095] Module Identification Version Information Storage address The second application module K3 1.0 M:\K3 The second application module K2 1.0 M:\K2 The second application module K1 2.0 M:\K1 First application module 2.0 M:\N

[0096] Step S103: Load the second application module according to the dependency relationship to apply the first application module.

[0097] The main process of loading the second application module on the client can be as follows: Figure 3 As shown, the process may include at least the following steps:

[0098] Step S301: Determine whether the second application module is stored locally; if so, execute step S302; otherwise, execute step S303.

[0099] Step S302: calling the second application module stored locally.

[0100] Step S303: downloading the second application module from the server.

[0101] In order to ensure that the second application module loaded by the client is the latest updated version to ensure smooth loading of the second application module, in one embodiment of the present invention, when it is determined that the second application module is stored locally, the version information of the second application module stored locally can be verified according to the version information of the second application module indicated by the dependency relationship. Thus, the main process of loading the second application module by the client can be as follows: Figure 4 As shown, the process may include at least the following steps:

[0102] Step S401: Determine whether the second application module is stored locally; if so, execute step S402; otherwise, execute step S404.

[0103] Step S402: Determine whether the version information A of the second application module stored locally is consistent with the version information B of the second application module indicated by the dependency relationship. If yes, execute step S403; otherwise, execute step S404.

[0104] Step S403: calling the second application module stored locally.

[0105] Step S404: downloading the second application module from the server.

[0106] In this example, when the version information of the second application module stored locally on the client is consistent with the version information of the second application module indicated by the dependency relationship, it means that the second application module stored locally on the client is the latest version of the second application module, and the locally stored second application module can be directly called. Otherwise, it means that the server has an updated second application module, and the client re-downloads the updated second application module from the server, so that the second application module loaded by the client is the latest updated version, to ensure the smooth loading of the second application module.

[0107] Similar to loading the second application module, the client also loads the first application module. Figure 3 In the steps shown, first determine whether the client locally stores the first application module; if yes, call the first application module stored locally; if not, download the first application module from the server. Figure 4 The steps shown, when the first application module is stored locally, also include: determining whether the version information of the first application module stored locally is consistent with the version information of the first application module indicated by the dependency relationship; if so, executing the call to the first application module stored locally; if not, downloading the second application module from the server, so that the first application module of the client application is the latest updated version, so as to ensure the smooth loading of the first application module, and provide the user with the latest functions of the first application module to improve the user experience.

[0108] In addition, if Figure 5 As shown, in one embodiment of the present invention, the event notification mechanism between the first application module and the second application module, and / or between multiple second application modules is independent of the first application module and the second application module, so that when the first application module and / or the second application module loaded this time are different from the first application module and / or the second application module loaded last time, there is no need to change the event notification mechanism. For example, event broadcast communication can be used to implement the event notification mechanism between the first application module and the second application module, and / or between multiple second application modules, which is independent of the first application module and the second application module. Therefore, in an embodiment of the present invention, event broadcast communication replaces the commonly used language-dependent features in the prior art to implement communication between different application modules, so that different application modules communicate through custom events, avoiding coupling at the code or file level, thereby further improving the maintainability of the application.

[0109] The following takes the example of implementing communication between the first application module A, the second application module B and the second application module C through event broadcasting to describe in detail the event notification mechanism between application modules.

[0110] like Figure 6 As shown, the user's trigger corresponds to the first application module A, the first application module depends on the second application module B, and the second application module B depends on the second application module C. Then, when the first application module A needs to be called according to the user's trigger, the first application module A issues a broadcast event E1, and after the second application module B monitors the broadcast event E1, it issues a broadcast event E2. When the second application module C monitors the broadcast event E2 and executes the corresponding business logic according to the broadcast event E2, it issues a broadcast event E3, and the broadcast event E3 indicates that the second application module C has completed the corresponding call. Then, when the second application module B monitors the broadcast event E3, it calls the corresponding business logic according to the broadcast event E3 and issues a broadcast event E4, and the broadcast event E4 indicates that the second application module B has completed the corresponding call. Then, when the first application module A can complete the call according to the monitored broadcast event E4, in response to the user's trigger.

[0111] During the use of the application, the application module may be updated, and the client will re-download the updated application module from the server. At this time, since the event notification mechanism between application modules is independent of the code of the application module itself, the update of the application module will not affect the communication between application modules. In other words, when the application module is updated or re-downloaded so that the first application module and / or the second application module loaded this time are different from the first application module and / or the second application module loaded last time, there is no need to change the event notification mechanism. In other words, when the code of the application module itself is changed, there is no need to change the event notification mechanism between application modules, thereby avoiding coupling at the code or file level.

[0112] In the embodiment of the invention, taking the updating of the second application module B to the second application module B' as an example, the event notification mechanism between application modules is described independently of the application modules. Figure 7 As shown, the second application module B is updated to the second application module B', the corresponding business logic L3 is updated to the business logic L3', and the second application module B' has a new business logic L8 compared to the second application module B. Although the business logic of the second application module B' has been updated, the first application module A, the second application module B' and the second application module C can still use the original broadcast event communication mode to achieve communication. The specific communication process is as follows Figure 7 As shown, its event broadcast and monitoring mechanism is similar to Figure 6 The broadcast and listen mechanisms shown are the same.

[0113] According to the method for loading application modules in the embodiment of the present invention, it can be seen that when using an application, the client sends an application request about the first application module to the server according to the demand, and when receiving the dependency relationship about the first application module returned by the server according to the application request, the second application module is loaded according to one or more second application modules that the first application module depends on as indicated by the dependency relationship, and the first application module is applied. In this way, the first application module is dynamically loaded according to the dependency relationship returned by the server according to the demand of using the application.

[0114] Furthermore, when loading the first / second application module, if the first / second application module is stored locally, the first / second application module can be directly called, and if the first / second application module is not stored locally, the client can download the corresponding first / second application module from the server. This makes it unnecessary for the client to store all application modules corresponding to the application, and when the application module needs to be loaded, the corresponding application module can be downloaded from the server in a timely manner, thereby reducing the size of the application installed by the client, simplifying the maintenance process of the application, and improving the maintainability of the application.

[0115] In addition, the event notification mechanism between the first / second application modules in the client is independent of the first / second application modules, so that when the first / second application module loaded this time is different from the first / second application module loaded previously due to an update of the first / second application module or the re-download of the first / second application module, there is no need to change the event notification mechanism, so that the first / second application modules communicate through custom events, avoiding coupling at the code or file level, thereby further improving the maintainability of the application.

[0116] In addition, the embodiment of the present invention also provides a method for loading application modules on the application and the server, such as Figure 8 As shown, the method mainly includes the following steps S801 and S802:

[0117] Step S801: receiving an application request for a first application module sent by a client.

[0118] Step S802: Determine the dependency of the first application module according to the application request, and send the dependency to the client, wherein the dependency indicates that the first application module depends on one or more second application modules, so that the client loads the second application module according to the dependency and applies the first application module.

[0119] In order to ensure that the server can quickly determine the dependency relationship of the first application module, in one embodiment of the present invention, the server can pre-register multiple application modules. Taking the first application module as an example, the server can obtain the registration information of the first application module, and the registration information indicates one or more second application modules that the first application module depends on; according to the registration information, the dependency relationship between the first application module and the second application module is constructed.

[0120] Here, the developer of the application module can upload the development file of the first application module to the server, and fill in the version information of the first application module and the identification information of one or more second application modules that the first application module depends on, so as to register the first application module on the server. After successful registration, the server will return the unique identification of the first application module as the basis for subsequent search for the first application module.

[0121] It is understandable that the server can register multiple application modules. Since each module indicates the application module it depends on when registering, the server can establish a dependency graph of multiple registered application modules based on the dependency relationship and unique identifiers of the multiple application modules. The dependency graph can represent the dependency relationship between two application modules through directed arrows. The direction of the arrow points to the dependent application module. For example, application module A depends on application module B, and application module B depends on application module C. The dependency graph can be as follows: Figure 2 As shown, A, B, and C in this example are unique identifiers of each application module. Of course, the server can also record the dependency relationship between multiple registered application modules in other ways. Furthermore, the server can also identify the storage address of each application module when recording the dependency relationship, so that the client can load the corresponding application module later.

[0122] When the server receives an application request regarding a first application module, it can determine the dependency relationship regarding the first application module from the recorded dependencies between multiple application modules based on the unique identifier of the first application module indicated in the application request, and the dependency relationship indicates one or more second application modules on which the first application module depends.

[0123] It can be understood that when the first application module depends on multiple second application modules, the multiple second application modules are in a hierarchical dependency relationship. For example, the second application modules that the first application module depends on are the second application module K1, the second application module K2, and the second application module K3, wherein the first application module depends on the second application module K1, the second application module K1 depends on the second application module K2, and the second application module K2 depends on the second application module K3.

[0124] After determining one or more second application modules that the first application module depends on, the server can return the dependency relationship of the first application module to the client through the dependency list. Specifically, the server can first create an empty dependency list, store the module information of the first application module (such as unique identification, version information and storage address, etc.) in the dependency list, and then first find the second application module K1 that the first application module depends on based on the unique identification of the first application module, and then store the module information of the second application module K1 (such as unique identification, version information and storage address, etc.) in the dependency list, and then continue to find the second application module K2 that the second application module K1 depends on, and also store the module information of the second application module K2 in the dependency list. Similarly, after finding the second application module K3 that the second application module K2 depends on, the module information of the second application module K3 is also stored in the dependency list.

[0125] After storing the module information of the first application module and all the second application modules on which the first application module depends in the dependency list, the information of each module in the dependency list can be sorted so that the dependent second application module is placed before the first application module. In this example, the arrangement of each application module in the dependency list can be as shown in Table 2. The sorted dependency list is then returned to the client, so that the client can download and instantiate the corresponding application modules in the order in the dependency list, thereby ensuring that the dependent application modules are downloaded and instantiated first, and ensuring that there will be no problem of being unable to reference the dependent application modules later.

[0126] Table 2

[0127] Module Identification Version Information Storage address Second application module K3 1.0 M:\K3 The second application module K2 1.0 M:\K2 The second application module K1 2.0 M:\K1 First application module 2.0 M:\N

[0128] In addition, in one embodiment of the present invention, when an application module needs to be updated, the server can find the application module to be updated based on the unique identifier of the application module and the dependency graph, and update the application module to be updated separately. For example, when updating the first application module, the developer forms update information based on the update file of the first application module and its unique identifier. That is to say, when updating the first application file, the developer will re-upload the file about the first application module to the server and submit the unique identifier of the first application module. The server can determine the first application module to be updated from the multiple application modules stored in the server based on the update information about the first application module and the dependency graph of multiple application modules, and update the first application module based on the update file of the first application module. In this way, the application module can be updated separately without being affected by other application modules with which it has a dependency relationship, thereby further improving the maintainability of the application.

[0129] According to the method for loading application modules in the embodiment of the present invention, it can be seen that when using an application, the client sends an application request about the first application module to the server according to the demand, and when receiving the dependency relationship about the first application module returned by the server according to the application request, the second application module is loaded according to one or more second application modules that the first application module depends on as indicated by the dependency relationship, and the first application module is applied. In this way, the first application module is dynamically loaded according to the dependency relationship returned by the server according to the demand of using the application.

[0130] In addition, the server can update the first application module according to the received update information about the first application module, thereby realizing independent update of the application module without being affected by other application modules having dependencies thereon, thereby further improving the maintainability of the application.

[0131] In summary, the method for loading an application module provided by the embodiment of the present invention may at least include the following steps: Fig. 9 Steps shown:

[0132] Step S901: the client sends an application request for a first application module to the server according to a user trigger.

[0133] Step S902: The server determines a dependency relationship about a first application module according to the application request, where the dependency relationship indicates that the first application module depends on one or more second application modules.

[0134] Step S903: The server returns the dependency relationship to the client.

[0135] Step S904: the client loads the second application module according to the dependency relationship to apply the first application module.

[0136] like Fig.10 As shown, the embodiment of the present invention also provides a client 1000 for loading an application module, including: a request sending module 1001, a dependency receiving module 1002 and an application loading module 1003; wherein,

[0137] The request sending module 1001 is used to send an application request for the first application module to the server;

[0138] The dependency relationship receiving module 1002 is used to receive the dependency relationship of the first application module returned by the server according to the application request, wherein the dependency relationship indicates that the first application module depends on one or more second application modules;

[0139] The application loading module 1003 is used to load the second application module according to the dependency relationship to apply the first application module.

[0140] In one embodiment of the present invention, the application loading module 1003 is used to determine whether the second application module is stored locally; if so, call the second application module stored locally; if not, download the second application module from the server.

[0141] In one embodiment of the present invention, when the dependency relationship also indicates the version information of the second application module, the application loading module 1003 is used to determine whether the version information of the second application module stored locally is consistent with the version information of the second application module indicated by the dependency relationship; if so, execute the call to the second application module stored locally; if not, download the second application module from the server.

[0142] In one embodiment of the present invention, the application loading module 1003 is used to determine whether the first application module is stored locally; if yes, call the first application module stored locally; if not, download the first application module from the server.

[0143] In one embodiment of the present invention, when the dependency relationship also indicates the version information of one or more second application modules on which the first application module depends, the application loading module 1003 is used to determine whether the version information of the first application module stored locally is consistent with the version information of the first application module indicated by the dependency relationship; if so, execute the call to the first application module stored locally; if not, download the second application module from the server.

[0144] In one embodiment of the present invention, the event notification mechanism between the first application module and the second application module, and / or between multiple second application modules is independent of the first application module and the second application module, so that when the first application module and / or the second application module loaded this time are different from the first application module and / or the second application module loaded last time, there is no need to change the event notification mechanism.

[0145] In one embodiment of the present invention, event broadcast communication is used to implement an event notification mechanism between the first application module and the second application module, and / or between a plurality of the second application modules, independent of the first application module and the second application module.

[0146] It can be seen from the client for loading application modules provided by the embodiment of the present invention that when using an application, the client sends an application request about the first application module to the server according to the demand, and when receiving the dependency relationship about the first application module returned by the server according to the application request, the client loads the second application module according to the first application module indicated by the dependency relationship and one or more second application modules on which the first application module depends, and applies the first application module. This realizes the dynamic loading of the first application module according to the dependency relationship returned by the server according to the demand of using the application.

[0147] Furthermore, when loading the first / second application module, if the first / second application module is stored locally, the first / second application module can be directly called, and if the first / second application module is not stored locally, the client can download the corresponding first / second application module from the server. This makes it unnecessary for the client to store all application modules corresponding to the application, and when the application module needs to be loaded, the corresponding application module can be downloaded from the server in a timely manner, thereby reducing the size of the application installed by the client, simplifying the maintenance process of the application, and improving the maintainability of the application.

[0148] In addition, the event notification mechanism between the first / second application modules in the client is independent of the first / second application modules, so that when the first / second application module loaded this time is different from the first / second application module loaded previously due to an update of the first / second application module or the re-download of the first / second application module, there is no need to change the event notification mechanism, so that the first / second application modules communicate through custom events, avoiding coupling at the code or file level, thereby further improving the maintainability of the application.

[0149] like Fig.11 As shown, the embodiment of the present invention also provides a server 1100 for loading an application module, including: a request receiving module 1101 and a dependency sending module 1102; wherein,

[0150] The request receiving module 1101 is used to receive an application request for a first application module sent by a client;

[0151] The dependency sending module 1102 is used to determine the dependency of the first application module according to the application request, and send the dependency to the client, wherein the dependency indicates that the first application module depends on one or more second application modules, so that the client loads the second application module according to the dependency and applies the first application module.

[0152] In one embodiment of the present invention, the dependency sending module 1102 is also used to obtain registration information of the first application module, where the registration information indicates one or more second application modules on which the first application module depends; and based on the registration information, construct a dependency relationship between the first application module and the second application module.

[0153] In one embodiment of the present invention, the dependency sending module 1102 is further used to receive update information about the first application module; and update the first application module according to the update information.

[0154] According to the server end for loading application modules according to the embodiment of the present invention, it can be seen that when using an application, the client sends an application request about the first application module to the server end according to the demand, and when receiving the dependency relationship about the first application module returned by the server end according to the application request, the second application module is loaded according to the first application module indicated by the dependency relationship and one or more second application modules on which the first application module depends, and the first application module is applied. In this way, the first application module is dynamically loaded according to the dependency relationship returned by the server end according to the demand of using the application.

[0155] In addition, the server can update the first application module according to the received update information about the first application module, thereby realizing independent update of the application module without being affected by other application modules having dependencies thereon, thereby further improving the maintainability of the application.

[0156] Fig.12 An exemplary system architecture 1200 is shown to which the method for loading an application module or the apparatus for loading an application module according to the embodiments of the present invention can be applied.

[0157] like Fig.12 As shown, the system architecture 1200 may include terminal devices 1201, 1202, 1203, a network 1204, and a server 1205. The network 1204 is used to provide a medium for communication links between the terminal devices 1201, 1202, 1203 and the server 1205. The network 1204 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.

[0158] Users can use terminal devices 1201, 1202, 1203 to interact with server 1205 through network 1204 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 1201, 1202, 1203, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc.

[0159] The terminal devices 1201 , 1202 , and 1203 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers, etc.

[0160] The server 1205 may be a server that provides various services, such as a backend management server that provides support for shopping websites browsed by users using the terminal devices 1201, 1202, and 1203. The backend management server may analyze and process the received data such as product information query requests, and feed back the processing results (such as target push information and product information) to the terminal device.

[0161] It should be noted that the method for loading an application module provided in the embodiment of the present invention is generally executed by the server 1205 , and accordingly, the device for loading an application module is generally disposed in the server 1205 .

[0162] It should be understood that Fig.12 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0163] Reference below Fig.13, which shows a schematic diagram of the structure of a computer system 1300 of a terminal device suitable for implementing an embodiment of the present invention. Fig.13 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0164] like Fig.13 As shown, the computer system 1300 includes a central processing unit (CPU) 1301, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1302 or a program loaded from a storage part 1308 into a random access memory (RAM) 1303. In the RAM 1303, various programs and data required for the operation of the system 1300 are also stored. The CPU 1301, the ROM 1302, and the RAM 1303 are connected to each other via a bus 1304. An input / output (I / O) interface 1305 is also connected to the bus 1304.

[0165] The following components are connected to the I / O interface 1305: an input section 1306 including a keyboard, a mouse, etc.; an output section 1307 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1308 including a hard disk, etc.; and a communication section 1309 including a network interface card such as a LAN card, a modem, etc. The communication section 1309 performs communication processing via a network such as the Internet. A drive 1310 is also connected to the I / O interface 1305 as needed. A removable medium 1311, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1310 as needed, so that a computer program read therefrom is installed into the storage section 1308 as needed.

[0166] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 1309, and / or installed from the removable medium 1311. When the computer program is executed by the central processing unit (CPU) 1301, the above-mentioned functions defined in the system of the present invention are executed.

[0167] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0168] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0169] The modules involved in the embodiments of the present invention may be implemented in software or hardware. The modules described may also be set in a processor, for example, it may be described as: a processor includes a request sending module, a dependency receiving module and an application loading module. The names of these modules do not constitute a limitation on the modules themselves in some cases, for example, the request sending module may also be described as a "module for sending an application request about a first application module to a server".

[0170] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: sending an application request about a first application module to a server; receiving a dependency relationship about the first application module returned by the server according to the application request, wherein the dependency relationship indicates that the first application module depends on one or more second application modules; and loading the second application module according to the dependency relationship to apply the first application module.

[0171] According to the technical solution of the embodiment of the present invention, when using an application, the client sends an application request about the first application module to the server according to the demand, and when receiving the dependency relationship about the first application module returned by the server according to the application request, the second application module is loaded according to the first application module indicated by the dependency relationship and one or more second application modules on which the first application module depends, and the first application module is applied. In this way, the first application module is dynamically loaded according to the dependency relationship returned by the server according to the demand of using the application.

[0172] Furthermore, when loading the first / second application module, if the first / second application module is stored locally, the first / second application module can be directly called, and if the first / second application module is not stored locally, the client can download the corresponding first / second application module from the server. This makes it unnecessary for the client to store all application modules corresponding to the application, and when the application module needs to be loaded, the corresponding application module can be downloaded from the server in a timely manner, thereby reducing the size of the application installed by the client, simplifying the maintenance process of the application, and improving the maintainability of the application.

[0173] Furthermore, the server may update the first application module according to the received update information about the first application module, thereby realizing independent update of the application module without being affected by other application modules having dependencies thereon, thereby further improving the maintainability of the application.

[0174] In addition, the event notification mechanism between the first / second application modules in the client is independent of the first / second application modules, so that when the first / second application module loaded this time is different from the first / second application module loaded previously due to an update of the first / second application module or the re-download of the first / second application module, there is no need to change the event notification mechanism, so that the first / second application modules communicate through custom events, avoiding coupling at the code or file level, thereby further improving the maintainability of the application.

[0175] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for loading an application module, characterized in that: include: Sending an application request for the first application module to the server; receiving a dependency relationship about the first application module returned by the server according to the application request, wherein the dependency relationship indicates that the first application module depends on one or more second application modules; The second application module is loaded according to the dependency relationship to apply the first application module; wherein, an event notification mechanism between the first application module and the second application module, and / or between multiple second application modules, is implemented using event broadcast communication and is independent of the first application module and the second application module, so that when the first application module and / or the second application module loaded this time are different from the first application module and / or the second application module loaded last time, there is no need to change the event notification mechanism.

2. The method according to claim 1, characterized in that The loading of the second application module according to the dependency relationship includes: Determining whether the second application module is stored locally; If yes, calling the second application module stored locally; If not, download the second application module from the server.

3. The method according to claim 2, characterized in that The dependency relationship also indicates version information of the second application module; When the second application module is stored locally, the method further includes: Determining whether the version information of the second application module stored locally is consistent with the version information of the second application module indicated by the dependency relationship; If yes, executing the calling of the second application module stored locally; If not, download the second application module from the server.

4. The method according to claim 1, characterized in that: The application, the first application module, includes: Determining whether the first application module is stored locally; If yes, calling the first application module stored locally; If not, download the first application module from the server.

5. The method according to claim 4, characterized in that The dependency relationship further indicates version information of the one or more second application modules; When the first application module is stored locally, the method further includes: Determining whether the version information of the first application module stored locally is consistent with the version information of the first application module indicated by the dependency relationship; If yes, executing the calling of the first application module stored locally; If not, download the second application module from the server.

6. A method for loading an application module, characterized in that: include: Receiving an application request for a first application module sent by a client; According to the application request, the dependency relationship about the first application module is determined, and the dependency relationship is sent to the client, wherein the dependency relationship indicates that the first application module depends on one or more second application modules, so that the client loads the second application module according to the dependency relationship and applies the first application module; wherein, the event notification mechanism between the first application module and the second application module and / or between multiple second application modules is implemented using event broadcast communication, which is independent of the first application module and the second application module, so that when the first application module and / or the second application module loaded this time are different from the first application module and / or the second application module loaded last time, there is no need to change the event notification mechanism.

7. The method according to claim 6, characterized in that Also includes: Acquire registration information of a first application module, where the registration information indicates one or more second application modules that the first application module depends on; A dependency relationship between the first application module and the second application module is established according to the registration information.

8. The method according to claim 7, characterized in that Also includes: Receiving update information about the first application module; The first application module is updated according to the update information.

9. A client for loading an application module, characterized in that: include: Request sending module, dependency receiving module and application loading module; wherein, The request sending module is used to send an application request for the first application module to the server; The dependency relationship receiving module is used to receive the dependency relationship about the first application module returned by the server according to the application request, wherein the dependency relationship indicates that the first application module depends on one or more second application modules; The application loading module is used to load the second application module according to the dependency relationship to apply the first application module; wherein, the event notification mechanism between the first application module and the second application module and / or between multiple second application modules is implemented using event broadcast communication and is independent of the first application module and the second application module, so that when the first application module and / or the second application module loaded this time are different from the first application module and / or the second application module loaded last time, there is no need to change the event notification mechanism.

10. A server for loading an application module, characterized in that: include: Request receiving module and dependency sending module; wherein, The request receiving module is used to receive an application request for the first application module sent by the client; The dependency sending module is used to determine the dependency of the first application module according to the application request, and send the dependency to the client, wherein the dependency indicates that the first application module depends on one or more second application modules, so that the client loads the second application module according to the dependency and applies the first application module; wherein the event notification mechanism between the first application module and the second application module and / or between multiple second application modules is implemented using event broadcast communication, which is independent of the first application module and the second application module, so that when the first application module and / or the second application module loaded this time are different from the first application module and / or the second application module loaded last time, there is no need to change the event notification mechanism.

11. An electronic device for loading an application module, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 8.

12. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.