Application Deployment Method and Device, Electronic Device, and Storage Medium

By configuring container objects and microservice development frameworks, the problem of waste of resources and inefficient deployment in the microservice architecture is solved, and flexible and efficient microservice management and deployment are achieved, and compatible with existing frameworks without learning new frameworks.

CN114398043BActive Publication Date: 2025-07-04DINGTALK (CHINA) INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111682461.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-31
Publication Date
2025-07-04
Estimated Expiration
2041-12-31

AI Technical Summary

Technical Problem

In the microservice architecture, users only need some microservices without other microservices to deploy resources, and the redeployment of some microservices is large, making it difficult to efficiently take into account service resources and deployment efficiency.

Method used

By configuring multiple container objects, each container object is configured with at least the corresponding microservice main method, starting the container object and loading the microservices, using the microservice development framework to realize plug-in management, using the annotation mechanism for resource access and decoupling, and improving deployment efficiency.

Benefits of technology

It realizes flexibility and efficient deployment of microservice management, reduces deployment difficulty, improves deployment efficiency, saves communication and storage resources, and is compatible with existing frameworks without learning new frameworks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114398043B_ABST
    Figure CN114398043B_ABST
Patent Text Reader

Abstract

Embodiments of the present invention provide an application deployment method and apparatus, an electronic device, and a storage medium. The application deployment method includes: configuring a plurality of container objects based on a plurality of microservices of an application program, where each container object is at least configured with a main method of the corresponding microservice; starting the containers of the plurality of container objects; and loading the plurality of microservices through the main methods of the respective microservices. In the solution of the embodiments of the present invention, the plurality of container objects are configured based on the plurality of microservices, enabling the microservices to be managed in the form of container objects, improving the flexibility of microservice management, and eliminating the need to reconfigure the microservices. Additionally, the main method of the corresponding microservice is configured in the container object, so that the main method can be loaded by starting and loading the container object, and then the microservice can be loaded, reducing the deployment difficulty of the microservice and improving the deployment efficiency of the microservice.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to the field of computer technologies, and in particular, to an application deployment method and apparatus, an electronic device, and a storage medium. Background Art

[0002] Microservices are a way to split a monolithic application into multiple microservices on the server side, enabling independent technology selection, independent development, independent deployment, and independent operation and maintenance for each microservice. At the same time, multiple microservices can coordinate and cooperate with each other to finally realize the functions of the application program.

[0003] Based on the characteristics of microservices, splitting a monolithic application into multiple independently deployable microservices realizes the decoupling between the core logic and the extended services. For example, when updating the service logic or function of a microservice, it is not necessary to affect the code and implementation logic of other microservices.

[0004] However, in some scenarios, users only need some of the multiple microservices and do not need other microservices, resulting in a waste of service resources for deploying all the multiple microservices. In addition, since the deployment of multiple microservices is an organic whole, simply splitting them into some microservices will lead to system-level risks, and the workload of redeploying some microservices is too large. Therefore, an efficient application deployment method is needed that can balance service resources and deployment efficiency. Summary of the Invention

[0005] In view of this, embodiments of the present invention provide a microservice development framework, an application startup and development method, an electronic device, and a storage medium to at least partially solve the above problems.

[0006] According to a first aspect of embodiments of the present invention, an application deployment method is provided, including: configuring a plurality of container objects based on a plurality of microservices of an application program, where each container object is at least configured with a main method of the corresponding microservice; starting the containers of the plurality of container objects; and loading the plurality of microservices through the main methods of the plurality of microservices respectively.

[0007] In some other embodiments of the present invention, the configuring a plurality of container objects based on a plurality of microservices of an application program includes: encapsulating the plurality of microservices of the application program into a plurality of plugins, where each plugin is at least configured with a main method of the corresponding microservice; and configuring a plurality of container objects based on the plurality of plugins.

[0008] In some other embodiments of the present invention, the configuration program of the container includes call nodes associated with the multiple container objects. Starting the containers of the multiple container objects and loading the multiple plugins includes: starting the configuration program of the container, and when reaching the call nodes, starting to load the multiple plugins; when the loading of the multiple plugins is completed, continuing to load the configuration program, thereby improving the deployment efficiency of the multiple container objects.

