CN113064662A - Method for loading application module, client and server - Google Patents

Method for loading application module, client and server Download PDF

Info

Publication number
CN113064662A
CN113064662A CN202010001638.2A CN202010001638A CN113064662A CN 113064662 A CN113064662 A CN 113064662A CN 202010001638 A CN202010001638 A CN 202010001638A CN 113064662 A CN113064662 A CN 113064662A
Authority
CN
China
Prior art keywords
application module
application
module
server
dependency relationship
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010001638.2A
Other languages
Chinese (zh)
Inventor
郑星宬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Wodong Tianjun Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Wodong Tianjun Information Technology Co Ltd
Priority to CN202010001638.2A priority Critical patent/CN113064662A/en
Publication of CN113064662A publication Critical patent/CN113064662A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/61Installation

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses a method for loading an application module, a client and a server, and relates to the technical field of computers. One embodiment of the method comprises: sending an application request about a first application module to a server; receiving a dependency relationship which is returned by the server according to the application request and relates to the first application module, wherein the dependency relationship indicates that the first application module is dependent on one or more second application modules; and loading the second application module according to the dependency relationship so as to apply the first application module. The implementation method can realize dynamic loading of the application module, improve application maintainability and reduce the volume of the application installed on the client.

Description

Method for loading application module, client and server
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method, a client, and a server for loading an application module.
Background
With the development of computer technology, a user can process various electronic transactions through a plurality of applications with different functions, for example, online ordering and offline through an application corresponding to an intelligent store or online communication through a communication application, and the like.
In the prior art, a server for developing an application generally combines a plurality of application modules corresponding to the application into an integral file and issues the integral file to a client, so that the client installs and uses the application through the integral file.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art:
because the server side merges the application modules into an integral file and sends the integral file to the client side, once a certain application module is updated or newly added, the server side needs to merge the application modules again and send the integral file to the client side, and the client side needs to update the application according to the integral file sent by the server side again, so that the maintenance process of the application is complicated. Moreover, the client installs a plurality of application modules according to the file issued by the server, which also results in a larger volume for installing the application at the client.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method for loading an application module, a client, and a server, which can implement dynamic loading of an application module, improve maintainability of an application, and reduce a volume of an application installed on the client.
To achieve the above object, according to an aspect of an embodiment of the present invention, a method of loading an application module is provided.
The method for loading the application module comprises the following steps:
sending an application request about a first application module to a server;
receiving a dependency relationship which is returned by the server according to the application request and relates to the first application module, wherein the dependency relationship indicates that the first application module is dependent on one or more second application modules;
and loading the second application module according to the dependency relationship so as to apply the first application module.
Alternatively,
the loading the second application module according to the dependency relationship includes:
judging whether the second application module is stored locally;
if yes, calling the second application module stored locally;
and if not, downloading the second application module from the server.
Alternatively,
the dependency also indicates version information of the second application module;
when the second application module is stored locally, the method further comprises the following steps:
judging whether locally stored version information of a second application module is consistent with the version information of the second application module indicated by the dependency relationship;
if yes, executing the second application module stored locally by the calling;
and if not, downloading a second application module from the server.
Alternatively,
the applying the first application module includes:
judging whether the first application module is stored locally;
if yes, calling the first application module stored locally;
and if not, downloading the first application module from the server.
Alternatively,
the dependency also indicates version information of the second application module;
when the first application module is stored locally, the method further comprises the following steps:
judging whether the locally stored version information of the first application module is consistent with the version information of the first application module indicated by the dependency relationship;
if yes, executing the first application module stored locally;
and if not, downloading a second application module from the server.
Alternatively,
the event notification mechanism between the first application module and the second application module and/or between a plurality of 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 at this time is different from the first application module and/or the second application module loaded at the previous time, the event notification mechanism does not need to be changed.
Alternatively,
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.
To achieve the above object, according to another aspect of the embodiments of the present invention, a method for loading an application module is provided.
The method for loading the application module comprises the following steps: receiving an application request about a first application module sent by a client;
and determining a dependency relation related to the first application module according to the application request, and sending the dependency relation to the client, wherein the dependency relation indicates that the first application module depends on one or more second application modules, so that the client loads the second application modules according to the dependency relation and applies the first application modules.
Optionally, the method further comprises:
acquiring registration information of a first application module, wherein the registration information indicates one or more second application modules depended by the first application module;
and constructing a dependency relationship between the first application module and the second application module according to the registration information.
Optionally, the method further comprises:
receiving update information regarding the first application module;
and updating the first application module according to the updating information.
To achieve the above object, according to another aspect of the embodiments of the present invention, a client for loading an application module is provided.
The client for loading the application module of the embodiment of the invention comprises: the device comprises a request sending module, a dependency relationship receiving module and an application loading module; wherein the content of the first and second substances,
the request sending module is used for sending an application request related to the first application module to the server;
the dependency relationship receiving module is configured to receive a dependency relationship, which is returned by the server according to the application request and relates to the first application module, where the dependency relationship indicates that the first application module depends on one or more second application modules;
and the application loading module is used for loading the second application module according to the dependency relationship so as to apply the first application module.
To achieve the above object, according to still another aspect of the embodiments of the present invention, a server for loading an application module is provided.
The server for loading the application module of the embodiment of the invention comprises: the device comprises a request receiving module and a dependency relationship sending module; wherein the content of the first and second substances,
the request receiving module is used for receiving an application request which is sent by a client and related to a first application module;
the dependency relationship sending module is configured to determine a dependency relationship about the first application module according to the application request, and send the dependency relationship to the client, where 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 modules according to the dependency relationship and applies the first application module.
To achieve the above object, according to still another aspect of the embodiments of the present invention, there is provided an electronic device loading an application module.
An electronic device for loading an application module according to an embodiment of the present invention includes: one or more processors; the storage device is used 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 realize the method for loading the application module according to the embodiment of the invention.
To achieve the above object, according to still another aspect of embodiments of the present invention, there is provided a computer-readable storage medium.
A computer-readable storage medium of an embodiment of the present invention stores thereon a computer program, which when executed by a processor implements a method of loading an application module of an embodiment of the present invention.
One embodiment of the above invention has the following advantages or benefits: when the client uses the application, the client sends an application request about the first application module to the server according to the requirement, and when the dependency relationship about the first application module returned by the server according to the application request is received, the second application module is loaded according to one or more second application modules which are indicated by the dependency relationship and depended on by the first application module, and the first application module is applied. Therefore, the first application module is dynamically loaded according to the requirement of using the application and the dependency relationship returned by the server.
Moreover, when the first/second application module is loaded, when the first/second application module is locally stored, the first/second application module can be directly called, and when the first/second application module is not locally stored, the client can download the corresponding first/second application module from the server. The client does not need to store all the application modules corresponding to the application, and when the application modules need to be loaded, the corresponding application modules can be downloaded from the server in time, so that the size of the application installed on the client is reduced, the maintenance flow of the application is simplified, and the maintainability of the application is improved.
Furthermore, the server side can update the first application module according to the received update information about the first application module, so that the application module is updated independently without being influenced by other application module pairs with dependency relationship, and the maintainability of the application is further improved.
In addition, an event notification mechanism between the first application module and the second application module in the client is independent from the first application module and the second application module, so that when the first application module and the second application module loaded at this time are different from the first application module and the second application module loaded at the previous time due to the fact that the first application module and the second application module are updated or the first application module is downloaded again, the event notification mechanism does not need to be changed, the first application module and the second application module are enabled to communicate through a custom event, coupling of a code or a file level is avoided, and maintainability of the application is further improved.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
fig. 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;
FIG. 2 is a schematic diagram of dependencies between a plurality of application modules, according to an embodiment of the invention;
FIG. 3 is a schematic diagram of the main steps of loading a first/second application module according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of another main step of loading a first/second application module according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of an event notification mechanism between application modules, according to an embodiment of the invention;
FIG. 6 is a diagram illustrating an example of communication among a plurality of application modules via event broadcasting according to an embodiment of the present invention;
fig. 7 is a schematic diagram of another communication among a plurality of application modules through event broadcasting according to an embodiment of the present invention;
FIG. 8 is a diagram illustrating the main steps of a method for loading an application module applied to a server according to an embodiment of the present invention;
FIG. 9 is a diagram illustrating the main steps of a method for a client to interact with a server to load an application module according to an embodiment of the present invention;
FIG. 10 is a schematic diagram of the main modules of a client that loads application modules according to an embodiment of the present invention;
FIG. 11 is a schematic diagram of the main modules of a server side loading application modules according to an embodiment of the present invention;
FIG. 12 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 13 is a schematic block diagram of a computer system suitable for use in implementing a terminal device or server according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
It should be noted that the embodiments of the present invention and the technical features of the embodiments may be combined with each other without conflict.
Fig. 1 is a schematic diagram of main steps of a method for loading an application module according to an embodiment of the present invention.
As shown in fig. 1, when applied to a client, the method for loading an application module according to an embodiment of the present invention mainly includes the following steps S101 to S103:
step S101: and sending an application request about the first application module to the server.
In an embodiment of the present invention, the application module is a first application module, and at this time, the client sends an application request related to the first application module to the server.
Step S102: and receiving the dependency relationship which is returned by the server according to the application request and relates to the first application module, wherein the dependency relationship indicates that the first application module is dependent on one or more second application modules.
On the server side, a plurality of application modules may be registered in advance. Taking a first application module as an example, a server may 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 constructing a dependency relationship between the first application module and the second application module according to the registration information.
The dependency relationship indicates that, in two application modules, the loading or running of one application module affects 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, if the application module a needs to be called first for loading or running, the application module a depends on the application module B; or the functional implementation of the application module a is established on the functional implementation of the application module B, which also indicates that the application module a depends on the application module B, and for example, when a programmer writes the application module a, the programmer needs to know the existence of the application module B and needs to know the function provided by the application module B, which also indicates that the application module a depends on the application module B.
Here, the developer of the application module may upload a development file of a first application module to the server and fill in version information of the first application module and identification information of one or more second application modules on which the first application module depends to register the first application module at the server. After the registration is successful, the server returns the unique identifier of the first application module to be used as a basis for searching the first application module subsequently.
It can be understood that the server may register a plurality of application modules, and since each module indicates the application module on which it depends when registering, the server may establish a dependency graph of the registered application modules according to the dependency of the application modules and the unique identifiers thereof. The dependency graph may characterize the dependency between two application modules by directional arrows, the direction pointed by the arrows is the dependent application module, for example, application module a depends on application module B, and the dependency graph of application module B depends on application module C may be as shown in fig. 2, where A, B, C in this example is the unique identifier of each application module. Certainly, the server may also record the dependency relationship among the registered multiple application modules in other manners, and further, the server may also identify the storage address of each application module when recording the dependency relationship, so as to facilitate the subsequent client to load the corresponding application module.
When the server receives an application request about the first application module, the dependency relationship about the first application module can be determined from the recorded dependency relationships among the plurality of application modules according to the unique identifier of the first application module indicated by the application request, and the dependency relationship indicates one or more second application modules depended on by the first application module.
It is understood that when the number of the second application modules on which the first application module depends is plural, the plural second application modules have a stepwise dependency relationship therebetween, for example, the second application module on which the first application module depends is 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.
After determining one or more second application modules on which the first application module depends, the server side can return the dependency relationship of the first application module to the client side through the dependency list. Specifically, the server may create an empty dependency list, store the module information (such as the unique identifier, the version information, the storage address, and the like) of the first application module in the dependency list, then, according to the unique identifier of the first application module, first find the second application module K1 that the first application module depends on, then store the module information (such as the unique identifier, the version information, the storage address, and the like) of the second application module K1 in the dependency list, then, continuously find the second application module K2 that the second application module K1 depends on, and store the module information of the second application module K2 in the dependency list, and similarly, after finding the second application module K3 that the second application module K2 depends on, also store the module information of the second application module K3 in the dependency list.
After the first application module and the module information of all the second application modules depended on by the first application module are stored in the dependency list, the module information in the dependency list can be sorted, so that the depended second application modules are arranged in front of the first application module.
TABLE 1
Module identification Version information Storage address
Second application module K3 1.0 M:\K3
Second application module K2 1.0 M:\K2
Second application module K1 2.0 M:\K1
First application module 2.0 M:\N
Step S103: and loading the second application module according to the dependency relationship so as to apply the first application module.
The main process of loading the second application module by the client can be as shown in fig. 3, and the process at least includes the following steps:
step S301: judging whether the second application module is stored locally; if yes, go to step S302, otherwise go to step S303.
Step S302: invoking the second application module stored locally.
Step S303: and downloading the second application module from the server.
In order to make the second application module loaded by the client be the latest updated version to ensure the smooth loading of the second application module, in an embodiment of the present invention, when it is determined that the second application module is locally stored, the version information of the locally stored second application module may be further checked according to the version information of the second application module indicated by the dependency relationship, so that a main process of loading the second application module by the client may be as shown in fig. 4, where the process at least includes the following steps:
step S401: judging whether the second application module is stored locally; if so, go to step S402, otherwise go to step S404.
Step S402: and judging whether the locally stored version information A of the second application module is consistent with the version information B of the second application module indicated by the dependency relationship, if so, executing the step S403, otherwise, executing the step S404.
Step S403: the second locally stored application module is invoked.
Step S404: and downloading the second application module from the server.
In this example, when the version information of the second application module locally stored by the client is consistent with the version information of the second application module indicated by the dependency relationship, it is indicated that the second application module locally stored by the client is the second application module of the latest version, and at this time, the second application module locally stored may be directly called. And otherwise, the server side is indicated to have the updated second application module, and the client side downloads the updated second application module from the server side again at the moment, so that the second application module loaded by the client side is the latest updated version, and smooth loading of the second application module is ensured.
Similar to loading the second application module, when the client loads the first application module, it will first determine whether the client locally stores the first application module as shown in fig. 3; if yes, calling the first application module stored locally; and if not, downloading the first application module from the server. Further, as shown in fig. 4, when the first application module is stored locally, the method further includes: judging whether the locally stored version information of the first application module is consistent with the version information of the first application module indicated by the dependency relationship; if yes, executing the first application module stored locally; and if not, downloading the second application module from the server, so that the first application module applied by the client is a latest updated version, thereby ensuring the smooth loading of the first application module, providing the latest function of the first application module for the user, and improving the user experience.
In addition, as shown in fig. 5, in an embodiment of the present invention, an event notification mechanism between the first application module and the second application module, and/or between a plurality of 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 is different from the first application module and/or the second application module loaded last time, the event notification mechanism does not need to be changed. For example, event broadcast communication may be 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. Therefore, in the embodiment of the invention, the event broadcast communication replaces the common language-dependent characteristic in the prior art to realize the communication among different application modules, so that the different application modules communicate through the custom event, the coupling of a code or a file level is avoided, and the maintainability of the application is further improved.
The following describes in detail an event notification mechanism among the first application module a, the second application module B, and the second application module C, taking an example of implementing communication among the application modules through event broadcasting.
As shown in fig. 6, the user's trigger corresponds to a first application module a that is dependent on a second application module B that is dependent on a second application module C. Then, when the first application module a needs to be called according to the user trigger, the first application module a sends out a broadcast event E1, the second application module B sends out a broadcast event E2 after monitoring the broadcast event E1, and sends out a broadcast event E3 after the second application module C monitors the broadcast event E2 and executes corresponding service logic according to the broadcast event E2, 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, calls the corresponding service logic according to the broadcast event E3 and sends out 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 trigger of the user.
In the using process of the application, the application module may be updated, and the client may download the updated application module from the server again, at this time, because the event notification mechanism between the application modules is independent of the codes of the application modules themselves, the update of the application modules does not affect the communication between the application modules, that is, when the application modules are updated or downloaded again, so that the first application module and/or the second application module loaded this time is different from the first application module and/or the second application module loaded last time, the event notification mechanism does not need to be changed. In other words, when the code of the application modules is changed, the event notification mechanism between the application modules does not need to be changed, so that the coupling of the code or the file level is avoided.
In the embodiment of the present invention, taking the example that the second application module B is updated to the second application module B', the event notification mechanism between the application modules is described independently from the application modules. As shown in fig. 7, the second application module B is updated to be the second application module B ', the corresponding service logic L3 is updated to be the service logic L3 ', and the second application module B ' has a new service logic L8 compared to the second application module B. Although the service logic of the second application module B 'is 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 implement communication, the specific communication process is shown in fig. 7, and the broadcast and monitoring mechanism of the event is the same as the broadcast and monitoring mechanism shown in fig. 6.
According to the method for loading the application modules, disclosed by the embodiment of the invention, when the client uses the application, the client sends the application request related to the first application module to the server according to the requirement, and when the dependency relationship related to the first application module returned by the server according to the application request is received, the second application module is loaded according to one or more second application modules which are depended by the first application module and indicated by the dependency relationship, and the first application module is applied. Therefore, the first application module is dynamically loaded according to the requirement of using the application and the dependency relationship returned by the server.
Moreover, when the first/second application module is loaded, when the first/second application module is locally stored, the first/second application module can be directly called, and when the first/second application module is not locally stored, the client can download the corresponding first/second application module from the server. The client does not need to store all the application modules corresponding to the application, and when the application modules need to be loaded, the corresponding application modules can be downloaded from the server in time, so that the size of the application installed on the client is reduced, the maintenance flow of the application is simplified, and the maintainability of the application is improved.
In addition, an event notification mechanism between the first application module and the second application module in the client is independent from the first application module and the second application module, so that when the first application module and the second application module loaded at this time are different from the first application module and the second application module loaded at the previous time due to the fact that the first application module and the second application module are updated or the first application module is downloaded again, the event notification mechanism does not need to be changed, the first application module and the second application module are enabled to communicate through a custom event, coupling of a code or a file level is avoided, and maintainability of the application is further improved.
In addition, an embodiment of the present invention further provides a method for loading an application module in an application and a server, as shown in fig. 8, the method mainly includes the following steps S801 and S802:
step S801: and receiving an application request which is sent by the client and related to the first application module.
Step S802: and determining a dependency relation related to the first application module according to the application request, and sending the dependency relation to the client, wherein the dependency relation indicates that the first application module depends on one or more second application modules, so that the client loads the second application modules according to the dependency relation and applies the first application modules.
In order to ensure that the server can quickly determine the dependency relationship related to the first application module, in an embodiment of the present invention, the server may register a plurality of application modules in advance. Taking a first application module as an example, a server may 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 constructing a dependency relationship between the first application module and the second application module according to the registration information.
Here, the developer of the application module may upload a development file of a first application module to the server and fill in version information of the first application module and identification information of one or more second application modules on which the first application module depends to register the first application module at the server. After the registration is successful, the server returns the unique identifier of the first application module to be used as a basis for searching the first application module subsequently.
It can be understood that the server may register a plurality of application modules, and since each module indicates the application module on which it depends when registering, the server may establish a dependency graph of the registered application modules according to the dependency of the application modules and the unique identifiers thereof. The dependency graph may characterize the dependency between two application modules by directional arrows, the direction pointed by the arrows is the dependent application module, for example, application module a depends on application module B, and the dependency graph of application module B depends on application module C may be as shown in fig. 2, where A, B, C in this example is the unique identifier of each application module. Certainly, the server may also record the dependency relationship among the registered multiple application modules in other manners, and further, the server may also identify the storage address of each application module when recording the dependency relationship, so as to facilitate the subsequent client to load the corresponding application module.
When the server receives an application request about the first application module, the dependency relationship about the first application module can be determined from the recorded dependency relationships among the plurality of application modules according to the unique identifier of the first application module indicated by the application request, and the dependency relationship indicates one or more second application modules depended on by the first application module.
It is understood that when the number of the second application modules on which the first application module depends is plural, the plural second application modules have a stepwise dependency relationship therebetween, for example, the second application module on which the first application module depends is 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.
After determining one or more second application modules on which the first application module depends, the server side can return the dependency relationship of the first application module to the client side through the dependency list. Specifically, the server may create an empty dependency list, store the module information (such as the unique identifier, the version information, the storage address, and the like) of the first application module in the dependency list, then, according to the unique identifier of the first application module, first find the second application module K1 that the first application module depends on, then store the module information (such as the unique identifier, the version information, the storage address, and the like) of the second application module K1 in the dependency list, then, continuously find the second application module K2 that the second application module K1 depends on, and store the module information of the second application module K2 in the dependency list, and similarly, after finding the second application module K3 that the second application module K2 depends on, also store the module information of the second application module K3 in the dependency list.
After the first application module and the module information of all the second application modules depended on by the first application module are stored in the dependency list, the module information in the dependency list can be sorted, so that the depended second application modules are arranged in front of the first application module.
TABLE 2
Module identification Version information Storage address
Second application module K3 1.0 M:\K3
Second application module K2 1.0 M:\K2
Second application module K1 2.0 M:\K1
First application module 2.0 M:\N
In addition, in an embodiment of the present invention, when the application module needs to be updated, the server may find the application module to be updated according to the unique identifier of the application module and the dependency graph, and update the application module to be updated separately. For example, when a first application module is updated, a developer forms update information according to an update file and a unique identifier of the first application module, that is, when the first application file is updated, the developer uploads a file related to the first application module to a server again and submits the unique identifier of the first application module, and the server can determine a first application module to be updated from a plurality of application modules stored in the server according to the received update information related to the first application module and dependency graphs of the plurality of application modules, and update the first application module according to the update file of the first application module. Therefore, the independent updating of the application module is realized without being influenced by other application module pairs with dependency relationship, and the maintainability of the application is further improved.
According to the method for loading the application modules, disclosed by the embodiment of the invention, when the client uses the application, the client sends the application request related to the first application module to the server according to the requirement, and when the dependency relationship related to the first application module returned by the server according to the application request is received, the second application module is loaded according to one or more second application modules which are depended by the first application module and indicated by the dependency relationship, and the first application module is applied. Therefore, the first application module is dynamically loaded according to the requirement of using the application and the dependency relationship returned by the server.
In addition, the server side can update the first application module according to the received update information about the first application module, so that the application module is updated independently without being influenced by other application module pairs with dependency relationship, and the maintainability of the application is further improved.
To sum up, the method for loading an application module provided in the embodiment of the present invention may at least include the steps shown in fig. 9:
step S901: and the client sends an application request related to the first application module to the server according to the user trigger.
Step S902: the server side determines a dependency relation related to a first application module according to an application request, wherein the dependency relation indicates that the first application module depends on one or more second application modules.
Step S903: the server side returns the dependency relationship to the client side.
Step S904: and the client loads the second application module according to the dependency relationship so as to apply the first application module.
As shown in fig. 10, an embodiment of the present invention further provides a client 1000 for loading an application module, including: a request sending module 1001, a dependency relationship receiving module 1002 and an application loading module 1003; wherein the content of the first and second substances,
the request sending module 1001 is configured to send an application request related to a first application module to a server;
the dependency relationship receiving module 1002 is configured to receive a dependency relationship, returned by the server according to the application request, about the first application module, where the dependency relationship indicates that the first application module depends on one or more second application modules;
the application loading module 1003 is configured to load the second application module according to the dependency relationship to apply the first application module.
In an embodiment of the present invention, the application loading module 1003 is configured to determine whether the second application module is stored locally; if yes, calling the second application module stored locally; and if not, downloading the second application module from the server.
In an embodiment of the present invention, when the dependency further indicates version information of the second application module, the application loading module 1003 is configured to determine whether locally stored version information of the second application module is consistent with the version information of the second application module indicated by the dependency; if yes, executing the second application module stored locally by the calling; and if not, downloading a second application module from the server.
In an embodiment of the present invention, the application loading module 1003 is configured to determine whether the first application module is stored locally; if yes, calling the first application module stored locally; and if not, downloading the first application module from the server.
In an embodiment of the present invention, when the dependency relationship further indicates version information of one or more second application modules on which the first application module depends, the application loading module 1003 is configured to determine whether locally stored version information of the first application module is consistent with the version information of the first application module indicated by the dependency relationship; if yes, executing the first application module stored locally; and if not, downloading a second application module from the server.
In an embodiment of the present invention, an event notification mechanism between the first application module and the second application module, and/or between a plurality of 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 is different from the first application module and/or the second application module loaded last time, the event notification mechanism does not need to be changed.
In one embodiment of the 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.
According to the client for loading the application modules, provided by the embodiment of the invention, when the client uses the application, the client sends the application request related to the first application module to the server according to the requirement, and when the dependency relationship related to the first application module returned by the server according to the application request is received, the second application module is loaded according to the first application module indicated by the dependency relationship and one or more second application modules depended on by the first application module, and the first application module is applied. Therefore, the first application module is dynamically loaded according to the requirement of using the application and the dependency relationship returned by the server.
Moreover, when the first/second application module is loaded, when the first/second application module is locally stored, the first/second application module can be directly called, and when the first/second application module is not locally stored, the client can download the corresponding first/second application module from the server. The client does not need to store all the application modules corresponding to the application, and when the application modules need to be loaded, the corresponding application modules can be downloaded from the server in time, so that the size of the application installed on the client is reduced, the maintenance flow of the application is simplified, and the maintainability of the application is improved.
In addition, an event notification mechanism between the first application module and the second application module in the client is independent from the first application module and the second application module, so that when the first application module and the second application module loaded at this time are different from the first application module and the second application module loaded at the previous time due to the fact that the first application module and the second application module are updated or the first application module is downloaded again, the event notification mechanism does not need to be changed, the first application module and the second application module are enabled to communicate through a custom event, coupling of a code or a file level is avoided, and maintainability of the application is further improved.
As shown in fig. 11, an embodiment of the present invention further provides a server 1100 for loading an application module, including: a request receiving module 1101 and a dependency relationship sending module 1102; wherein the content of the first and second substances,
the request receiving module 1101 is configured to receive an application request sent by a client and related to a first application module;
the dependency relationship sending module 1102 is configured to determine, according to the application request, a dependency relationship about the first application module, and send the dependency relationship to the client, where 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.
In an embodiment of the present invention, the dependency relationship sending module 1102 is further configured 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 constructing a dependency relationship between the first application module and the second application module according to the registration information.
In an embodiment of the present invention, the dependency relationship sending module 1102 is further configured to receive update information about the first application module; and updating the first application module according to the updating information.
According to the server side for loading the application modules, disclosed by the embodiment of the invention, when the client side uses the application, the client side sends the application request about the first application module to the server side according to the requirement, and when the dependency relationship about the first application module returned by the server side according to the application request is received, the second application module is loaded according to the first application module indicated by the dependency relationship and one or more second application modules depended on by the first application module, and the first application module is applied. Therefore, the first application module is dynamically loaded according to the requirement of using the application and the dependency relationship returned by the server.
In addition, the server side can update the first application module according to the received update information about the first application module, so that the application module is updated independently without being influenced by other application module pairs with dependency relationship, and the maintainability of the application is further improved.
Fig. 12 shows an exemplary system architecture 1200 of a method for loading an application module or an apparatus for loading an application module to which an embodiment of the present invention may be applied.
As shown in fig. 12, the system architecture 1200 may include terminal devices 1201, 1202, 1203, a network 1204 and a server 1205. Network 1204 is the medium used to provide communication links between terminal devices 1201, 1202, 1203 and server 1205. Network 1204 may include various types of connections, such as wire, wireless communication links, or fiber optic cables, to name a few.
A user may use terminal devices 1201, 1202, 1203 to interact with a server 1205 through a network 1204 to receive or send messages, etc. The terminal devices 1201, 1202, 1203 may have installed thereon various communication client applications, such as a shopping application, a web browser application, a search application, an instant messaging tool, a mailbox client, social platform software, and the like.
The terminal devices 1201, 1202, 1203 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 1205 may be a server that provides various services, such as a background management server that supports shopping websites browsed by users using the terminal devices 1201, 1202, 1203. The background management server may analyze and perform other processing on the received data such as the product information query request, and feed back a processing result (e.g., target push information and product information) to the terminal device.
It should be noted that the method for loading the application module provided by the embodiment of the present invention is generally executed by the server 1205, and accordingly, the apparatus for loading the application module is generally disposed in the server 1205.
It should be understood that the number of terminal devices, networks, and servers in fig. 12 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 13, shown is a block diagram of a computer system 1300 suitable for use with a terminal device implementing an embodiment of the present invention. The terminal device shown in fig. 13 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiment of the present invention.
As shown in fig. 13, the computer system 1300 includes a Central Processing Unit (CPU)1301 that 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 section 1308 into a Random Access Memory (RAM) 1303. In the RAM 1303, various programs and data necessary 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 bus 1304.
The following components are connected to the I/O interface 1305: an input portion 1306 including a keyboard, a mouse, and the like; an output section 1307 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 1308 including a hard disk and the like; and a communication section 1309 including a network interface card such as a LAN card, a modem, or the like. 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, or the like is mounted on the drive 1310 as necessary, so that a computer program read out therefrom is mounted into the storage portion 1308 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such embodiments, the computer program may be downloaded and installed from a network via communications component 1309 and/or installed from removable media 1311. The computer program executes the above-described functions defined in the system of the present invention when executed by a Central Processing Unit (CPU) 1301.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor includes a request sending module, a dependency receiving module, and an application loading module. The names of the modules do not form a limitation on the modules themselves in some cases, for example, the request sending module may also be described as a module sending an application request about a first application module to a server.
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: sending an application request about a first application module to a server; receiving a dependency relationship which is returned by the server according to the application request and relates to the first application module, wherein the dependency relationship indicates that the first application module is dependent on one or more second application modules; and loading the second application module according to the dependency relationship so as to apply the first application module.
According to the technical scheme of the embodiment of the invention, when the client uses the application, the client sends the application request about the first application module to the server according to the requirement, and when the dependency relationship about the first application module returned by the server according to the application request is received, the second application module is loaded according to the first application module indicated by the dependency relationship and one or more second application modules depended on by the first application module, and the first application module is applied. Therefore, the first application module is dynamically loaded according to the requirement of using the application and the dependency relationship returned by the server.
Moreover, when the first/second application module is loaded, when the first/second application module is locally stored, the first/second application module can be directly called, and when the first/second application module is not locally stored, the client can download the corresponding first/second application module from the server. The client does not need to store all the application modules corresponding to the application, and when the application modules need to be loaded, the corresponding application modules can be downloaded from the server in time, so that the size of the application installed on the client is reduced, the maintenance flow of the application is simplified, and the maintainability of the application is improved.
Furthermore, the server side can update the first application module according to the received update information about the first application module, so that the application module is updated independently without being influenced by other application module pairs with dependency relationship, and the maintainability of the application is further improved.
In addition, an event notification mechanism between the first application module and the second application module in the client is independent from the first application module and the second application module, so that when the first application module and the second application module loaded at this time are different from the first application module and the second application module loaded at the previous time due to the fact that the first application module and the second application module are updated or the first application module is downloaded again, the event notification mechanism does not need to be changed, the first application module and the second application module are enabled to communicate through a custom event, coupling of a code or a file level is avoided, and maintainability of the application is further improved.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (14)

1. A method for loading an application module, comprising:
sending an application request about a first application module to a server;
receiving a dependency relationship which is returned by the server according to the application request and relates to the first application module, wherein the dependency relationship indicates that the first application module is dependent on one or more second application modules;
and loading the second application module according to the dependency relationship so as to apply the first application module.
2. The method of claim 1, wherein said loading the second application module according to the dependency comprises:
judging whether the second application module is stored locally;
if yes, calling the second application module stored locally;
and if not, downloading the second application module from the server.
3. The method of claim 2, wherein the dependency further indicates version information of the second application module;
when the second application module is stored locally, the method further comprises the following steps:
judging whether locally stored version information of a second application module is consistent with the version information of the second application module indicated by the dependency relationship;
if yes, executing the second application module stored locally by the calling;
and if not, downloading a second application module from the server.
4. The method of claim 1, wherein the applying the first application module comprises:
judging whether the first application module is stored locally;
if yes, calling the first application module stored locally;
and if not, downloading the first application module from the server.
5. The method of claim 4, wherein the dependency further indicates version information of the one or more second application modules;
when the first application module is stored locally, the method further comprises the following steps:
judging whether the locally stored version information of the first application module is consistent with the version information of the first application module indicated by the dependency relationship;
if yes, executing the first application module stored locally;
and if not, downloading a second application module from the server.
6. The method of claim 1,
the event notification mechanism between the first application module and the second application module and/or between a plurality of 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 at this time is different from the first application module and/or the second application module loaded at the previous time, the event notification mechanism does not need to be changed.
7. The method of claim 6,
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.
8. A method for loading an application module, comprising:
receiving an application request about a first application module sent by a client;
and determining a dependency relation related to the first application module according to the application request, and sending the dependency relation to the client, wherein the dependency relation indicates that the first application module depends on one or more second application modules, so that the client loads the second application modules according to the dependency relation and applies the first application modules.
9. The method of claim 8, further comprising:
acquiring registration information of a first application module, wherein the registration information indicates one or more second application modules depended by the first application module;
and constructing a dependency relationship between the first application module and the second application module according to the registration information.
10. The method of claim 9, further comprising:
receiving update information regarding the first application module;
and updating the first application module according to the updating information.
11. A client for loading an application module, comprising: the device comprises a request sending module, a dependency relationship receiving module and an application loading module; wherein the content of the first and second substances,
the request sending module is used for sending an application request related to the first application module to the server;
the dependency relationship receiving module is configured to receive a dependency relationship, which is returned by the server according to the application request and relates to the first application module, where the dependency relationship indicates that the first application module depends on one or more second application modules;
and the application loading module is used for loading the second application module according to the dependency relationship so as to apply the first application module.
12. A server for loading an application module, comprising: the device comprises a request receiving module and a dependency relationship sending module; wherein the content of the first and second substances,
the request receiving module is used for receiving an application request which is sent by a client and related to a first application module;
the dependency relationship sending module is configured to determine a dependency relationship about the first application module according to the application request, and send the dependency relationship to the client, where 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 modules according to the dependency relationship and applies the first application module.
13. An electronic device for loading an application module, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-7 or 8-10.
14. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-7 or 8-10.
CN202010001638.2A 2020-01-02 2020-01-02 Method for loading application module, client and server Pending CN113064662A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010001638.2A CN113064662A (en) 2020-01-02 2020-01-02 Method for loading application module, client and server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010001638.2A CN113064662A (en) 2020-01-02 2020-01-02 Method for loading application module, client and server

Publications (1)

Publication Number Publication Date
CN113064662A true CN113064662A (en) 2021-07-02

Family

ID=76558112

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010001638.2A Pending CN113064662A (en) 2020-01-02 2020-01-02 Method for loading application module, client and server

Country Status (1)

Country Link
CN (1) CN113064662A (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100017503A1 (en) * 2006-12-07 2010-01-21 Hong Soog Kim Download server and method for installing and updating application program using partitioning of shared library
CN101861567A (en) * 2007-11-16 2010-10-13 诺基亚公司 Methods, apparatuses and computer program product for automatic download of software dependencies on installation
CN102520932A (en) * 2011-11-25 2012-06-27 福州博远无线网络科技有限公司 System used for managing service module on movement equipment
CN102929643A (en) * 2012-11-09 2013-02-13 北京中电普华信息技术有限公司 Method and system developing Java 2 platform enterprise edition (J2EE) application
US20160100030A1 (en) * 2014-10-06 2016-04-07 Linkedin Corporation Dynamic loading of routes in a single-page application
CN106095458A (en) * 2016-06-20 2016-11-09 腾讯科技(深圳)有限公司 The management method of plug-in unit and device in a kind of application program
CN106375567A (en) * 2016-08-31 2017-02-01 广州品唯软件有限公司 Plug-in release method and system, client and server
CN107329785A (en) * 2017-06-27 2017-11-07 郑州云海信息技术有限公司 A kind of method and system of dynamic load JavaScript modules

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100017503A1 (en) * 2006-12-07 2010-01-21 Hong Soog Kim Download server and method for installing and updating application program using partitioning of shared library
CN101861567A (en) * 2007-11-16 2010-10-13 诺基亚公司 Methods, apparatuses and computer program product for automatic download of software dependencies on installation
CN102520932A (en) * 2011-11-25 2012-06-27 福州博远无线网络科技有限公司 System used for managing service module on movement equipment
CN102929643A (en) * 2012-11-09 2013-02-13 北京中电普华信息技术有限公司 Method and system developing Java 2 platform enterprise edition (J2EE) application
US20160100030A1 (en) * 2014-10-06 2016-04-07 Linkedin Corporation Dynamic loading of routes in a single-page application
CN107250981A (en) * 2014-10-06 2017-10-13 邻客音公司 Route dynamic load in single page application
CN106095458A (en) * 2016-06-20 2016-11-09 腾讯科技(深圳)有限公司 The management method of plug-in unit and device in a kind of application program
CN106375567A (en) * 2016-08-31 2017-02-01 广州品唯软件有限公司 Plug-in release method and system, client and server
CN107329785A (en) * 2017-06-27 2017-11-07 郑州云海信息技术有限公司 A kind of method and system of dynamic load JavaScript modules

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
贺嘉贝;: "基于P2P的局域网多线程共享软件设计", 电脑编程技巧与维护, no. 08, 18 April 2016 (2016-04-18) *

Similar Documents

Publication Publication Date Title
CN107302597B (en) Message file pushing method and device
CN112148711A (en) Processing method and device for batch processing tasks
CN113495921A (en) Routing method and device of database cluster
CN111427701A (en) Workflow engine system and business processing method
CN110706093A (en) Accounting processing method and device
CN111460129A (en) Method and device for generating identification, electronic equipment and storage medium
CN111666293A (en) Database access method and device
CN112835904A (en) Data processing method and data processing device
CN107347093B (en) Configuration method and device for distributed server system
CN111478781A (en) Message broadcasting method and device
CN112817562A (en) Service processing method and device
CN113010238A (en) Permission determination method, device and system for micro application call interface
CN113778565A (en) Interface data processing method and device
CN116737662A (en) Method, device, electronic equipment and storage medium for processing business data
CN111382953A (en) Dynamic process generation method and device
CN113064662A (en) Method for loading application module, client and server
CN111460020B (en) Method, device, electronic equipment and medium for resolving message
CN114625458A (en) Page data processing method and device, electronic equipment and storage medium
CN112835962A (en) Information display method and device, electronic equipment and storage medium
CN113760487A (en) Service processing method and device
CN113448652A (en) Request processing method and device
CN112559001A (en) Method and device for updating application
CN113157354A (en) Method, device, equipment and computer readable medium for processing data
CN114253520B (en) Interface code generation method and device
CN113495747B (en) Gray scale release method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination