CN113127098A - Micro-service architecture-based application program creating method and related equipment - Google Patents
Micro-service architecture-based application program creating method and related equipment Download PDFInfo
- Publication number
- CN113127098A CN113127098A CN202110484003.7A CN202110484003A CN113127098A CN 113127098 A CN113127098 A CN 113127098A CN 202110484003 A CN202110484003 A CN 202110484003A CN 113127098 A CN113127098 A CN 113127098A
- Authority
- CN
- China
- Prior art keywords
- application program
- configuration
- target application
- middleware
- project
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 51
- 238000004458 analytical method Methods 0.000 claims abstract description 17
- 238000010276 construction Methods 0.000 claims description 7
- 230000003068 static effect Effects 0.000 claims description 7
- 238000011161 development Methods 0.000 abstract description 30
- 238000012827 research and development Methods 0.000 abstract description 2
- 238000007726 management method Methods 0.000 description 24
- 230000008569 process Effects 0.000 description 11
- 230000006870 function Effects 0.000 description 10
- 238000010586 diagram Methods 0.000 description 6
- 230000008676 import Effects 0.000 description 6
- 238000012795 verification Methods 0.000 description 5
- 238000012550 audit Methods 0.000 description 3
- 230000002159 abnormal effect Effects 0.000 description 2
- 230000001419 dependent effect Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 238000004519 manufacturing process Methods 0.000 description 2
- 238000013508 migration Methods 0.000 description 2
- 230000005012 migration Effects 0.000 description 2
- 238000010606 normalization Methods 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 230000004044 response Effects 0.000 description 2
- 230000002411 adverse Effects 0.000 description 1
- 230000006399 behavior Effects 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 239000012141 concentrate Substances 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 230000000977 initiatory effect Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000002955 isolation Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000008520 organization Effects 0.000 description 1
- 230000002085 persistent effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
- 230000001052 transient effect Effects 0.000 description 1
- 238000013024 troubleshooting Methods 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
- G06F9/44505—Configuring for program initiating, e.g. using registry, configuration files
- G06F9/4451—User profiles; Roaming
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
- G06F9/44568—Immediately runnable code
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
The invention relates to the field of research and development management and discloses an application program creating method based on a micro-service architecture and related equipment. The method comprises the following steps: receiving an application program creating instruction, and analyzing the application program creating instruction to obtain an analysis result; according to the analysis result, a project object model of the target application program is constructed; reading the project object model and creating a project scaffold of the target application program; importing a common configuration file template into the project scaffold, and determining a plurality of configuration items of the target application program and configuration values corresponding to the configuration items to obtain a configuration file of the target application program; and importing the middleware on which the target application program runs into the project scaffold according to the configuration file to obtain the target application program. The invention realizes the rapid establishment of the application program, improves the development efficiency of the application program and reduces the development difficulty of the application program.
Description
Technical Field
The invention relates to the field of research and development management, in particular to an application program creating method based on a micro-service architecture and related equipment.
Background
The microservice architecture is a method for developing a single application into a set of small services, each running in its own process, which share a minimal centralized management, and the services can be developed in different languages, using different data storage technologies.
With the introduction of micro-service architecture, the number of applications is rapidly increasing. The mutual calling among the applications, the request of parameters and the processing of response results make the project more complicated and changeable. In addition, different applications introduce the same middleware dependency, and many reusable middleware configuration codes are continuously repeated, and most of the configurations use default configuration items. Developers continuously add repeated configuration codes in different projects, so that the projects are not easy to maintain while the workload is increased.
Disclosure of Invention
The invention mainly aims to solve the technical problems of low development efficiency and high difficulty caused by the fact that the whole framework is difficult to unify in the development of the application program based on the micro-service architecture.
The invention provides an application program creating method based on a micro-service architecture, which comprises the following steps:
receiving an application program creating instruction, and analyzing the application program creating instruction to obtain an analysis result;
according to the analysis result, a project object model of the target application program is constructed;
reading the project object model and creating a project scaffold of the target application program;
importing a common configuration file template into the project scaffold, and determining a plurality of configuration items of the target application program and configuration values corresponding to the configuration items to obtain a configuration file of the target application program;
and importing the middleware on which the target application program runs into the project scaffold according to the configuration file to obtain the target application program.
Optionally, in a first implementation manner of the first aspect of the present invention, before the receiving the application creation instruction, the method further includes:
submitting a creation application of a target application program and acquiring the creation permission of the target application program;
and acquiring a public configuration item corresponding to the target application program and a public configuration value corresponding to the public configuration item based on the creation permission, and generating an application warehouse of the target application program.
Optionally, in a second implementation manner of the first aspect of the present invention, the parsing result includes multiple kinds of dependency information required by the target application and middleware information required by the target application.
Optionally, in a third implementation manner of the first aspect of the present invention, the importing a common configuration file template into the project scaffold, and determining a plurality of configuration items of the target application and configuration values corresponding to the configuration items, to obtain the configuration file of the target application includes:
acquiring a preset public configuration file template, and introducing the public configuration file template into the project scaffold;
determining a plurality of middleware configuration items of the target application program according to the dependency information required by the target application program and the middleware information required by the target application program;
respectively determining configuration values corresponding to the middleware configuration items, and respectively adding the middleware configuration items and the configuration values corresponding to the middleware configuration items to the common configuration file template to obtain a first configuration file of the target application program;
and adding the public configuration item corresponding to the target application program and the public configuration value corresponding to the public configuration item into the first configuration file to obtain a second configuration file of the target application program.
Optionally, in a fourth implementation manner of the first aspect of the present invention, the determining, according to the dependency information required by the target application and the middleware information required by the target application, a plurality of middleware configuration items of the target application includes:
determining a plurality of middleware names required by the target application program according to the dependency information required by the target application program and the middleware information required by the target application program;
determining configuration items of the target middleware respectively according to the names of the middleware;
judging whether the target middleware has the use authority or not according to the configuration item of the target middleware;
if so, determining a middleware configuration item corresponding to the target application program, otherwise, acquiring the use permission of the target middleware of the target application program.
Optionally, in a fifth implementation manner of the first aspect of the present invention, the respectively determining the configuration value corresponding to each middleware configuration item includes:
pulling each middleware configuration item and a configuration value corresponding to each middleware configuration item from a preset configuration management platform according to the plurality of middleware configuration items of the target application program;
respectively judging whether the configuration value corresponding to each middleware configuration item is null or not;
if yes, reading a configuration value corresponding to the middleware configuration item with the configuration value being empty in a preset static configuration library, and otherwise, determining the configuration value corresponding to the middleware configuration item.
Optionally, in a sixth implementation manner of the first aspect of the present invention, after the importing, according to the configuration file, a middleware on which the target application runs into the project scaffold to obtain the target application, the method further includes:
acquiring a preset code example template;
and adding the code example template to a service code path of the target application program, and importing a parameter base class and an exception handling base class into the target application program to obtain a normalized target application program, wherein the code example template comprises an interface example, a base class example and an implementation class example.
The second aspect of the present invention provides an application creation apparatus based on micro service architecture, including:
the receiving module is used for receiving an application program creating instruction and analyzing the application program creating instruction to obtain an analysis result;
the construction module is used for constructing a project object model of the target application program according to the analysis result;
the creating module is used for reading the project object model and creating a project scaffold of the target application program;
the configuration module is used for importing a common configuration file template into the project scaffold, determining a plurality of configuration items of the target application program and configuration values corresponding to the configuration items to obtain a configuration file of the target application program;
and the importing module is used for importing the middleware on which the target application program runs into the project scaffold according to the configuration file to obtain the target application program.
Optionally, in a first implementation manner of the second aspect of the present invention, before the receiving the application creation instruction, the method further includes:
submitting a creation application of a target application program and acquiring the creation permission of the target application program;
and acquiring a public configuration item corresponding to the target application program and a public configuration value corresponding to the public configuration item based on the creation permission, and generating an application warehouse of the target application program.
Optionally, in a first implementation manner of the second aspect of the present invention, the parsing result includes a plurality of types of dependency information required by the target application and middleware information required by the target application.
Optionally, in a second implementation manner of the second aspect of the present invention, the configuration module includes:
the template import unit is used for acquiring a preset public configuration file template and importing the public configuration file template into the project scaffold;
the configuration determining unit is used for determining a plurality of middleware configuration items of the target application program according to the dependency information required by the target application program and the middleware information required by the target application program;
a first adding unit, configured to determine configuration values corresponding to the middleware configuration items, and add the middleware configuration items and the configuration values corresponding to the middleware configuration items to the common configuration file template, so as to obtain a first configuration file of the target application program;
and the second adding unit is used for adding the public configuration item corresponding to the target application program and the public configuration value corresponding to the public configuration item into the first configuration file to obtain a second configuration file of the target application program.
Optionally, in a third implementation manner of the second aspect of the present invention, the configuration determining unit is specifically configured to:
determining a plurality of middleware names required by the target application program according to the dependency information required by the target application program and the middleware information required by the target application program;
determining configuration items of the target middleware respectively according to the names of the middleware;
judging whether the target middleware has the use authority or not according to the configuration item of the target middleware;
if so, determining a middleware configuration item corresponding to the target application program, otherwise, acquiring the use permission of the target middleware of the target application program.
Optionally, in a fourth implementation manner of the second aspect of the present invention, the first adding unit is configured to:
pulling each middleware configuration item and a configuration value corresponding to each middleware configuration item from a preset configuration management platform according to the plurality of middleware configuration items of the target application program;
respectively judging whether the configuration value corresponding to each middleware configuration item is null or not;
if yes, reading a configuration value corresponding to the middleware configuration item with the configuration value being empty in a preset static configuration library, and otherwise, determining the configuration value corresponding to the middleware configuration item.
Optionally, in a first implementation manner of the second aspect of the present invention, the apparatus for creating an application based on a micro service architecture further includes:
the normalization module is used for acquiring a preset code example template; and adding the code example template to a service code path of the target application program, and importing a parameter base class and an exception handling base class into the target application program to obtain a normalized target application program, wherein the code example template comprises an interface example, a base class example and an implementation class example.
The third aspect of the present invention provides an application program creating device based on a microservice architecture, including: a memory and at least one processor, the memory having instructions stored therein; the at least one processor invokes the instructions in the memory to cause the microservice-based application creation apparatus to perform the microservice-based application creation method described above.
A fourth aspect of the present invention provides a computer-readable storage medium having stored therein instructions, which, when run on a computer, cause the computer to execute the above-mentioned micro-service architecture based application creation method.
In the technical scheme provided by the invention, in order to improve the project development efficiency, a configurated automatic creation method is adopted for an application program based on a micro-service architecture to create an initial framework of the application program. Firstly, creating a project object model of an application program according to parameters in an application program creating instruction, constructing a complete directory structure of the application program on the basis of the project object model, then pulling configuration parameters of a configuration platform, determining components required by the project according to the configuration parameters, and importing the components of corresponding versions into a target application program, thereby realizing the initial creation of an application program frame. According to the invention, the components required by the application program are imported according to the needs, so that the application program is quickly created, the development efficiency of the application program is improved, and the development difficulty of the application program is reduced.
Drawings
FIG. 1 is a schematic diagram of a first embodiment of an application creation method based on a micro service architecture according to an embodiment of the present invention;
FIG. 2 is a diagram of a second embodiment of an application creation method based on micro service architecture according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a first embodiment of an application creation apparatus based on a micro service architecture according to an embodiment of the present invention;
FIG. 4 is a diagram of a second embodiment of an application creation device based on micro service architecture according to an embodiment of the present invention;
fig. 5 is a schematic diagram of an embodiment of an application creation device based on a micro service architecture in an embodiment of the present invention.
Detailed Description
The embodiment of the invention provides a method, a device, equipment and a storage medium for creating an application program based on a micro-service architecture. The terms "first," "second," "third," "fourth," and the like in the description and in the claims, as well as in the drawings, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that the embodiments described herein may be practiced otherwise than as specifically illustrated or described herein. Furthermore, the terms "comprises," "comprising," or "having," and any variations thereof, are intended to cover non-exclusive inclusions, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
For convenience of understanding, a specific flow of the embodiment of the present invention is described below, and referring to fig. 1, a first embodiment of the method for creating an application based on a micro service architecture according to the embodiment of the present invention includes:
101. receiving an application program creating instruction, and analyzing the application program creating instruction to obtain an analysis result;
it is understood that the execution subject of the present invention may be an application creation device based on a micro service architecture, and may also be a terminal or a server, which is not limited herein. The embodiment of the present invention is described by taking a server as an execution subject.
It can be understood that the application programs described in the present invention are all application programs based on a micro service architecture, and the micro service architecture is an architecture idea, and the core is that the service function and the requirement are decomposed into different services for management, so as to implement the integral decoupling of the service. Application services (applications) are created around the business model, and can be developed, iterated and deployed independently, so that the architecture is clearer and clearer. Therefore, the application program under the micro service architecture has no specific limitation on the development language, and the invention aims to extract the influence of the development language and establish a general application program framework establishing system so as to improve the development efficiency of the actual project.
It can be understood that the target application created by the present invention refers to an application framework, and a developer can quickly enter into development based on the application framework created by the present invention, so that the target application does not include specific business functions and is an initial application framework capable of operating normally.
In this embodiment, the application creation instruction may be in the form of a command line, for example, "cmdsproducer-aid [ artifactId ] -appName [ appName ]", where, as can be seen, parameters such as artifactId and appName of the target application are carried in the example command line, and these parameters are used to resolve relevant configuration parameters of the target application. In addition, the creation instruction of the application program can be sent through the application program management platform to provide a visual application program management platform, and developers only need to create the application program on the platform and configure related parameters, namely, the whole framework of the target application program can be created, so that the development efficiency is improved.
Optionally, in an embodiment, before step 101, the method further includes:
submitting a creation application of a target application program and acquiring the creation permission of the target application program;
and acquiring a public configuration item corresponding to the target application program and a public configuration value corresponding to the public configuration item based on the creation permission, and generating an application warehouse of the target application program.
In the optional embodiment, in order to make the application management under the micro-service architecture more standard, before the application is created, the creation authority of the application needs to be obtained first, an application is submitted on an application management platform, after the application is approved, the creation authority is obtained, and meanwhile, the use authority of public configuration items is also obtained, the public configuration items are necessary configuration items of projects under the micro-service architecture, such as project names, port numbers, registration center addresses and the like.
In this optional embodiment, the common configuration item may further include a Dubbo (open source distributed service framework) configuration, a path and level configuration of a log, and the like. Dubbo is a high-performance, lightweight, open-source framework that offers three core capabilities: interface-oriented remote method invocation, intelligent fault tolerance and load balancing, and automatic registration and discovery of services. For a micro-service architecture based on Dubbo, the overall performance of a project can be improved by configuring the Dubbo, and the efficiency of project development can be improved by taking the Dubbo as a default option for creating an application program, so that the time cost of manual configuration is reduced.
Optionally, in an embodiment, the parsing result includes a plurality of dependency information required by the target application and middleware information required by the target application.
In this optional embodiment, because the present invention is directed to customized creation of an application, the initial application creation request carries dependency information and middleware information required by the application to be created, and the dependency information and the middleware information in the initial application creation request can be extracted through command parsing for subsequent application creation.
In this alternative embodiment, the middleware is an intermediate component that integrates system software and application software, and is located between the system software and the application software, the middleware is an independent system software or a service program, the distributed application software performs resource sharing between different technologies by means of the middleware, and the middleware is located on an operating system of the server and manages computing resources and network communication. Such as message middleware, transaction middleware, security middleware, network middleware, web server middleware, and the like.
102. According to the analysis result, a project object model of the target application program is constructed;
in this embodiment, the Project Object Model (POM) is a basic work unit of the Maven Project, is an XML file, and includes basic information of the Project, which is used to describe how the Project is constructed, declare dependency information of the Project, and so on. The information contained in the project object model is:
(1) basic information of the project: project name, project address, project initiating organization, and developer of the project, project license, etc.;
(2) and (3) construction and configuration of the project: the default behavior constructed by Maven can be customized in the project object model, the storage position of the source code can be changed, new plug-ins can be added, plug-in targets can be bound to life cycle functions, and the configuration required in the project construction process such as site generation functions can be customized;
(3) construction environment of project: different environments may be built for different projects, for example, an application is deployed to one development server during the development process, and an application is deployed to a production server in the production environment;
(4) POM relationship: an item rarely exists in isolation, it will depend on other items, it may inherit POM settings from a parent item, and therefore, the item defines its own coordinates in POM and associations with other items, and it may also contain child modules.
In this embodiment, the construction method of the project object model may be to first obtain a POM template, and combine parameters in the analysis result with the template according to a preset format on the basis of the POM template, so as to generate the project object model of the target application program, which is used to construct an initial scaffold of the project.
103. Reading the project object model and creating a project scaffold of the target application program;
in this embodiment, the project scaffold can be understood as a basic package of the target project, which will construct a complete directory structure based on the current working environment and the related configuration options required by the project, and the specific files and contents generated by the project scaffold depend on the selected POM template and the configuration options given to the specific information in the construction process. In this embodiment, the project scaffold may be created by using a preset scaffold creation tool, for example, a grunt-init.
104. Importing a common configuration file template into the project scaffold, and determining a plurality of configuration items of the target application program and configuration values corresponding to the configuration items to obtain a configuration file of the target application program;
in this embodiment, in order to make more parameters customizable, a common configuration file template is introduced into the project scaffold, and the parameters configurable in the common configuration file include: a common configuration and a middleware configuration, wherein the common configuration includes: project name, port number, registry address, etc., the middleware configuration may be: dubbo, log, service, impl, entity, mapper, etc.
In this embodiment, before a developer newly builds an application, the developer applies for the creation authority of the application, after the application passes, the application management platform adds the application and generates a code repository of the application, the subsequent individual configuration of some applications can be added to the application management platform, the project POM defaults to add a dependency of the application management platform, and reads related configuration information from the application management platform by using an annotation form, so that middleware and related dependency packages are managed uniformly, and adverse consequences such as code redundancy caused by misuse of development tools by the developer are reduced.
105. And importing the middleware on which the target application program runs into the project scaffold according to the configuration file to obtain the target application program.
In the embodiment, the middleware and the related dependency packages required by the target application program can be loaded as required according to the configuration parameters in the configuration file, so that the initial project is created more flexibly, the redundancy of project codes is reduced, the project development process is further normalized, and the project development efficiency is improved.
In the embodiment of the invention, in order to improve the project development efficiency, a configured automatic creation method is adopted for an application program based on a micro-service architecture to create an initial framework of the application program. Firstly, creating a project object model of an application program according to parameters in an application program creating instruction, constructing a complete directory structure of the application program on the basis of the project object model, then pulling configuration parameters of a configuration platform, determining components required by the project according to the configuration parameters, and importing the components of corresponding versions into a target application program, thereby realizing the initial creation of an application program frame. According to the invention, the components required by the application program are imported according to the needs, so that the application program is quickly created, the development efficiency of the application program is improved, and the development difficulty of the application program is reduced.
Referring to fig. 2, a second embodiment of the method for creating an application based on a micro service architecture according to the embodiment of the present invention includes:
201. receiving an application program creating instruction, and analyzing the application program creating instruction to obtain an analysis result;
202. according to the analysis result, a project object model of the target application program is constructed;
203. reading the project object model and creating a project scaffold of the target application program;
204. acquiring a preset public configuration file template, and introducing the public configuration file template into the project scaffold;
205. determining a plurality of middleware configuration items of the target application program according to the dependency information required by the target application program and the middleware information required by the target application program;
optionally, in an embodiment, step 205 specifically includes:
determining a plurality of middleware names required by the target application program according to the dependency information required by the target application program and the middleware information required by the target application program;
determining configuration items of the target middleware respectively according to the names of the middleware;
judging whether the target middleware has the use authority or not according to the configuration item of the target middleware;
if so, determining a middleware configuration item corresponding to the target application program, otherwise, acquiring the use permission of the target middleware of the target application program.
In this optional embodiment, in order to make management of the application more standard and avoid misuse or misuse of the middleware, an audit system is also adopted for the middleware, before the application program introduces the middleware, an application needs to be submitted first, and after the audit is passed, the usage right of the corresponding middleware can be obtained, and if the audit is not passed, the corresponding middleware cannot be used.
In this optional embodiment, after the middleware is approved, the corresponding middleware usage permission is obtained, and then the relevant configuration information of the corresponding middleware can be obtained, because the middleware of the project is configured on the application management platform in advance by the developer, after the permission verification is passed, the middleware configuration item required by the target application, that is, the key value inside the key value pair, can be obtained.
206. Respectively determining configuration values corresponding to the middleware configuration items, and respectively adding the middleware configuration items and the configuration values corresponding to the middleware configuration items to the common configuration file template to obtain a first configuration file of the target application program;
optionally, in an embodiment, the determining the configuration value corresponding to each middleware configuration item respectively includes:
pulling each middleware configuration item and a configuration value corresponding to each middleware configuration item from a preset configuration management platform according to the plurality of middleware configuration items of the target application program;
respectively judging whether the configuration value corresponding to each middleware configuration item is null or not;
if yes, reading a configuration value corresponding to the middleware configuration item with the configuration value being empty in a preset static configuration library, and otherwise, determining the configuration value corresponding to the middleware configuration item.
In this optional embodiment, the middleware accessing the target application preferentially reads the configuration value using the key of the configuration item of the application management platform, automatically adopts a default value if the application management platform is not configured, preferentially uses the value configured by the developer if the application management platform is configured, and then adopts the key of the configuration item in the static configuration library to obtain the configuration value if the application management platform is not configured. The optional embodiment adopts a flexible middleware configuration mode, so that the version dependence management of the project is more flexible, and when the application program needs to upgrade the version, the middleware can be simply and quickly upgraded, thereby avoiding security holes of low versions and greatly reducing the difficulty in troubleshooting.
In this optional embodiment, if the application management platform does not have configuration middleware, the static configuration library is still supported, so that the application management platform can be better compatible with the previous version, and the application can be ensured to continue running without migrating the configuration item. It can be understood that for the same configuration item key, different configuration values mean that different versions of middleware are selected, and the version selection of the middleware is performed in a key value pair mode, so that the development efficiency of the project can be greatly improved.
207. Adding a public configuration item corresponding to the target application program and a public configuration value corresponding to the public configuration item into the first configuration file to obtain a second configuration file of the target application program;
in this embodiment, the configuration of the application includes a public configuration and a non-public configuration, and in order to make an automatic creation process of the application more intelligent, both the public configuration and the non-public configuration are added to a configuration file in the creation process, where the public configuration can obtain a relevant configuration item and a configuration value after acquiring an application creation authority, a configuration item (key) of the non-public configuration needs to be obtained after acquiring an authority alone, and a configuration value (value) of the non-public configuration needs to be determined after multiple judgments are performed.
In this embodiment, the configuration file of the application program is generated in the form of a configuration file template, and a preset common configuration file template is first obtained, and then the determined configuration items and configuration values are combined with the common configuration file template according to a preset format, so as to obtain the configuration file of the target application program.
208. And importing the middleware on which the target application program runs into the project scaffold according to the configuration file to obtain the target application program.
Optionally, in an embodiment, after step 208, the method further includes:
acquiring a preset code example template;
and adding the code example template to a service code path of the target application program, and importing a parameter base class and an exception handling base class into the target application program to obtain a normalized target application program, wherein the code example template comprises an interface example, a base class example and an implementation class example.
In this optional embodiment, in order to further improve the standardization of creating the application program, a plurality of code templates are imported into the target application program, where the code templates include: the system comprises a code example template, a middleware initialization class template and the like, wherein the code example template provides a normalized package name, a normalized class name and an interface definition example, the examples are established according to the development style of the whole micro service architecture, the examples have no actual functions and do not influence the starting and running of the whole project, and developers can understand the functions of each package file through the examples and can help the developers to be familiar with the whole project architecture quickly so as to develop specific service functions.
In this optional embodiment, a public second library may be further introduced into the target application program, where the public second library includes: the device comprises a parameter base class, an exception handling base class and a unit testing base class, wherein the parameter base class comprises: the exception handling system comprises a request parameter base class and a response parameter base class, wherein the exception handling base class comprises an exception base class and an error code base class. The base classes can uniformly manage the micro-service architecture, maintain the uniformity of the whole architecture, and facilitate the data interaction of developers among different application programs, so that the developers can concentrate on the development of specific business function logic, thereby improving the project development efficiency.
In the embodiment of the invention, in order to make the creation mode of the application program more flexible and open the customized configuration function, the related configuration parameters required by the project can be freely configured through the application program management platform, wherein the related configuration parameters comprise public configuration and non-public configuration, the public configuration and the non-public configuration are imported into the target application program in different modes, and the public configuration can be determined when the creation authority of the application program is obtained, so that the configuration items and the configuration values of the public configuration can be directly added into the configuration file template, while the non-public configuration needs to be subjected to multiple verification to determine the configuration items and the configuration values, the multiple verification aims to perform version-dependent management on the middleware corresponding to the non-public configuration, the version upgrading efficiency can be improved, and the abnormal occurrence probability during the project migration can be reduced. The embodiment of the invention can flexibly set the public configuration parameters and the non-public configuration parameters of the application program, thereby improving the efficiency of project development and the stability of the project.
With reference to fig. 3, the method for creating an application based on a micro service architecture in the embodiment of the present invention is described above, and an application creating device based on a micro service architecture in the embodiment of the present invention is described below, where a first embodiment of the application creating device based on a micro service architecture in the embodiment of the present invention includes:
a receiving module 301, configured to receive an application program creating instruction, and analyze the application program creating instruction to obtain an analysis result;
a building module 302, configured to build a project object model of the target application according to the parsing result;
a creating module 303, configured to read the project object model and create a project scaffold of the target application;
a configuration module 304, configured to import a common configuration file template into the project scaffold, and determine a plurality of configuration items of the target application program and configuration values corresponding to the configuration items, to obtain a configuration file of the target application program;
and an importing module 305, configured to import, according to the configuration file, the middleware on which the target application program runs into the project scaffold, so as to obtain the target application program.
Optionally, in an embodiment, the apparatus for creating an application based on a microservice architecture further includes:
the authority acquisition module 306 is configured to submit a creation application of a target application program and acquire a creation authority of the target application program; and acquiring a public configuration item corresponding to the target application program and a public configuration value corresponding to the public configuration item based on the creation permission, and generating an application warehouse of the target application program.
Optionally, in an embodiment, the parsing result includes a plurality of dependency information required by the target application and middleware information required by the target application.
Optionally, in an embodiment, the apparatus for creating an application based on a microservice architecture further includes:
a normalization module 307, configured to obtain a preset code example template; and adding the code example template to a service code path of the target application program, and importing a parameter base class and an exception handling base class into the target application program to obtain a normalized target application program, wherein the code example template comprises an interface example, a base class example and an implementation class example.
In the embodiment of the invention, in order to improve the project development efficiency, a configured automatic creation method is adopted for an application program based on a micro-service architecture to create an initial framework of the application program. Firstly, creating a project object model of an application program according to parameters in an application program creating instruction, constructing a complete directory structure of the application program on the basis of the project object model, then pulling configuration parameters of a configuration platform, determining components required by the project according to the configuration parameters, and importing the components of corresponding versions into a target application program, thereby realizing the initial creation of an application program frame. According to the invention, the components required by the application program are imported according to the needs, so that the application program is quickly created, the development efficiency of the application program is improved, and the development difficulty of the application program is reduced.
Referring to fig. 4, a second embodiment of the application creation device based on the micro service architecture according to the embodiment of the present invention includes:
a receiving module 301, configured to receive an application program creating instruction, and analyze the application program creating instruction to obtain an analysis result;
a building module 302, configured to build a project object model of the target application according to the parsing result;
a creating module 303, configured to read the project object model and create a project scaffold of the target application;
a configuration module 304, configured to import a common configuration file template into the project scaffold, and determine a plurality of configuration items of the target application program and configuration values corresponding to the configuration items, to obtain a configuration file of the target application program;
and an importing module 305, configured to import, according to the configuration file, the middleware on which the target application program runs into the project scaffold, so as to obtain the target application program.
Optionally, in an embodiment, the configuration module 304 includes:
a template importing unit 3041, configured to obtain a preset common configuration file template, and import the common configuration file template into the project scaffold;
a configuration determining unit 3042, configured to determine, according to the dependency information required by the target application and the middleware information required by the target application, a plurality of middleware configuration items of the target application;
a first adding unit 3043, configured to respectively determine configuration values corresponding to the middleware configuration items, and respectively add the middleware configuration items and the configuration values corresponding to the middleware configuration items to the common configuration file template, so as to obtain a first configuration file of the target application program;
a second adding unit 3044, configured to add the common configuration item corresponding to the target application and the common configuration value corresponding to the common configuration item to the first configuration file, so as to obtain a second configuration file of the target application.
Optionally, in an embodiment, the configuration determining unit 3042 is specifically configured to:
determining a plurality of middleware names required by the target application program according to the dependency information required by the target application program and the middleware information required by the target application program;
determining configuration items of the target middleware respectively according to the names of the middleware;
judging whether the target middleware has the use authority or not according to the configuration item of the target middleware;
if so, determining a middleware configuration item corresponding to the target application program, otherwise, acquiring the use permission of the target middleware of the target application program.
Optionally, in an embodiment, the first adding unit 3043 is configured to:
pulling each middleware configuration item and a configuration value corresponding to each middleware configuration item from a preset configuration management platform according to the plurality of middleware configuration items of the target application program;
respectively judging whether the configuration value corresponding to each middleware configuration item is null or not;
if yes, reading a configuration value corresponding to the middleware configuration item with the configuration value being empty in a preset static configuration library, and otherwise, determining the configuration value corresponding to the middleware configuration item.
In the embodiment of the invention, in order to make the creation mode of the application program more flexible and open the customized configuration function, the related configuration parameters required by the project can be freely configured through the application program management platform, wherein the related configuration parameters comprise public configuration and non-public configuration, the public configuration and the non-public configuration are imported into the target application program in different modes, and the public configuration can be determined when the creation authority of the application program is obtained, so that the configuration items and the configuration values of the public configuration can be directly added into the configuration file template, while the non-public configuration needs to be subjected to multiple verification to determine the configuration items and the configuration values, the multiple verification aims to perform version-dependent management on the middleware corresponding to the non-public configuration, the version upgrading efficiency can be improved, and the abnormal occurrence probability during the project migration can be reduced. The embodiment of the invention can flexibly set the public configuration parameters and the non-public configuration parameters of the application program, thereby improving the efficiency of project development and the stability of the project.
Fig. 3 and fig. 4 above describe the micro service architecture based application creation apparatus in the embodiment of the present invention in detail from the perspective of the modular functional entity, and the micro service architecture based application creation device in the embodiment of the present invention is described in detail from the perspective of hardware processing.
Fig. 5 is a schematic structural diagram of a micro-service architecture based application creation device 500 according to an embodiment of the present invention, which may have a relatively large difference due to different configurations or performances, and may include one or more processors (CPUs) 510 (e.g., one or more processors) and a memory 520, and one or more storage media 530 (e.g., one or more mass storage devices) for storing applications 533 or data 532. Memory 520 and storage media 530 may be, among other things, transient or persistent storage. The program stored on the storage medium 530 may include one or more modules (not shown), each of which may include a series of instruction operations for the microservice architecture-based application creation apparatus 500. Still further, the processor 510 may be configured to communicate with the storage medium 530 to execute a series of instruction operations in the storage medium 530 on the microservice-based application creation device 500.
The microservices-based application creation device 500 may also include one or more power supplies 540, one or more wired or wireless network interfaces 550, one or more input-output interfaces 560, and/or one or more operating systems 531 such as Windows Server, Mac OSX, Unix, Linux, FreeBSD, etc. Those skilled in the art will appreciate that the microservice architecture-based application creation device architecture illustrated in fig. 5 does not constitute a limitation of microservice architecture-based application creation devices and may include more or fewer components than those illustrated, or some components may be combined, or a different arrangement of components.
The invention also provides an application program creating device based on the micro service architecture, which comprises a memory and a processor, wherein the memory stores computer readable instructions, and the computer readable instructions, when executed by the processor, cause the processor to execute the steps of the application program creating method based on the micro service architecture in the embodiments.
The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium, and may also be a volatile computer-readable storage medium, having stored therein instructions, which, when run on a computer, cause the computer to perform the steps of the microservice architecture-based application creation method.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a read-only memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.
Claims (10)
1. A micro-service architecture based application program creation method is characterized by comprising the following steps:
receiving an application program creating instruction, and analyzing the application program creating instruction to obtain an analysis result;
according to the analysis result, a project object model of the target application program is constructed;
reading the project object model and creating a project scaffold of the target application program;
importing a common configuration file template into the project scaffold, and determining a plurality of configuration items of the target application program and configuration values corresponding to the configuration items to obtain a configuration file of the target application program;
and importing the middleware on which the target application program runs into the project scaffold according to the configuration file to obtain the target application program.
2. The microservice-architecture-based application creation method of claim 1, further comprising, prior to the receiving an application creation instruction:
submitting a creation application of a target application program and acquiring the creation permission of the target application program;
and acquiring a public configuration item corresponding to the target application program and a public configuration value corresponding to the public configuration item based on the creation permission, and generating an application warehouse of the target application program.
3. The microservice-architecture-based application creation method of claim 2, wherein the parsing result comprises a plurality of dependency information required by a target application and middleware information required by the target application.
4. The method for creating an application based on a micro-service architecture according to claim 3, wherein the importing a common configuration file template into the project scaffold, and determining a plurality of configuration items of the target application and configuration values corresponding to the configuration items to obtain the configuration file of the target application comprises:
acquiring a preset public configuration file template, and introducing the public configuration file template into the project scaffold;
determining a plurality of middleware configuration items of the target application program according to the dependency information required by the target application program and the middleware information required by the target application program;
respectively determining configuration values corresponding to the middleware configuration items, and respectively adding the middleware configuration items and the configuration values corresponding to the middleware configuration items to the common configuration file template to obtain a first configuration file of the target application program;
and adding the public configuration item corresponding to the target application program and the public configuration value corresponding to the public configuration item into the first configuration file to obtain a second configuration file of the target application program.
5. The microservice-architecture-based application creation method of claim 4, wherein the determining a plurality of middleware configuration items of the target application according to the dependency information required by the target application and the middleware information required by the target application comprises:
determining a plurality of middleware names required by the target application program according to the dependency information required by the target application program and the middleware information required by the target application program;
determining configuration items of the target middleware respectively according to the names of the middleware;
judging whether the target middleware has the use authority or not according to the configuration item of the target middleware;
if so, determining a middleware configuration item corresponding to the target application program, otherwise, acquiring the use permission of the target middleware of the target application program.
6. The microservice-architecture-based application creation method of claim 4, wherein the determining the configuration value corresponding to each middleware configuration item comprises:
pulling each middleware configuration item and a configuration value corresponding to each middleware configuration item from a preset configuration management platform according to the plurality of middleware configuration items of the target application program;
respectively judging whether the configuration value corresponding to each middleware configuration item is null or not;
if yes, reading a configuration value corresponding to the middleware configuration item with the configuration value being empty in a preset static configuration library, and otherwise, determining the configuration value corresponding to the middleware configuration item.
7. The method for creating an application based on a micro-service architecture according to claim 4, wherein after the middleware on which the target application runs is imported in the project scaffold according to the configuration file to obtain the target application, the method further comprises:
acquiring a preset code example template;
and adding the code example template to a service code path of the target application program, and importing a parameter base class and an exception handling base class into the target application program to obtain a normalized target application program, wherein the code example template comprises an interface example, a base class example and an implementation class example.
8. A microservice-architecture-based application creation apparatus, the microservice-architecture-based application creation apparatus comprising:
the receiving module is used for receiving an application program creating instruction and analyzing the application program creating instruction to obtain an analysis result;
the construction module is used for constructing a project object model of the target application program according to the analysis result;
the creating module is used for reading the project object model and creating a project scaffold of the target application program;
the configuration module is used for importing a common configuration file template into the project scaffold, determining a plurality of configuration items of the target application program and configuration values corresponding to the configuration items to obtain a configuration file of the target application program;
and the importing module is used for importing the middleware on which the target application program runs into the project scaffold according to the configuration file to obtain the target application program.
9. A microservice-architecture-based application creation apparatus, the microservice-architecture-based application creation apparatus comprising: a memory and at least one processor, the memory having instructions stored therein;
the at least one processor invokes the instructions in the memory to cause the microservice-architecture-based application creation device to perform the microservice-architecture-based application creation method of any of claims 1-7.
10. A computer-readable storage medium having instructions stored thereon, wherein the instructions, when executed by a processor, implement the microservice architecture-based application creation method of any of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110484003.7A CN113127098B (en) | 2021-04-30 | 2021-04-30 | Application program creation method based on micro-service architecture and related equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110484003.7A CN113127098B (en) | 2021-04-30 | 2021-04-30 | Application program creation method based on micro-service architecture and related equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113127098A true CN113127098A (en) | 2021-07-16 |
CN113127098B CN113127098B (en) | 2024-06-18 |
Family
ID=76780778
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110484003.7A Active CN113127098B (en) | 2021-04-30 | 2021-04-30 | Application program creation method based on micro-service architecture and related equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113127098B (en) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113626108A (en) * | 2021-08-24 | 2021-11-09 | 平安国际智慧城市科技股份有限公司 | Method, device, equipment and storage medium for assisted configuration of webpack |
CN114168217A (en) * | 2021-11-24 | 2022-03-11 | 北京金山云网络技术有限公司 | Program management system, method and device |
CN114510258A (en) * | 2022-02-21 | 2022-05-17 | 深圳市金蝶天燕云计算股份有限公司 | Middleware management method, middleware management platform and computer readable storage medium |
CN115423335A (en) * | 2022-09-14 | 2022-12-02 | 易纳购科技(北京)有限公司 | Project creation method and device, storage medium and computer equipment |
CN116594681A (en) * | 2023-07-18 | 2023-08-15 | 杭州比智科技有限公司 | Scaffold design method and system based on specific scene modularization |
CN117251173A (en) * | 2023-11-15 | 2023-12-19 | 深圳万物安全科技有限公司 | Method for configuring micro-service items, device and medium for configuring micro-service items |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090249279A1 (en) * | 2008-03-31 | 2009-10-01 | Jatho Investments | Software appliance framework |
CN110543335A (en) * | 2019-08-15 | 2019-12-06 | 上海易点时空网络有限公司 | Application program configuration management method and system |
-
2021
- 2021-04-30 CN CN202110484003.7A patent/CN113127098B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090249279A1 (en) * | 2008-03-31 | 2009-10-01 | Jatho Investments | Software appliance framework |
CN110543335A (en) * | 2019-08-15 | 2019-12-06 | 上海易点时空网络有限公司 | Application program configuration management method and system |
Non-Patent Citations (1)
Title |
---|
DADONG: "快应用开发框架(2):项目框架构建", pages 1 - 5, Retrieved from the Internet <URL:https://quickapp.vivo.com.cn/quickapp-development-tutorial-02/> * |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113626108A (en) * | 2021-08-24 | 2021-11-09 | 平安国际智慧城市科技股份有限公司 | Method, device, equipment and storage medium for assisted configuration of webpack |
CN113626108B (en) * | 2021-08-24 | 2024-10-01 | 平安国际智慧城市科技股份有限公司 | Webpack auxiliary configuration method, device, equipment and storage medium |
CN114168217A (en) * | 2021-11-24 | 2022-03-11 | 北京金山云网络技术有限公司 | Program management system, method and device |
CN114510258A (en) * | 2022-02-21 | 2022-05-17 | 深圳市金蝶天燕云计算股份有限公司 | Middleware management method, middleware management platform and computer readable storage medium |
CN115423335A (en) * | 2022-09-14 | 2022-12-02 | 易纳购科技(北京)有限公司 | Project creation method and device, storage medium and computer equipment |
CN116594681A (en) * | 2023-07-18 | 2023-08-15 | 杭州比智科技有限公司 | Scaffold design method and system based on specific scene modularization |
CN116594681B (en) * | 2023-07-18 | 2023-10-31 | 杭州比智科技有限公司 | Scaffold design method and system based on specific scene modularization |
CN117251173A (en) * | 2023-11-15 | 2023-12-19 | 深圳万物安全科技有限公司 | Method for configuring micro-service items, device and medium for configuring micro-service items |
CN117251173B (en) * | 2023-11-15 | 2024-03-08 | 深圳万物安全科技有限公司 | Micro-service item configuration method, micro-service item configuration device and medium |
Also Published As
Publication number | Publication date |
---|---|
CN113127098B (en) | 2024-06-18 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN113127098B (en) | Application program creation method based on micro-service architecture and related equipment | |
US10409589B2 (en) | Application centric continuous integration and delivery with automated service assurance | |
US9652214B1 (en) | Pluggable extension of software applications | |
CN110912724B (en) | Parameter-driven automatic service arrangement method and device | |
CN106559438B (en) | Program uploading method and device based on target network platform | |
KR101831430B1 (en) | Apparatus and method for infrastructure automation | |
US20180024814A1 (en) | Automated enterprise software development | |
US9830135B2 (en) | Declarative and pluggable business logic for systems management | |
CN110716748B (en) | Service processing method, device, computer readable medium and electronic equipment | |
WO2022016848A1 (en) | Method and apparatus for performing application deployment according to service role | |
Talwar et al. | Approaches for service deployment | |
US20170255886A1 (en) | Workflow execution | |
US9460109B1 (en) | Centralized provisioning process leveraging network attached storage | |
US10114861B2 (en) | Expandable ad hoc domain specific query for system management | |
EP3047372B1 (en) | Computer-aided development of native mobile application code | |
EP1455484A2 (en) | Integrating design, deployment, and management phases for systems | |
EP1457877A2 (en) | Architecture for distributed computing system and automated design, deployment, and management of distributed applications | |
US20150121155A1 (en) | Performing customized deployment scenarios in shared environments | |
US20170220324A1 (en) | Data communication accelerator system | |
CN113434158B (en) | Custom management method, device, equipment and medium for big data component | |
CN113986226A (en) | Micro front end architecture based on qiankun and Web Component and construction method thereof | |
CN110673923A (en) | XWIKI system configuration method, system and computer equipment | |
US20230401058A1 (en) | Semantic functional wrappers of services | |
US10579342B1 (en) | Encapsulated application templates for containerized application software development | |
CN113179269A (en) | Internet of things-based protocol data analysis method, system, medium, and program product |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |