Microservice development method and system

By creating microservice templates and creating business modules in microservice development, the problems of high development costs and low development efficiency of online microservices are solved, and a more flexible and convenient development process and more efficient resource utilization are achieved.

CN114115890BActive Publication Date: 2025-05-13CHINESE SCI CLOUD COMPUTING ACAD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111266721.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-28
Publication Date
2025-05-13
Estimated Expiration
2041-10-28

AI Technical Summary

Technical Problem

Online development of microservices has problems such as high development costs and low development efficiency.

Method used

By creating a microservice template, creating corresponding business modules, generating microservice codes corresponding to the business modules, configuring container deployment projects, compiling microservice projects containing the microservice code and container deployment projects, and obtaining executable microservices.

Benefits of technology

It simplifies the code writing content of developers, makes the development of business modules more flexible and convenient, reduces development costs and improves development efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114115890B_ABST
    Figure CN114115890B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of microservice development technology, and discloses a microservice development method and system. The microservice development method includes: making a microservice template corresponding to a target microservice; creating a business module corresponding to the target microservice; obtaining the business code of the business module and the code configuration information of the target microservice; generating the microservice code corresponding to the business module based on the microservice template, the business code and the code configuration information; configuring the container deployment project corresponding to the target microservice; executing the project compilation instruction to compile the microservice project containing the microservice code and the container deployment project, obtain an executable microservice and start running. The present invention simplifies the code writing content of developers, makes the development of business modules more flexible and convenient, and reduces the development cost and maintenance cost of microservices.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of microservice development, and in particular to a microservice development method and system. Background Art

[0002] The traditional software development method is to design a database model, build a project framework, and then implement each layer of business logic based on the project framework in combination with actual business needs, including front-end, back-end, and front-end and back-end functional joint debugging. If there are changes, all development processes need to be redone. The traditional development method is cumbersome and complex, inefficient, and due to differences in naming habits and levels among developers, the quality of the code is different, which has a great impact on the project.

[0003] The existing development platform has solved the tedious problems of traditional software development to a certain extent. Most functions can generate front-end and back-end codes through online configuration, but it still requires manual creation of sub-projects, writing container deployment configurations, and compiling, packaging, deploying, and starting a series of repetitive tasks. This consumes a lot of manpower costs and is inefficient. In addition, different developers have different naming habits, poor code readability, and is not conducive to code maintenance. Summary of the invention

[0004] The main purpose of the present invention is to provide a microservice development method and system, aiming to solve the technical problems of high development cost and low development efficiency in online microservice development.

[0005] A first aspect of the present invention provides a microservice development method, comprising:

[0006] Create a microservice template corresponding to the target microservice;

[0007] Create a business module corresponding to the target microservice;

[0008] Obtain the business code of the business module and the code configuration information of the target microservice;

[0009] Generate a microservice code corresponding to the business module based on the microservice template, the business code and the code configuration information;

[0010] Configure the container deployment project corresponding to the target microservice;

[0011] Execute the project compilation instruction to compile the microservice project containing the microservice code and the container deployment project to obtain an executable microservice and start running it.

[0012] Optionally, in a first implementation of the first aspect of the present invention, the microservice template corresponding to the target microservice includes: a basic program and a container deployment template;

[0013] The basic program includes a Java program built with Maven, the container deployment template includes a Docker-Compose service configuration template, and the Java program includes a main program entry class, a microservice configuration file, and a project build file.

[0014] Optionally, in a second implementation of the first aspect of the present invention, creating a business module corresponding to the target microservice includes:

[0015] Create a business module corresponding to the target microservice;

[0016] Enter the table name, form style and form attribute fields corresponding to the business module, and generate the business form corresponding to the business module;

[0017] Synchronize the business form with a preset database, and after the database synchronization is successful, perform a functional test on the business form;

[0018] If the functional test meets expectations, it is confirmed that the business module has been developed successfully, otherwise the business form is re-edited and functional testing is performed until the business form meets expectations.

[0019] Optionally, in a third implementation of the first aspect of the present invention, the code configuration information includes: a business module name, a service port number, and a microservice template name.

[0020] Optionally, in a fourth implementation of the first aspect of the present invention, the configuring the container deployment project corresponding to the target microservice includes:

[0021] Obtain the compilation and packaging configuration corresponding to the target microservice and the containerized deployment configuration corresponding to Docker-Compose and add them to the container deployment project corresponding to the target microservice;

[0022] Modify the containerized deployment configuration and microservice startup script corresponding to the container deployment project.

[0023] Optionally, in a fifth implementation of the first aspect of the present invention, the microservice development method further includes:

[0024] When executing the project compilation instruction, copy the executable jar package and the corresponding Dockerfile file of the newly added microservice project to the specified directory.

[0025] Optionally, in a sixth implementation of the first aspect of the present invention, after compiling the container deployment project to obtain an executable microservice and start running it, it also includes:

[0026] Create a function menu option for the target microservice;

[0027] Associating the URI of the business module with the function menu option;

[0028] Based on the function menu options, functional verification is performed on the business module;

[0029] If the verification is successful, it is determined that the target microservice is developed successfully, otherwise it returns to modify the business module and re-perform functional verification.

[0030] A second aspect of the present invention provides a microservice development system, comprising:

[0031] Template creation module, used to create microservice templates corresponding to target microservices;

[0032] A business creation module, used to create a business module corresponding to the target microservice;

[0033] A code acquisition module is used to acquire the business code of the business module and the code configuration information of the target microservice;

[0034] A code generation module, used to generate a microservice code corresponding to the business module based on the microservice template, the business code and the code configuration information;

[0035] A project configuration module, used to configure the container deployment project corresponding to the target microservice;

[0036] The project compilation module is used to compile the microservice project containing the microservice code and the container deployment project to obtain an executable microservice and start running it.

[0037] Optionally, in a first implementation of the second aspect of the present invention, the template making module is specifically used to: make a basic program and a container deployment template;

[0038] The basic program includes a Java program built with Maven, the container deployment template includes a Docker-Compose service configuration template, and the Java program includes a main program entry class, a microservice configuration file, and a project build file.

[0039] Optionally, in a second implementation of the second aspect of the present invention, the service creation module includes:

[0040] A module creation unit, used to create a business module corresponding to the target microservice;

[0041] A form generation unit, used to input the table name, form style and form attribute fields corresponding to the business module, and generate a business form corresponding to the business module;

[0042] The form testing unit is used to synchronize the business form with a preset database. After the database synchronization is successful, the business form is functionally tested. If the functional test meets expectations, it is confirmed that the business module has been successfully developed. Otherwise, the business form is re-edited and functionally tested until the business form meets expectations.

[0043] Optionally, in a third implementation of the second aspect of the present invention, the code configuration information in the code acquisition module includes: a business module name, a service port number, and a microservice template name.

[0044] Optionally, in a fourth implementation of the second aspect of the present invention, the engineering configuration module includes:

[0045] Project configuration unit: specifically used to obtain the compilation and packaging configuration corresponding to the target microservice and the containerized deployment configuration corresponding to Docker-Compose and add them to the container deployment project corresponding to the target microservice;

[0046] Project modification unit: specifically used to modify the containerized deployment configuration and microservice startup script corresponding to the container deployment project;

[0047] Optionally, in a fifth implementation of the second aspect of the present invention, the microservice development system is further specifically used for:

[0048] When executing the project compilation instruction, copy the executable jar package and the corresponding Dockerfile file of the newly added microservice project to the specified directory.

[0049] Optionally, in a sixth implementation of the second aspect of the present invention, the microservice development system further includes:

[0050] A menu creation module, used to create function menu options for the target microservice;

[0051] A business association module, used to associate the URI of the business module with the function menu option;

[0052] The business function verification module is used to perform function verification on the business module based on the function menu option; if the verification passes, it is determined that the target microservice is developed successfully, otherwise it returns to modify the business module and re-perform function verification.

[0053] The technical solution provided by the present invention provides a microservice development system, which creates a corresponding business module by making a microservice template, generates a microservice code corresponding to the business module, configures a container deployment project, compiles the microservice project containing the microservice code and the container deployment project, and obtains an executable microservice. The present invention makes a microservice template, adds a business module on the basis of the microservice template, and performs containerized deployment configuration to simplify the code writing content of the developer, making the development of the business module more flexible and convenient, and solving the technical problems of high development cost and low development efficiency in online development of microservices. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] Figure 1 This is a schematic diagram of a first embodiment of a microservice development method in an embodiment of the present invention;

[0055] Figure 2 This is a schematic diagram of a second embodiment of the microservice development method in an embodiment of the present invention;

[0056] Figure 3 This is a schematic diagram of a third embodiment of the microservice development method in an embodiment of the present invention;

[0057] Figure 4 This is a schematic diagram of a fourth embodiment of the microservice development method in an embodiment of the present invention;

[0058] Figure 5 A schematic diagram of an embodiment of a microservice development system in an embodiment of the present invention;

[0059] Figure 6 FIG. 2 is a schematic diagram of another embodiment of the microservice development system in an embodiment of the present invention. DETAILED DESCRIPTION

[0060] The embodiment of the present invention provides a microservice development method and system, which obtains an executable microservice by making a microservice template, creating a corresponding business module, generating a microservice code corresponding to the business module, configuring a container deployment project, and compiling a microservice project containing the microservice code and the container deployment project. The present invention makes a microservice template, adds a business module on the basis of the microservice template, and performs containerized deployment configuration to simplify the code writing content of the developer, making the development of the business module more flexible and convenient, and solving the technical problems of high development cost and low development efficiency in online development of microservices.

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

[0062] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 1 , the first embodiment of the microservice development method in the embodiment of the present invention includes:

[0063] 101. Create a microservice template corresponding to the target microservice;

[0064] It is understandable that the execution subject of the present invention may be a microservice development device, or a terminal or a server, which is not limited here. The embodiment of the present invention is described by taking a server as the execution subject as an example.

[0065] In this embodiment, microservices are more flexible by splitting a large single application and service into several or even dozens of supporting microservices, which coordinate and cooperate with each other. The running process of each service is independent and communicates with each other using a lightweight communication mechanism. The target microservices are not limited, that is, the microservices that are expected to be obtained in this round of development are not limited, including but not limited to material management, process management, business management, etc.

[0066] In this embodiment, the microservice template is used as the basis for generating the microservice. On the basis of the microservice template, a business module can be added to form a complete microservice to realize the function of the target microservice.

[0067] Optionally, in one embodiment, the above step 101 further includes: basic program and container deployment template;

[0068] The basic program includes a Java program built with Maven, the container deployment template includes a Docker-Compose service configuration template, and the Java program includes a main program entry class, a microservice configuration file, and a project build file.

[0069] In this optional embodiment, the container is a set of processes with view isolation, resource limitability, and independent file system. View isolation means that some processes can be seen and have independent host names, etc.; resource limitability means that the memory size and the number of CPUs used can be limited; the container has an independent file system. Because it uses system resources, there is no need for kernel-related code or tools in the independent file system. It only needs to provide the binary files, configuration files, and dependencies required by the container. As long as the file set required for the container to run is available, the container can run.

[0070] In this optional embodiment, the basic program is the program part of the microservice template, including but not limited to a Java program built with Maven.

[0071] In this optional embodiment, the container deployment template is a Docker-Compose service configuration template, including but not limited to the container name, dependent container components, host port and container port mapping, and environment parameters.

[0072] In this optional embodiment, Maven is a Java project management tool developed by the Apache Software Foundation for managing project construction, generating reports and documents. Maven centrally manages all dependent packages and can automatically resolve duplication and conflict issues.

[0073] In this optional embodiment, the main program entry class is annotated on the main program to describe the main configuration category of the development framework, and then other related annotations are used to introduce corresponding functions. Annotations include but are not limited to @SpringBootApplication marking the main configuration class of the development framework as an application class, and other related annotations include but are not limited to @EnableDiscoveryClient, and the corresponding function is to enable the registration center to discover and scan the service.

[0074] In this optional embodiment, the microservice configuration file includes configuration items required by the microservice template, including but not limited to the default configuration of the database, the default configuration of the configuration center, and the project template corresponding to the microservice template.

[0075] In this optional embodiment, the project build file contains basic information about the project, which is used to describe how the project is built and declare project dependencies, including but not limited to the Pom.xml build file.

[0076] In this optional embodiment, the Docker-Compose service configuration template is a configuration template of the container management tool software. Docker-Compose can manage multiple containers to form a project, including but not limited to the calling relationship between multiple containers and the commands to start / shut down these containers.

[0077] 102. Create a business module corresponding to the target microservice;

[0078] In this embodiment, the business module refers to the refinement of object elements in the business field and the division of business operations into atomic functions, including but not limited to material management, business processing, process management, etc.

[0079] In this embodiment, the creation method includes but is not limited to creating a form for the business module and entering functional attributes of the business module.

[0080] 103. Obtain the business code of the business module and the code configuration information of the target microservice;

[0081] In this embodiment, the business code refers to the code for designing business logic in a specific project, which is the code for implementing the project under the framework, including but not limited to the code of the business module for form generation.

[0082] In this embodiment, the code configuration information includes but is not limited to the module name, service port, and selected microservice template.

[0083] In this embodiment, the method of obtaining the business code includes but is not limited to generating the business code by using a code acquisition module, and generating the business code by filling in a business code framework according to form input information.

[0084] 104. Generate a microservice code corresponding to the business module based on the microservice template, the business code, and the code configuration information;

[0085] In this embodiment, the generation method includes but is not limited to modifying the corresponding configuration information of the business code and the microservice template code according to the code configuration information, and adding the business code into the template of the microservice code.

[0086] In this embodiment, the microservice code includes but is not limited to a microservice template, code configuration information, and business code.

[0087] 105. Configure a container deployment project corresponding to the target microservice;

[0088] In this embodiment, the container deployment project refers to packaging the project and its dependent packages into an independent package with startup instructions. The container is a space isolated from the server that loads independent packages, including but not limited to container deployment of the business module part, containerizing the business module, and packaging the dependent packages and startup instructions of the business module into one or more independent containers.

[0089] 106. Execute the project compilation instruction to compile the microservice project containing the microservice code and the container deployment project to obtain an executable microservice and start running it.

[0090] In this embodiment, compilation is the process of compiling a program into machine language before the program is run, and after compilation, the program can be directly loaded and executed by the operating system.

[0091] In this embodiment, starting the operation includes but is not limited to starting the executable container part of the microservice through the microservice template and the Docker-Compose startup instruction in the container deployment project; starting the microservice through the startup script.

[0092] In an embodiment of the present invention, a method for developing an executable microservice is provided by making a microservice template, creating a corresponding business module, generating a microservice code corresponding to the business module, configuring a container deployment project, and compiling a microservice project containing the microservice code and the container deployment project. The present invention makes the development of the business module more flexible and convenient by making a microservice template, adding a business module based on the microservice template, and performing containerized deployment configuration to simplify the code writing content of the developer, thereby solving the technical problems of high development cost and low development efficiency in online development of microservices.

[0093] See also Figure 2 , the second embodiment of the microservice development method in the embodiment of the present invention includes:

[0094] 201. Create a microservice template corresponding to the target microservice;

[0095] 202. Create a business module corresponding to the target microservice;

[0096] 203. Enter the table name, form style, and form attribute fields corresponding to the business module, and generate a business form corresponding to the business module;

[0097] In this embodiment, the business form is responsible for data collection functions and is all forms of data submission. It supports easy creation of labels and questions and the use of created fields to enter data, including but not limited to online forms using preset business function attribute fields to collect business-related information.

[0098] In this embodiment, the business form enters various properties displayed by the business module through the form, including but not limited to the table name of the business module, which is the name of the business module form; the style theme of the form style; the form attribute fields include but are not limited to database attributes, page attributes and foreign keys.