[0009] In some other embodiments of the present invention, the call nodes include annotations of each of the multiple container objects. The starting to load the multiple plugins when reaching the call nodes includes: when reaching the call nodes, loading the multiple plugins through the call relationships corresponding to the respective annotations, thereby further improving the deployment efficiency of the container objects.

[0010] In some other embodiments of the present invention, the multiple plugins include a first plugin and a second plugin. The microservice development framework allows the first plugin and the second plugin to access the resource data of the container, and prohibits the second plugin from accessing the resource data of the first plugin in an inaccessible state, thereby achieving decoupling between multiple microservices.

[0011] In some other embodiments of the present invention, the first plugin is configured to be in an accessible state, and the microservice development framework allows the second plugin to access the resource data of the first plugin, thereby improving the flexibility of data calls between plugins.

[0012] In some other embodiments of the present invention, the accessible state is indicated by a marked accessible annotation in the first plugin, thereby improving the development and deployment efficiency of the microservice.

[0013] In some other embodiments of the present invention, the resource data of the container includes at least one of the common class information, common object information, and common call logic of the multiple microservices, and the resource data of each plugin includes the class information and object information of the corresponding microservice, thereby improving the development and deployment efficiency of the multiple microservices while reducing the coupling between the multiple microservices.

[0014] According to a second aspect of the embodiments of the present invention, there is provided an application deployment device, including: a configuration module configured to configure multiple container objects based on multiple microservices of an application program, and each container object is at least configured with a main method of the corresponding microservice; a first loading module configured to start the containers of the multiple container objects; and a second loading module configured to load the multiple microservices through the main methods of the multiple microservices respectively.

[0015] According to a third aspect of an embodiment of the present invention, an electronic device is provided, including: a processor, a memory, a communication interface, and a communication bus. The processor, the memory, and the communication interface complete communication with each other through the communication bus; the memory is used to store at least one executable instruction, and the executable instruction causes the processor to perform operations corresponding to the method described in the first aspect.

[0016] According to a fourth aspect of an embodiment of the present invention, a computer storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, it implements the method described in the first aspect.

[0017] In the solution of the embodiment of the present invention, multiple container objects are configured based on multiple microservices, enabling microservices to be managed in the form of container objects, improving the flexibility of microservice management without reconfiguring the microservices. In addition, the main method of the corresponding microservice is configured in the container object, so that the main method can be loaded by starting to load the container object, and then the microservice can be loaded, reducing the deployment difficulty of the microservice and improving the deployment efficiency of the microservice. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments recorded in the embodiments of the present invention, and those of ordinary skill in the art can also obtain other drawings based on these drawings.

[0019] Figure 1 It is a flowchart of the steps of an example application deployment method.

[0020] Figure 2 It is a flowchart of the steps of an application deployment method according to an embodiment of the present invention.

[0021] Figure 3A It is a schematic block diagram of an application deployment method according to another embodiment of the present invention.

[0022] Figure 3B It is a plug-in configuration of an application deployment method according to another embodiment of the present invention.

[0023] Figure 4 It is a schematic diagram of an application deployment method according to another embodiment of the present invention.

[0024] Figure 5 It is a structural block diagram of an application deployment device according to another embodiment of the present invention.

[0025] Figure 6 It is a schematic structural diagram of an electronic device according to another embodiment of the present invention. Detailed implementation manners

[0026] To enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments in the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art shall fall within the protection scope of the embodiments of the present invention.

[0027] The following further illustrates the specific implementation of the embodiments of the present invention in conjunction with the accompanying drawings of the embodiments of the present invention.

[0028] The method of splitting the services of an application into multiple microservices ensures the access requirements of a large number of C-end (custom) users and also saves the background maintenance cost of the application.

[0029] For example, Spring Boot can be used to perform the deployment of microservices, which improves the deployment efficiency of microservices. Spring Boot can accelerate the building and development process. Since in the face of a large number of concurrent data accesses, the microservice architecture improves the efficiency of developing and maintaining various application functions. For example, multiple microservices can be deployed to multiple servers respectively, so as to develop, maintain or improve the code of multiple microservices separately. The multiple servers can have independent software resources (such as operating systems, etc.) and hardware resources (such as processors, memories, etc.). Several interfaces for communicating with other microservice programs can be configured for the corresponding microservices in each server, and communication interaction and resource sharing between the microservices are based on the communication interfaces of the servers. Figure 1 An example method for deploying microservices is shown. In step S102, initialize Spring Boot and configure the main method and container object of the microservice. The container object includes the classes and methods called by the main method of the microservice. In step S104, in Spring Boot, load the main method of the microservice. In step S106, Spring Boot uses its own convenient call mechanism such as annotations to call the container object to complete the loading of the entire program of the microservice.

[0030] However, for B-side users, the requirements for specific applications vary. For the development process, the microservices that meet the different needs of customers are intertwined. As the requirements of B-side customers increase, the code maintenance of the microservices of the application becomes extremely inefficient. Specifically, in the case of a relatively high concurrent access volume of the application, there are several microservices on the server side to implement specific application functions. However, in the case of a relatively low concurrent access volume of the application, the deployment methods of multiple microservices increase the deployment cost and maintenance cost, wasting configuration resources.

[0031] Figure 2 It is a step flowchart of an application deployment method according to an embodiment of the present invention. Figure 2 The application deployment method can be implemented using a microservice development framework, and the microservice development framework includes but is not limited to Spring Boot. The microservice development framework is configured with a container, and the container objects in the container can provide the resources called by the microservices, and the container is associated with multiple microservices of the application. The solution of the embodiment of the present invention can be applied to any suitable device with data processing capabilities, including but not limited to: servers such as public clouds, private clouds, and hybrid clouds, or any device with the ability to develop or run microservices.

[0032] The application deployment method of this embodiment includes:

[0033] S2100: Based on multiple microservices of the application, configure multiple container objects, and each container object is at least configured with the main method of the corresponding microservice.

[0034] It should be understood that the plug-in can be a file package of a certain format. For example, a file package in JAR format. The microservice development framework can unpack the file package to obtain the data inside. In addition, the container objects of the container can be configured as file packages of the above format. The file package of the microservice development framework realizes the modularization of program development and the decoupling between modules. In addition, the microservice development framework is configured with a call mechanism based on the file package, and the data in the file package can be accessed or called through annotation. The call mechanism is implemented using multiple levels of basic call templates and exposes an annotation interface to the external user. The annotation can be implemented through specific symbols and resource names, and the resource names include method names, variable names, class names, etc.

[0035] For example, a microservice development framework such as Spring Boot can be started, and a container can be created in the microservice development framework. When developing microservices in the microservice development framework, the container can store the shared resources of multiple functional modules such as microservices. In this example, when developing an application, the container can store the shared resources of multiple microservices.

[0036] It should also be understood that the application deployment method of this embodiment can also split an application into multiple microservices. For example, based on the service scenarios or modules in the application, the application is split into multiple microservices.

[0037] S2200: Start the containers of multiple container objects.

[0038] It should be understood that by means of a plugin, the main method of the microservice is registered as multiple container objects in the container, and the container in turn guides the loading of the main method, further starting the loading of each microservice.

[0039] For example, before configuring the container object, first configure the container or create a new container. Then, configure the programs of multiple microservices as corresponding plugins and associate multiple microservices with the container. After configuring the container, the loading process of the container can be started.

[0040] S2300: Load multiple microservices through the respective main methods of the multiple microservices.

[0041] It should be understood that after starting the loading of the main method of the microservice, the resources required by the microservice will be called again. These resources can be configured as container objects in the above-mentioned container or in other containers.

[0042] It should also be understood that during the process of loading the container, multiple plugins can be associated with the configuration program of the container. In one example, the main method of each microservice can be initialized. After the initialization is completed, the loading of the container can continue. The microservices whose main methods have been initialized can continue the loading of the main method after the container loading is completed until multiple microservices are deployed. In another example, after the main method of the microservice runs to completion, the loading of the container can continue until multiple microservices are deployed.

[0043] For example, the association relationship between the container and multiple microservices of the application can be based on an identifier such as the same keyword. For example, a function name field identical to the programs of multiple microservices can be added to the target running node during container loading. The jump of the loading process can be implemented based on the association relationship, and the current container loading can be aborted. After multiple microservices are loaded, the loading of the container can continue.

[0044] In the solution of the embodiment of the present invention, multiple container objects are configured based on multiple microservices, enabling the management of microservices in the form of container objects, improving the flexibility of microservice management without reconfiguring the microservices. In addition, the main method of the corresponding microservice is configured in the container object, so that the main method can be loaded by starting to load the container object, and then the microservice can be loaded, reducing the deployment difficulty of the microservice and improving the deployment efficiency of the microservice.

