CN112988224B - Interface file generation method of micro-service framework, electronic equipment and storage medium - Google Patents

Interface file generation method of micro-service framework, electronic equipment and storage medium Download PDF

Info

Publication number
CN112988224B
CN112988224B CN202110084649.6A CN202110084649A CN112988224B CN 112988224 B CN112988224 B CN 112988224B CN 202110084649 A CN202110084649 A CN 202110084649A CN 112988224 B CN112988224 B CN 112988224B
Authority
CN
China
Prior art keywords
service
micro
interface
annotation
file
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.)
Active
Application number
CN202110084649.6A
Other languages
Chinese (zh)
Other versions
CN112988224A (en
Inventor
郝彬
刘文涛
徐晓剑
杨明
李保飞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Citic Bank Corp Ltd
Original Assignee
China Citic Bank Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Citic Bank Corp Ltd filed Critical China Citic Bank Corp Ltd
Priority to CN202110084649.6A priority Critical patent/CN112988224B/en
Publication of CN112988224A publication Critical patent/CN112988224A/en
Application granted granted Critical
Publication of CN112988224B publication Critical patent/CN112988224B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/73Program documentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation

Landscapes

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

Abstract

The invention discloses a method for generating an interface file of a micro-service framework, which is based on springCloud micro-service frameworks, and comprises the following steps: adding an application program interface on a service layer interface; scanning the annotation in the application program interface; at compile time, the method information in the annotation is converted to a declarative service definition file using a conversion plug-in. The developer of the micro-service calling party can dispense with the development workload of declaring service definition, and can conveniently call the interface by referring to the SDK of the service provider, thereby reducing the development workload and improving the development efficiency.

Description

Interface file generation method of micro-service framework, electronic equipment and storage medium
Technical Field
The invention relates to a front-end and back-end separation development mode, in particular to an interface file generation method of a micro-service framework, electronic equipment and a storage medium.
Background
Under the Spring Cloud micro-service system, the MVC layered architecture is adopted as the service, and a code call service layer interface is required to be written in a control layer, namely a Controller layer, so that extra development workload is brought to developers.
Disclosure of Invention
To ameliorate the deficiencies in the related art, a first aspect of the present invention is directed to a method of generating an interface file for a micro-service framework, the method being based on springCloud micro-service frameworks, the method comprising: adding an application program interface on a service layer interface; scanning the annotation in the application program interface; at compile time, the method information in the annotation is converted to a declarative service definition file using a conversion plug-in.
Further, the method also comprises the step of converting the declarative service definition file into a jar package of a software development kit.
Still further, the method further comprises publishing the jar package of the software development kit to a repository of the conversion plugin.
Specifically, the conversion plug-in is a maven plug-in.
Preferably, at compile time, converting the method information in the annotation into a declarative service definition file using a conversion plug-in includes automatically generating a declarative service definition file for use by a caller based on the method information.
In particular, the annotation is a parameter of a different function, more particularly the parameter is at least one of a user name, a check code or a password.
Another aspect of the invention discloses an electronic device comprising: one or more processors; a memory; one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more applications configured to: the interface file generation method of the micro service framework according to any one of the above is executed.
A third aspect of the present invention provides a computer-readable storage medium storing computer instructions that, when run on a computer, cause the computer to perform the interface file generation method of the micro-service framework described in any one of the above.
According to the interface file generation method, the electronic device and the computer readable storage medium of the micro service framework, provided by the invention, a developer of a micro service calling party can avoid the development workload of declaration service definition, and can conveniently call an interface by referring to the SDK of a service provider, thereby reducing the development workload and improving the development efficiency.
Drawings
FIG. 1 is a diagram illustrating a method for generating an interface file based on springCloud micro-server framework according to the present invention
Fig. 2 is a schematic structural diagram of an interface file generating electronic device of the springCloud microservice framework of the present invention.
Detailed Description
Embodiments of the present application are described in detail below, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to like or similar elements or elements having like or similar functions throughout. The embodiments described below by referring to the drawings are illustrative only and are not to be construed as limiting the application.
As used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless expressly stated otherwise, as understood by those skilled in the art. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. The term "and/or" as used herein includes all or any element and all combination of one or more of the associated listed items.
For the purpose of making the objects, technical solutions and advantages of the present application more apparent, the embodiments of the present application will be described in further detail with reference to the accompanying drawings.
The following describes the technical scheme of the present application and how the technical scheme of the present application solves the above technical problems in detail with specific embodiments. The following embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
The embodiment of the application provides an interface file generation method of a micro-service framework, which is based on springCloud micro-service framework, and the Spring Cloud micro-service framework related in the application is a series of configurable services and components, and simplifies development of a distributed system infrastructure by utilizing convenience of Spring Boot, such as a configuration center, service registration discovery, load balancing, fuses, call chain tracking, message buses and the like, so that a system or service conforming to the micro-service framework can be quickly constructed.
The method comprises the following steps: adding notes with application program interfaces on the service layer interfaces; wherein the service layer interface refers to a service layer, and annotations with application program interfaces are expressed in the code implementation process by @ API annotations, wherein the API (Application Programming Interface,) is a predefined function or refers to a convention that the different components of the software system are partially joined.
A medium method of scanning annotations of the application program interface; included in the @ API notation are methods, such as public methods, and the like.
At compile time, the method information in the annotation is converted to a declarative service definition file using a conversion plug-in. Wherein the conversion plugin is implemented herein using a maven plugin, the declarative service definition file is an Interface with @ FEIGNCLIENT notes.
Further, the embodiment further includes a jar package for converting the declarative service definition file into a software development kit. The specific conversion mode is realized in a packaging mode, namely, a software development tool package, namely SDK (Software Development Kit) packages, are packaged into SDK jar, and in order to facilitate subsequent direct calling, the SDK jar is further released to a warehouse of the conversion plug-in.
In the compiling process in this embodiment, the method information in the api annotation is converted into the declarative service definition file by using the maven plugin, which may be a Java bytecode of a service definition, according to the method definition in the api annotation, by using a Java bytecode technology, and the declarative service definition file is automatically generated for a caller.
The method with @ API annotation in this implementation may generate an interface with @ FEIGNCLIENT.
Another aspect of the invention discloses an electronic device comprising: one or more processors; a memory; one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more applications configured to: the interface file generation method of the micro service framework according to any one of the above is executed.
An embodiment of the present application provides an electronic device, as shown in fig. 2, an electronic device 40 shown in fig. 2 includes: a processor 401 and a memory 403. Processor 401 is connected to memory 403, such as via bus 402. Further, the electronic device 40 may also include a transceiver 404. It should be noted that, in practical applications, the transceiver 404 is not limited to one, and the structure of the electronic device 40 is not limited to the embodiment of the present application. Wherein the processor 401 is applied to the function for generating an interface document in the embodiment of the present application. Transceiver 404 includes a receiver and a transmitter.
The processor 401 may be a CPU, general purpose processor, DSP, ASIC, FPGA or other programmable logic device, transistor logic device, hardware components, or any combination thereof. Which may implement or perform the various exemplary logic blocks, modules and circuits described in connection with this disclosure. Processor 401 may also be a combination that implements computing functionality, such as a combination comprising one or more microprocessors, a combination of a DSP and a microprocessor, or the like.
Bus 402 may include a path to transfer information between the components. Bus 402 may be a PCI bus, an EISA bus, or the like. Bus 402 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in fig. 2, but not only one bus or one type of bus.
The memory 403 may be, but is not limited to, a ROM or other type of static storage device that can store static information and instructions, a RAM or other type of dynamic storage device that can store information and instructions, an EEPROM, a CD-ROM or other optical disk storage, optical disk storage (including compact disks, laser disks, optical disks, digital versatile disks, blu-ray disks, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer.
The memory 403 is used for storing application program codes for executing the inventive arrangements and is controlled to be executed by the processor 401. The processor 401 is used to execute application code stored in the memory 403 to implement the functions of the interface document generation method of the micro service framework provided by the embodiment.
Compared with the related art, the embodiment of the application provides the electronic equipment, and the developer of the micro-service calling party can avoid the development workload of declaration service definition, can conveniently call the interface by referring to the SDK of the service provider, reduces the development workload and improves the development efficiency.
The embodiment of the application provides electronic equipment which is suitable for the embodiment of the method. And will not be described in detail herein.
The embodiment of the present application provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the method shown in the above embodiment.
Compared with the related art, the embodiment of the application can avoid the development workload of declaration service definition by the developer of the micro-service calling party, and can conveniently call the interface by referring to the SDK of the service provider, thereby reducing the development workload and improving the development efficiency.
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, these steps are not necessarily performed in order as indicated by the arrows. The steps are not strictly limited in order and may be performed in other orders, unless explicitly stated herein. Moreover, at least some of the steps in the flowcharts of the figures may include a plurality of sub-steps or stages that are not necessarily performed at the same time, but may be performed at different times, the order of their execution not necessarily being sequential, but may be performed in turn or alternately with other steps or at least a portion of the other steps or stages.
The foregoing is only a partial embodiment of the present application, and it should be noted that it will be apparent to those skilled in the art that modifications and adaptations can be made without departing from the principles of the present application, and such modifications and adaptations should and are intended to be comprehended within the scope of the present application.

Claims (6)

1. An interface file generation method of a micro-service framework, the method being based on springCloud micro-service frameworks, the method comprising:
Adding notes with application program interfaces on the service layer interfaces;
a method of scanning annotations of the application program interface;
At compiling time, converting the method information in the annotation into a declaration service definition file by using a conversion plug-in, wherein the conversion plug-in is a maven plug-in, and the declaration service definition file is an Interface with @ FEIGNCLIENT annotation;
The converting the method information in the annotation into a declarative service definition file includes automatically generating a declarative service definition file for use by the caller with Java bytecodes according to the method definition in the annotation of the application program interface, the declarative service definition file being Java bytecodes of the service definition.
2. The method of claim 1, further comprising converting the declarative service definition file into a jar package of a software development kit.
3. The method of claim 2, further comprising publishing jar packages of the software development kit to a repository of the conversion plugin.
4. The method for generating an interface file for a micro-service framework according to claim 1, wherein the annotations are parameters of different functions.
5. An electronic device, comprising:
one or more processors;
a memory;
One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more applications configured to: an interface file generation method of executing the micro service framework according to any one of claims 1 to 4.
6. A computer readable storage medium for storing computer instructions that, when run on a computer, cause the computer to perform the interface file generation method of the micro-service framework of any one of the preceding claims 1 to 4.
CN202110084649.6A 2021-01-21 2021-01-21 Interface file generation method of micro-service framework, electronic equipment and storage medium Active CN112988224B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110084649.6A CN112988224B (en) 2021-01-21 2021-01-21 Interface file generation method of micro-service framework, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110084649.6A CN112988224B (en) 2021-01-21 2021-01-21 Interface file generation method of micro-service framework, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112988224A CN112988224A (en) 2021-06-18
CN112988224B true CN112988224B (en) 2024-06-25

Family

ID=76344541

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110084649.6A Active CN112988224B (en) 2021-01-21 2021-01-21 Interface file generation method of micro-service framework, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112988224B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115687161B (en) * 2022-12-30 2023-06-23 云筑信息科技(成都)有限公司 Method for automatically generating interface test case based on scanning maven warehouse

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109116828B (en) * 2017-06-22 2023-03-17 中兴通讯股份有限公司 Method and device for configuring model codes in controller
CN109814909A (en) * 2019-01-18 2019-05-28 南京绿新能源研究院有限公司 Method based on Spring cloud micro services framework cloud SCADA system
CN110806863A (en) * 2019-11-05 2020-02-18 泰康保险集团股份有限公司 Interface document generation method and device, electronic equipment and storage medium
CN111258563A (en) * 2020-01-16 2020-06-09 江苏满运软件科技有限公司 Interface document generation method and device, storage medium and electronic equipment
CN111796834B (en) * 2020-06-30 2022-10-14 福信富通科技股份有限公司 Method, device and equipment for deploying combinable micro-service development framework
CN112230904A (en) * 2020-10-16 2021-01-15 蜂助手股份有限公司 Code generation method and device based on interface document, storage medium and server

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于微服务架构的培训系统的设计与实现;李聪;中国优秀博硕士学位论文全文数据库(硕士)信息科技辑;20181201;1-82 *

Also Published As

Publication number Publication date
CN112988224A (en) 2021-06-18

Similar Documents

Publication Publication Date Title
US8191042B2 (en) Continuation based declarative definition and composition
US9235380B2 (en) Software modeling framework
CN108255545B (en) Function calling method and device between components and modular architecture system
CN110187902B (en) Project transformation method, device, equipment and storage medium based on spring boot
GB2491694A (en) Inherited transaction context for legacy software applications
CN110941655B (en) Data format conversion method and device
CN100511140C (en) Method for script language calling multiple output parameter interface by component software system
CN111427583A (en) Component compiling method and device, electronic equipment and computer readable storage medium
CN112783551A (en) Interface document generation method of micro-service framework, electronic equipment and storage medium
CN112214334A (en) Micro-service calling method and device, electronic equipment and computer-readable storage medium
CN112181378B (en) Method and device for realizing business process
CN112988224B (en) Interface file generation method of micro-service framework, electronic equipment and storage medium
CN110765067A (en) Data processing method and device
CN111427557A (en) Application microservice method and device, electronic equipment and readable storage medium
CN111045746B (en) Code expansion method and framework
CN109343970B (en) Application program-based operation method and device, electronic equipment and computer medium
WO2011080070A1 (en) Melding of mediation flow service component architecture (sca) components
CN111324645B (en) Block chain data processing method and device
CN116342283A (en) Trusted intelligent contract implementation method, device, equipment and readable storage medium
CN113934407B (en) Method, device, medium and computing equipment for calling interfaces among different language codes
CN116225450A (en) Text conversion method and apparatus, computing device and readable storage medium
CN112506943B (en) Heterogeneous data service providing method, device, equipment and medium
CN113407190A (en) Method and system for serializing and deserializing communication data of Android system and automobile ECU (electronic control Unit) module
CN112650488A (en) Parameter checking method and device, storage medium and service terminal
CN114579135B (en) Installation package generation method and device

Legal Events

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