[0099] In this embodiment, the form style includes but is not limited to a one-to-one theme template, a one-to-many theme template, a style with one column, and a style with two columns.

[0100] In this embodiment, generating means packaging the table name, form style, and form attribute field information corresponding to the entered business module and saving them in the form of a form.

[0101] 204. Synchronize the business form with a preset database. After the database synchronization is successful, perform a functional test on the business form.

[0102] In this embodiment, the preset database includes but is not limited to the business form content, the storage address of the business form, and the backup of the business form.

[0103] In this embodiment, functional testing is to test the functions embodied in the business form to observe whether the expected functions are achieved, and to add, delete, and modify the content of the form based on the results, including but not limited to functional testing of the logistics management business form to observe whether the logistics query function can be achieved. If it can be achieved, proceed to the next step. If not, modify the form.

[0104] In this embodiment, database synchronization includes but is not limited to an operation of storing the form in the database and an operation of making the modified form consistent with the content in the database.

[0105] 205. If the functional test meets expectations, it is confirmed that the business module is developed successfully; otherwise, the business form is re-edited and functional testing is performed until the business form meets expectations;

[0106] In this embodiment, the functional test meets expectations, including but not limited to the logistics management business form, where the expected function is logistics query. After the functional test, the form can realize the logistics query function, and the functional test meets expectations.

[0107] In this embodiment, editing refers to adding, deleting and modifying the information entered into the business form, including but not limited to the table name of the business module, which is the name of the business module form; the style theme of the form style; the form attribute fields include but are not limited to database attributes, page attributes and foreign keys.

[0108] 206. Obtain the business code of the business module and the code configuration information of the target microservice;

[0109] Optionally, in one embodiment, the code configuration information in the above step 206 further includes: a business module name, a service port number, and a microservice template name.

[0110] In this optional embodiment, the business module names include but are not limited to logistics management, process management, and customer management.

[0111] In this optional embodiment, the service port number is the request port when the program initiates a connection to the server.

[0112] In this optional embodiment, the microservice template name is named according to the difference between the microservice program part and the container part, so as to distinguish different microservice templates.

[0113] 207. Generate a microservice code corresponding to the business module based on the microservice template, the business code, and the code configuration information;

[0114] 208. Configure a container deployment project corresponding to the target microservice;

[0115] 209. Execute the project compilation instruction to compile the microservice project containing the microservice code and the container deployment project to obtain an executable microservice and start running it.

[0116] In an embodiment of the present invention, a business module is generated through form entry and testing based on a microservice template, and code generation and containerized deployment configuration are performed to simplify the code writing process for developers, making the development of business modules more intuitive and convenient, and solving the problem of poor code readability caused by different coding habits of developers.

[0117] See also Figure 3 , a third embodiment of the microservice development method in the embodiment of the present invention includes:

[0118] 301. Create a microservice template corresponding to the target microservice;

[0119] 302. Create a business module corresponding to the target microservice;

[0120] 303. Obtain the business code of the business module and the code configuration information of the target microservice;

[0121] 304. Generate a microservice code corresponding to the business module based on the microservice template, the business code, and the code configuration information;

[0122] 305. Obtain the compilation and packaging configuration corresponding to the target microservice and the containerized deployment configuration corresponding to Docker-Compose and add them to the container deployment project corresponding to the target microservice;

[0123] In this embodiment, the compilation and packaging configuration is the compiled executable jar package of the target microservice project and the related configuration in the build file Pom.xml.

[0124] In this embodiment, the image is a lightweight, executable, independent software package used to package the microservice operating environment and the microservices developed based on the operating environment, including but not limited to all the content required to run the microservice, code, runtime, library, environment variables and configuration files.

[0125] In this embodiment, the containerized deployment configuration corresponding to Docker-Compose is the Dockerfile configuration file, which is used to write scripts for modification, installation, construction, and operation commands for each layer. This script is used to build and customize the image, including but not limited to basic image information, maintainer information, image operation instructions, and instructions executed when the container is started.

[0126] 306. Modify the containerized deployment configuration and microservice startup script corresponding to the container deployment project;