[0045] In some other implementation manners of the present invention, based on multiple microservices of an application, multiple container objects are configured, including: encapsulating multiple microservices of the application into multiple plugins, and each plugin is at least configured with a main method of the corresponding microservice; configuring multiple container objects based on the multiple plugins.

[0046] In addition, the multiple microservices may be a subset of the set of all microservices in the application, and the multiple microservices may be arbitrary. Therefore, the embodiments of the present invention improve the flexibility and personalization of microservice deployment.

[0047] In other words, through a single microservice development framework, the deployment of multiple plugins in the same hardware resources and software resources is realized. When the application is started, the plugins corresponding to the multiple microservices and the resource data in the container can be loaded into the memory of the same software resource, realizing the tight coupling between the plugins, and saving communication resources and storage resources.

[0048] In addition, by executing the loading of multiple plugins through the microservice development framework, there is no need to entrust some customer customization requirements to a third-party independent developer for development, nor is it necessary to develop the source code, ensuring data security.

[0049] In addition, the microservice development framework is the SpringBoot framework. Thus, the SpringBoot framework is an efficient microservice development framework, and the compatibility with the existing framework is realized by using this development framework. When starting with SpringBoot, the existing framework is compatible by using the method of SpringBoot to load SpringBoot plugins. For background developers or maintainers, there is no need to learn a new framework and the development habits are not changed.

[0050] In addition, when the project of the application is a SpringBoot project, in terms of data packet management, Maven and Gradle in the Spring framework can still be used for dependency management, further improving the compatibility with the framework.

[0051] In addition, in the SpringBoot plugin, annotations such as @Shareable can be used to export the Bean services in the Spring framework for other plugins to call. The shared classes or resources can be placed in the SpringBoot container for loading. Users such as background developers or maintainers do not need to care about the details of the underlying JAVA class loader (ClassLoader), realizing user imperceptibility.

[0052] In addition, since each Spring Boot plugin can be deployed together, the problems of network interaction and management of a large number of microservices in the microservice approach are solved, and tight coupling between microservices is achieved. For example, when troubleshooting access failures, only one application needs to be concerned, and there is no need to implement data calls based on the communication links between different servers.

[0053] In some other implementation manners of the present invention, the configuration program of the container includes call nodes associated with the multiple container objects. The container for starting the multiple container objects and loading the multiple plugins includes: starting the configuration program of the container, and when reaching the call nodes, starting to load the multiple plugins; when the loading of the multiple plugins is completed, continuing to load the configuration program.

[0054] Specifically, when loading each microservice, the main method of the microservice is first loaded. The main method can call classes and methods that are common resources of the container, and can also call container objects that are not common resources, that is, third container objects that are private classes or private objects. When the main method of each microservice is initialized, the deployment of the personalized application can be completed. It should be understood that when starting the container, the main methods of each microservice can be initialized first, and then the loading logic of the container can be continued. Continuing the loading logic of the container does not need to wait until each microservice is loaded. Additionally, the container can also be configured to continue the loading logic of the container after the main methods of each microservice are loaded. In this case, when the loading of the container is completed, the deployment of multiple microservices is completed.

[0055] In some other implementation manners of the present invention, the call nodes include annotations of the multiple container objects respectively. The starting to load the multiple plugins when reaching the call nodes includes: when reaching the call nodes, loading the multiple plugins through the call relationships corresponding to the respective annotations.

[0056] In some other implementation manners of the present invention, the multiple plugins include a first plugin and a second plugin. The microservice development framework allows the first plugin and the second plugin to access the resource data of the container, and prohibits the second plugin from accessing the resource data of the first plugin in an inaccessible state.

[0057] Alternatively, the first plugin is configured to be in an accessible state, and the microservice development framework allows the second plugin to access the resource data of the first plugin. Specifically, the accessible state is indicated by marking an accessible annotation in the first plugin. More specifically, resources such as class information in the SpringBoot container, as well as the Spring context, can be shared by each SpringBoot plugin. Between each SpringBoot plugin, resources such as class information and the Spring context are isolated from each other. If multiple SpringBoot plugins need to share some classes and resources, these classes and resources can be placed in the SpringBoot container. If a certain SpringBoot plugin needs to provide SpringBeans in the Spring framework to be exposed for other SpringBoot plugins to call, an annotation such as @Shareable can be added to the Bean.

[0058] Figure 3A FIG. is a schematic block diagram of an application deployment method according to another embodiment of the present invention. As Figure 3A shown,

[0059] In step S210, the microservice development framework starts the container and executes step S220. Specifically, the container as a container can be started in the way of starting a microservice of SpringBoot.

[0060] In step S220, the microservice development framework loads the relevant logic of the container and executes step S230. Specifically, the target running node (a certain intermediate link) of the Spring process started by the SpringBoot container is used to load the SpringBoot plugin.

[0061] Furthermore, there are three sub-steps in step S230: in step 231, the plugin starts; in step 232, the plugin loading logic; in step 233, the plugin startup is completed, and step S240 is executed. In other words, the SpringBoot plugin loading process can be loaded in the running mode of an independent SpringBoot microservice.

[0062] In step S240, after the plugin startup is completed, the microservice development framework continues to load the logic of the container and executes step 250. When all SpringBoot plugins are loaded, the uncompleted loading logic processing of the SpringBoot container based on the target running node can be performed.

[0063] In step S250, the microservice development framework completes the startup of the container. It should be understood that when the container is loaded, the startup of the entire application is completed.

[0064] Figure 3B It is the plug-in configuration of the application deployment method according to another embodiment of the present invention. The microservice development framework can configure each function of the application into two main parts, including the core base 200 and the custom plug-ins 2000.

[0065] Among them, the core base 200 includes the container 201 and the common plug-ins 202 and 203. The custom plug-ins 2000 include the custom plug-ins 2001, 2002, and 2003.

[0066] For example, the general core base 200 can be the core and general logic module of the application. For example, the common class information included in the container 201, and / or the common plug-ins 202 and 203. The container 201 and the common plug-ins 202 and 203 can provide corresponding services externally and can define abstract interfaces called by each of the custom plug-ins 2001, 2002, or 2003.

[0067] In addition, the custom plug-ins 2001, 2002, or 2003 can be logic modules customized according to the service characteristics of the application. They can use various services provided by the core general base 200 and can also expand the functions of the core base 200 by providing services. Generally speaking, the common plug-ins 202 and 203 in the core base 200 are mandatory during deployment, while the custom plug-ins 2001, 2002, and 2003 are optional. Selecting different service custom plug-ins will result in different service functions provided. For example, the custom plug-in 2001 can be combined with the common plug-in 202 to implement the date message reminder function in the application. The online shopping function in the custom plug-in 2003 can be combined with the address book function in the common plug-in 204 to implement the shopping sharing function.

[0068] In some other implementation manners, the accessible annotation marked in the first plug-in indicates the accessible state. Thus, through the accessible annotation, the convenience of the accessible state configuration is improved, and there is no need to change the call logic of the microservice code.

[0069] In some other implementation manners, the resource data of the container includes at least one of the common class information, common object information, and common call logic of multiple microservices. For example, the resource data of the container includes the common resources of the container and the common plug-ins. The common resources of the container include, but are not limited to, classes and methods related to account information, application interface settings, etc. The common plug-ins include, but are not limited to: address book plug-in, calendar service plug-in, etc. In addition, the resource data of each plug-in includes the class information and object information of the microservice. For example, the service custom plug-ins include, but are not limited to: message service plug-in, work collaboration plug-in, user information plug-in, payment service plug-in, online shopping plug-in, etc.

[0070] Figure 4Schematic diagram of an application deployment method according to another embodiment of the present invention.

[0071] S410: When SpringBoot starts the container, multiple container objects are loaded. Specifically, the multiple container objects include the first container objects of respective service customization plugins, and at least one second container object of at least one common plugin and the third container objects called by each plugin are also configured.

[0072] S420: SpringBoot starts the main method of each microservice respectively. It should be understood that multiple microservices correspond to multiple service customization plugins.

[0073] S430: SpringBoot loads the microservice through the third container object of the container.

[0074] It should be understood that the above-mentioned first container object, second container object, and third container object can be configured in the same container or in different containers.

[0075] More specifically, in the traditional microservice deployment solution, each function such as the account information function, application interface setting function, address book function, calendar service function, message service function, work collaboration function, payment service function, online shopping function, etc. is deployed as a microservice.