[0127] In this embodiment, the modification includes but is not limited to modifying the containerized deployment configuration corresponding to the container deployment project, the module name of the microservice startup script, the service port, and the microservice template.

[0128] In this embodiment, containerized deployment configuration refers to the operation of containerizing the business module and configuring the corresponding image and execution instructions for the container, including but not limited to Dockerfile configuration files, build files, and dependency packages.

[0129] In this embodiment, the microservice startup script is a script file for starting the microservice, including but not limited to the Install.sh script.

[0130] In this embodiment, packaging refers to packaging the build files, microservice startup scripts, and microservice codes required for containerized deployment configuration into a jar package and copying it to the business module directory.

[0131] 307. Execute the project compilation instruction to compile the microservice project containing the microservice code and the container deployment project to obtain an executable microservice and start running it.

[0132] In an embodiment of the present invention, a container configuration method for a microservice is provided, and the corresponding compilation and packaging configuration and containerized deployment configuration are added to the container deployment project, and the startup script is modified and added. By configuring the container deployment project, this embodiment simplifies the code writing content of the developer, more efficiently utilizes resources and hardware, and reduces labor costs and resource consumption.

[0133] See also Figure 4 The fourth embodiment of the microservice development method in the embodiment of the present invention includes:

[0134] 401. Create a microservice template corresponding to the target microservice;

[0135] 402. Create a business module corresponding to the target microservice;

[0136] 403. Obtain the business code of the business module and the code configuration information of the target microservice;

[0137] 404. Generate a microservice code corresponding to the business module based on the microservice template, the business code, and the code configuration information;

[0138] 405. Configure a container deployment project corresponding to the target microservice;

[0139] 406. Execute the engineering compilation instruction to compile the microservice engineering including the microservice code and the container deployment engineering to obtain an executable microservice and start running it;

[0140] 407. Create a function menu option for the target microservice;

[0141] In this embodiment, the function menu options list the function items one by one in the form of a menu, which are various service options in the application, including but not limited to the main function menu option of logistics management, which has sub-function menu options such as logistics query, logistics transportation, and logistics storage.

[0142] In this embodiment, the creation method includes but is not limited to adding new function menu options, naming and sorting the function menu options, and configuring menu option components.

[0143] 408. Associating the URI of the business module with the function menu option;

[0144] In this embodiment, the URI of the service module is a Uniform Resource Identifier (URI), which means that each available resource on the Web, such as HTML documents, images, video clips, programs, etc., is identified by a URI.

[0145] In this embodiment, the associated items include, but are not limited to, configuring the URI of the service module for the function menu option.

[0146] 409. Based on the function menu option, perform function verification on the business module;

[0147] In this embodiment, functional verification includes but is not limited to testing and verifying the functions embodied in the function menu options, observing whether the expected business module functions are realized, and adding, deleting, and modifying the business modules based on the results, including but not limited to functional verification of the logistics management business options, observing whether the logistics query function can be realized. If it can be realized, the microservice development is successful. If not, the business module is modified.

[0148] 410. If the verification is successful, it is determined that the target microservice is developed successfully, otherwise return to modify the business module and re-perform functional verification.

[0149] In the embodiment of the present invention, after the microservice is made, a function menu option associated with the microservice is created and verified. The present invention creates a function menu option and adds the microservice to the menu, so that the microservice function can be directly implemented through the function menu on the application, making the development of business functions more flexible and convenient, facilitating the addition, deletion, query and modification of functions of the application, and solving the technical problems of high development cost and low development efficiency in online development of microservices.

[0150] The above describes the microservice development method in the embodiment of the present invention. The following describes the microservice development system in the embodiment of the present invention. Figure 5 In one embodiment of the present invention, a microservice development system includes:

[0151] The template making module 501 is used to make a microservice template corresponding to the target microservice;

[0152] A business creation module 502 is used to create a business module corresponding to the target microservice;

[0153] The code acquisition module 503 is used to acquire the business code of the business module and the code configuration information of the target microservice;