[0076] However, in an example of customized microservices, for e-commerce functions such as the payment service function and online shopping function, they are not necessary, while the message service function and work collaboration function are necessary. In the solution of the embodiment of the present invention, the corresponding message microservice and work collaboration microservice can be deployed unifiedly without reconfiguring the programs of the above functions. For example, the codes of the message microservice and the work collaboration microservice can be respectively encapsulated into plugins and used as each container object in the container of the microservice development framework, that is, the above-mentioned first container object.

[0077] In addition, the account information function and application interface setting function can also be implemented as common resources or common plugins of the container. The common plugin can be used as the above-mentioned second container object. The difference between the common resource and the common plugin is that the common resource can be a resource such as a class or a method that can be called, and its life cycle is relatively long and can be called by the methods in the common plugin or the methods of the microservice plugin; the common plugin refers to something that can be combined with the microservice plugin to form a certain function. Generally, the methods in a common plugin can only be called by other microservice plugins combined with it and cannot be called by microservice plugins or other common plugins that have no combination relationship with it. For example, the calendar function and the message service function can be combined to implement the date reminder function, and the message service function can be configured with methods for date reminder. Of course, the calendar function can also be combined with other microservices.

[0078] It should be understood that different microservice plugins can also be combined, and the methods of different microservice plugins in the combination can call each other. The data of the microservice plugins participating in such a combination is less, and data access or data sharing in different microservice plugins can be achieved through the above-mentioned annotation and other methods. There are a large number and various types of microservice plugins that can be combined with the common plugin. Deploying the common plugin as a common resource of the container enables the microservice plugins combined with it to access the common plugin without the need for a call format such as annotation, and there is no need to make major changes to the configuration program of the traditional microservice, greatly improving the deployment efficiency.

[0079] In addition, there may be classes or methods that need to be called between functions such as message services and work collaboration, but they do not need to be combined together to form a certain function. In this case, the annotation in the microservice development framework can still be used for access in different microservice plugins. For example, in the message service, if it is desired to provide users with the function of online file editing and preview in the instant messaging window, it is only necessary to call the document sharing method in the work collaboration in the message service. Because the work collaboration function can have its own interaction interface for scenarios such as online meetings. And in the message service scenario combined with the work collaboration, their implementation methods and user interfaces are different, and combining the two functions or two plugins together will not result in significant deployment efficiency. At this time, it is only necessary to provide an interface for the document sharing method that can be called by the message service in the work collaboration plugin. It should be understood that since the microservice development framework itself provides an annotation call mechanism, it greatly facilitates the interface call efficiency, enabling the personalized deployment efficiency of multiple microservices to be further improved with very little change to the microservice program that has been configured.

[0080] Furthermore, when loading each microservice, first load the main method of the microservice. The main method can call the classes and methods that are the common resources of the container, and can also call the container objects that are not common resources, that is, the third container objects that are private classes or private objects. When the main method of each microservice is initialized, the deployment of the personalized application can be completed. It should be understood that when starting the container, the main methods of each microservice can be initialized first, and then the loading logic of the container can continue. The loading logic of the container does not need to wait until each microservice is loaded. In addition, the container can also be configured to continue the loading logic of the container after the main methods of each microservice are loaded. In this case, when the loading of the container is completed, the deployment of multiple microservices is completed.

[0081] Figure 5The structural block diagram of a microservice development framework according to another embodiment of the present invention. The microservice development framework is configured with a container for storing common resources of individual microservices of an application, and the container is associated with multiple microservices of the application. The solution of the embodiment of the present invention can be applied to any suitable device with data processing capabilities, including but not limited to: servers such as public clouds, private clouds, and hybrid clouds, or any device with the ability to develop or run microservices.

[0082] Figure 5 The microservice development framework includes:

[0083] A configuration module 510, which configures multiple container objects based on multiple microservices of an application, and each container object is at least configured with a main method of the corresponding microservice.

[0084] A first loading module 520, which starts the containers of the multiple container objects.

[0085] A second loading module 530, which loads the multiple microservices through the main methods of the multiple microservices respectively.

[0086] In the solution of the embodiment of the present invention, multiple container objects are configured based on multiple microservices, enabling the management of microservices in the form of container objects, improving the flexibility of microservice management without reconfiguring the microservices. In addition, the main methods of the corresponding microservices are configured in the container objects, so that the main methods can be loaded by starting and loading the container objects, and then the microservices can be loaded, reducing the deployment difficulty of the microservices and improving the deployment efficiency of the microservices.

[0087] In addition, multiple microservices can be a subset of the set of all microservices in an application, and multiple microservices can be arbitrary. Therefore, the embodiment of the present invention improves the flexibility and personalization of microservice deployment.

[0088] In some other embodiments of the present invention, the configuration module is specifically used for: encapsulating multiple microservices of an application into multiple plugins, each plugin is at least configured with a main method of the corresponding microservice, and configuring multiple container objects based on the multiple plugins.

[0089] In some other embodiments of the present invention, the configuration program of the container includes a call node associated with the multiple container objects. The first loading module is specifically used for: starting the configuration program of the container, and starting to load the multiple plugins when reaching the call node; when the loading of the multiple plugins is completed, continuing to load the configuration program, thereby improving the deployment efficiency of the multiple container objects.

[0090] In some other embodiments of the present invention, the calling node includes the annotations of each of the multiple container objects. The first loading module is specifically configured to: when reaching the calling node, load the multiple plugins through the calling relationships corresponding to the respective annotations, thereby further improving the deployment efficiency of the container objects.

[0091] In some other embodiments of the present invention, the multiple plugins include a first plugin and a second plugin. The microservice development framework allows the first plugin and the second plugin to access the resource data of the container, and prohibits the second plugin from accessing the resource data of the first plugin in an inaccessible state, thereby achieving decoupling between multiple microservices.

[0092] In some other embodiments of the present invention, the first plugin is configured to be in an accessible state, and the microservice development framework allows the second plugin to access the resource data of the first plugin, thereby improving the flexibility of data call between plugins.

[0093] In some other embodiments of the present invention, the accessible state is indicated by a mark-accessible annotation in the first plugin, thereby improving the development and deployment efficiency of microservices.

[0094] In some other embodiments of the present invention, the resource data of the container includes at least one of the common class information, common object information, and common call logic of the multiple microservices, and the resource data of each plugin includes the class information and object information of the corresponding microservice, thereby improving the development and deployment efficiency of the multiple microservices while reducing the coupling between the multiple microservices.

[0095] The device of this embodiment is used to implement the corresponding methods in the foregoing multiple method embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be elaborated here. In addition, the function implementation of each module in the device of this embodiment can refer to the description of the corresponding part in the foregoing method embodiments, which will not be elaborated here either.

[0096] Refer to Figure 6 , which shows a schematic structural diagram of an electronic device according to another embodiment of the present invention. The specific implementation of the electronic device is not limited in the specific embodiments of the present invention.

[0097] As Figure 6 shown, the electronic device may include: a processor 602, a communications interface 604, a memory 606, and a communication bus 608.

[0098] Among them:

[0099] The processor 602, the communication interface 604, and the memory 606 communicate with each other via the communication bus 608.

[0100] The communication interface 604 is used to communicate with other electronic devices or servers.

[0101] The processor 602 is used to execute the program 610, and specifically can execute the relevant steps in the above method embodiments.

[0102] Specifically, the program 610 may include program code, and the program code includes computer operation instructions.

[0103] The processor 602 may be a processor CPU, or a specific integrated circuit ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present invention. One or more processors included in the intelligent device may be of the same type of processor, such as one or more CPUs; or may be of different types of processors, such as one or more CPUs and one or more ASICs.

[0104] The memory 606 is used to store the program 610. The memory 606 may include high-speed RAM memory, and may also include non-volatile memory, such as at least one disk memory.

[0105] Specifically, the program 610 can be used to cause the processor 502 to perform the following operations: configure a plurality of container objects based on multiple microservices of the application program, where each container object is at least configured with the main method of the corresponding microservice; start the containers of the plurality of container objects; and load the plurality of microservices through the main methods of the respective microservices.

[0106] In addition, for the specific implementation of each step in the program 610, reference can be made to the corresponding steps and descriptions in the corresponding units in the above method embodiments, which will not be elaborated here. Those skilled in the art can clearly understand that for the convenience and conciseness of description, the specific working processes of the above-described devices and modules can refer to the corresponding process descriptions in the foregoing method embodiments, which will not be elaborated here.

[0107] It should be noted that according to the needs of implementation, the various components / steps described in the embodiments of the present invention can be split into more components / steps, or two or more components / steps or partial operations of components / steps can be combined into new components / steps to achieve the purpose of the embodiments of the present invention.