[0154] A code generation module 504 is used to generate a microservice code corresponding to the business module based on the microservice template, the business code and the code configuration information;

[0155] The project configuration module 505 is used to configure the container deployment project corresponding to the target microservice;

[0156] The project compilation module 506 is used to compile the microservice project containing the microservice code and the container deployment project to obtain an executable microservice and start running it.

[0157] The embodiment of the present invention provides a microservice development device, which is used to make a microservice template, create a corresponding business module, generate a microservice code corresponding to the business module, configure a container deployment project, compile the microservice project containing the microservice code and the container deployment project, and finally obtain an executable microservice. The present invention makes a microservice template, adds a business module on the basis of the microservice template, and performs containerized deployment configuration to simplify the code writing content of the developer, making the development of the business module more flexible and convenient, and solving the technical problems of high development cost and low development efficiency in online development of microservices.

[0158] See also Figure 6 Another embodiment of the microservice development system in the embodiment of the present invention includes:

[0159] The template making module 501 is used to make a microservice template corresponding to the target microservice;

[0160] A business creation module 502 is used to create a business module corresponding to the target microservice;

[0161] The code acquisition module 503 is used to acquire the business code of the business module and the code configuration information of the target microservice;

[0162] A code generation module 504 is used to generate a microservice code corresponding to the business module based on the microservice template, the business code and the code configuration information;

[0163] The project configuration module 505 is used to configure the container deployment project corresponding to the target microservice;

[0164] The project compilation module 506 is used to compile the microservice project containing the microservice code and the container deployment project to obtain an executable microservice and start running it;

[0165] A menu creation module 507, used to create function menu options for the target microservice;

[0166] A business association module 508, used to associate the URI of the business module with the function menu option;

[0167] The business function verification module 509 is used to perform function verification on the business module based on the function menu option; if the verification passes, it is determined that the target microservice is developed successfully, otherwise it returns to modify the business module and re-perform function verification.

[0168] Optionally, in one embodiment, the template making module 501 may also be specifically used to: make basic program and container deployment templates;

[0169] The basic program includes a Java program built with Maven, the container deployment template includes a Docker-Compose service configuration template, and the Java program includes a main program entry class, a microservice configuration file, and a project build file.

[0170] Optionally, in one embodiment, the service creation module 502 may also be specifically configured to:

[0171] A module creation unit 5021 is used to create a business module corresponding to the target microservice;

[0172] The form generation unit 5022 is used to input the table name, form style and form attribute fields corresponding to the business module, and generate a business form corresponding to the business module;

[0173] The form testing unit 5023 is used to synchronize the business form with the preset database. After the database synchronization is successful, the business form is functionally tested. If the functional test meets expectations, it is confirmed that the business module has been successfully developed. Otherwise, the business form is re-edited and functionally tested until the business form meets expectations.

[0174] Optionally, in one embodiment, the code configuration information may also include: a business module name, a service port number, and a microservice template name.

[0175] Optionally, in one embodiment, the engineering configuration module 505 may further include:

[0176] Project configuration unit 5051: specifically used to obtain the compilation and packaging configuration corresponding to the target microservice and the containerized deployment configuration corresponding to Docker-Compose and add them to the container deployment project corresponding to the target microservice;

[0177] Project modification unit 5052: specifically used to modify the containerized deployment configuration and microservice startup script corresponding to the container deployment project;

[0178] Optionally, in one embodiment, the microservice development system further includes:

[0179] When executing the project compilation instruction, copy the executable jar package and the corresponding Dockerfile file of the newly added microservice project to the specified directory.

[0180] In order to obtain an executable microservice, an embodiment of the present invention provides a microservice development device, which is used to make a microservice template, create a corresponding business module, generate a microservice code corresponding to the business module, configure a container deployment project, compile a microservice project containing the microservice code and the container deployment project, and finally obtain an executable microservice. The present invention makes the development of the business module more intuitive and convenient through a business creation module and a project configuration module, so as to simplify the code writing content of the developer, more efficiently utilize resources and hardware, and reduce labor costs and resource consumption.

[0181] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0182] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A microservice development method, characterized in that: The microservice development method includes: Create a microservice template corresponding to the target microservice, the microservice template including a basic program and a container deployment template, the basic program including a Java program built using Maven and a Docker-Compose service configuration template, the Java program including a main program entry class, a microservice configuration file, and a project build file; Create a business module corresponding to the target microservice; Obtain the business code of the business module and the code configuration information of the target microservice; Generate a microservice code corresponding to the business module based on the microservice template, the business code and the code configuration information; Configure a container deployment project corresponding to the target microservice, where the container is a set of processes with view isolation, resource limitability, and an independent file system; Execute the project compilation instruction, copy the executable jar package and the corresponding Dockerfile file of the newly added microservice project to the specified directory, compile the microservice project containing the microservice code and the container deployment project, obtain the executable microservice and start running.

2. The microservice development method according to claim 1, characterized in that: The business module corresponding to the target microservice is created as follows: Create a business module corresponding to the target microservice; Enter the table name, form style and form attribute fields corresponding to the business module, and generate the business form corresponding to the business module; Synchronize the business form with a preset database, and after the database synchronization is successful, perform a functional test on the business form; If the functional test meets expectations, it is confirmed that the business module has been developed successfully, otherwise the business form is re-edited and functional testing is performed until the business form meets expectations.

3. The microservice development method according to claim 1, characterized in that: The code configuration information includes: business module name, service port number, and microservice template name.

4. The microservice development method according to claim 1, characterized in that: The container deployment project corresponding to the target microservice includes: Obtain the compilation and packaging configuration corresponding to the target microservice and the containerized deployment configuration corresponding to Docker-Compose and add them to the container deployment project corresponding to the target microservice; Modify the containerized deployment configuration and microservice startup script corresponding to the container deployment project.

5. The microservice development method according to any one of claims 1 to 4, characterized in that: After compiling the container deployment project to obtain the executable microservice and start running it, it also includes: Create a function menu option for the target microservice; Associating the URI of the business module with the function menu option; Based on the function menu options, functional verification is performed on the business module; If the verification is successful, it is determined that the target microservice is developed successfully, otherwise it returns to modify the business module and re-perform functional verification.

6. A microservice development system, characterized in that: The microservice development system includes: A template making module is used to make a microservice template corresponding to the target microservice. The microservice template includes a basic program and a container deployment template. The basic program includes a Java program built using Maven and a Docker-Compose service configuration template. The Java program includes a main program entry class, a microservice configuration file, and a project build file. A business creation module, used to create a business module corresponding to the target microservice; A code acquisition module is used to acquire the business code of the business module and the code configuration information of the target microservice; A code generation module, used to generate a microservice code corresponding to the business module based on the microservice template, the business code and the code configuration information; A project configuration module, used to configure the container deployment project corresponding to the target microservice; The project compilation module executes the project compilation instructions, copies the executable jar package and the corresponding Dockerfile file of the newly added microservice project to the specified directory, compiles the microservice project containing the microservice code and the container deployment project, obtains the executable microservice and starts running it.

7. The microservice development system according to claim 6, characterized in that: The business creation module includes: A module creation unit, used to create a business module corresponding to the target microservice; A form generation unit, used to input the table name, form style and form attribute fields corresponding to the business module, and generate a business form corresponding to the business module; The form testing unit is used to synchronize the business form with a preset database. After the database synchronization is successful, the business form is functionally tested. If the functional test meets expectations, the business module is confirmed to be successfully developed. Otherwise, the business form is re-edited and functionally tested until the business form meets expectations.

8. The microservice development system according to claim 6, characterized in that: The microservice development system also includes: A menu creation module, used to create function menu options for the target microservice; A business association module, used to associate the URI of the business module with the function menu option; The business function verification module is used to perform function verification on the business module based on the function menu option; if the verification passes, it is determined that the target microservice is developed successfully, otherwise it returns to modify the business module and re-perform function verification.

Citation Information

Patent Citations

  • Application development system, operation method, equipment and storage medium

    CN111831269A

  • Model driven system and method for development of micro service applications

    US20210216293A1