[0108] The method according to an embodiment of the present invention can be implemented in hardware, firmware, or be implemented as software or computer code that can be stored in a recording medium (such as a CD ROM, RAM, floppy disk, hard disk, or magneto-optical disk), or be implemented as computer code originally stored in a remote recording medium or a non-transitory machine-readable medium and downloaded through a network and to be stored in a local recording medium, so that the method described herein can be stored in such software processing on a recording medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware (such as an ASIC or an FPGA). It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component (such as RAM, ROM, flash memory, etc.) that can store or receive software or computer code, and when the software or computer code is accessed and executed by the computer, the processor, or the hardware, the method described herein is implemented. In addition, when a general-purpose computer accesses the code for implementing the method shown herein, the execution of the code converts the general-purpose computer into a dedicated computer for executing the method shown herein.

[0109] Those of ordinary skill in the art can realize that the units and method steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. A professional technician can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the embodiments of the present invention.

[0110] The above embodiments are only used to illustrate the embodiments of the present invention, rather than to limit the embodiments of the present invention. Those of ordinary skill in the relevant technical field can also make various changes and modifications without departing from the spirit and scope of the embodiments of the present invention. Therefore, all equivalent technical solutions also belong to the scope of the embodiments of the present invention. The patent protection scope of the embodiments of the present invention shall be defined by the claims.

Claims

1. An application deployment method, applied to the SpringBoot framework, includes: Encapsulating multiple microservices of an application into multiple plugins, where each plugin is at least configured with the main method of the corresponding microservice. The multiple plugins are multiple SpringBoot plugins, and the multiple plugins include a first plugin and a second plugin. The SpringBoot framework prohibits the second plugin from accessing the resource data of the first plugin in an inaccessible state, and allows the second plugin to access the resource data of the first plugin in an accessible state. The first plugin is in the accessible state by adding a shareable annotation through a Bean. Based on the multiple plugins, configuring multiple container objects, where each container object is at least configured with the main method of the corresponding microservice. Starting the containers of the multiple container objects. Loading the multiple microservices through the main methods of the multiple microservices respectively.

2. The method according to claim 1, wherein, The configuration program of the container includes call nodes associated with the multiple container objects. The starting the containers of the multiple container objects includes: Starting the configuration program of the container, and when reaching the call nodes, starting to load the multiple plugins. When the loading of the multiple plugins is completed, continuing to load the configuration program.

3. The method according to claim 2, wherein The call nodes include the annotations of the multiple container objects respectively. The when reaching the call nodes, starting to load the multiple plugins includes: When reaching the call nodes, loading the multiple plugins through the call relationships corresponding to the respective annotations.

4. The method according to claim 1, wherein The microservice development framework allows the first plugin and the second plugin to access the resource data of the container.

5. The method according to claim 4, wherein The resource data of the container includes at least one of the common class information, common object information, and common call logic of the multiple microservices, and the resource data of each plugin includes the class information and object information of the corresponding microservice.

6. An application deployment device, applied to the SpringBoot framework, includes: A configuration module that encapsulates multiple microservices of an application into multiple plugins, where each plugin is at least configured with the main method of the corresponding microservice. Based on the multiple plugins, configuring multiple container objects, where each container object is at least configured with the main method of the corresponding microservice. Among them, the multiple plugins are multiple SpringBoot plugins, and the multiple plugins include a first plugin and a second plugin. The SpringBoot framework prohibits the second plugin from accessing the resource data of the first plugin in an inaccessible state, and allows the second plugin to access the resource data of the first plugin in an accessible state. The first plugin is in the accessible state by adding a shareable annotation through a Bean. A first loading module that starts the containers of the multiple container objects. A second loading module that loads the multiple microservices through the main methods of the multiple microservices respectively.

7. An electronic device, comprising: A processor, a memory, a communication interface, and a communication bus. The processor, the memory, and the communication interface complete communication with each other through the communication bus. The memory is used to store at least one executable instruction, and the executable instruction causes the processor to perform operations corresponding to the method described in any one of claims 1-5.

8. A computer storage medium, on which a computer program is stored, and when the program is executed by a processor, the method described in any one of claims 1-5 is implemented.

Citation Information

Patent Citations

  • Service calling link analysis method and system

    CN106790718A

  • Application running method and device and storage medium

    CN112000353A