Method and device for applying integrated service function, electronic equipment and medium
By pre-building reference paths and client integration configuration files, automatically loading and assembling service function object instances, the cumbersome problem of manually configuring third-party dependencies when applying extension functions is solved, and efficient service function integration and maintenance is achieved.
Patent Information
- Application Number
- CN202311404900.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-26
- Publication Date
- 2025-04-29
AI Technical Summary
In the process of applying the extension function, third-party dependencies need to be manually configured, which is huge in work and is prone to errors or omissions. Especially when integrating multiple service functions, it is necessary to adapt to their respective service frameworks, which consumes a lot of R&D time and labor costs.
By pre-constructing the reference path and client integration configuration file, loading the automatic configuration class definition file of the target application, obtaining the target startup class definition information of the service functions to be integrated, and assembling the function object instance based on this information, registering it into the management container of the target application to achieve the integration of service functions.
It effectively improves the development efficiency of application function expansion, reduces the maintenance difficulty after the upgrade of the framework that has integrated service functions, and lowers the technical requirements threshold for developers.
Smart Images

Figure CN119902793A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of application development and microservice integration, and in particular to a method, device, electronic device and medium for integrating application service functions. Background Art
[0002] During the application development process, it is expected that the application can be extended with minimal framework changes or less coding workload, such as integrating some extended service functions, such as: integrating service functions developed within the enterprise or some external service functions.
[0003] In the process of realizing the concept of the present disclosure, the inventors found that there are at least the following technical problems in the related technology: Usually, in the process of realizing application extension functions, it is necessary to introduce third-party dependencies, which generally requires manual configuration, which is a huge workload and prone to errors or omissions; although some development frameworks provide friendly automatic assembly functions, such as SpringBoot, which has become a mainstream development framework, it is based on the design idea of convention over configuration, eliminates redundant code and XML mandatory configuration, and can integrate third-party independent service capabilities through the automatic assembly method of SpringBoot Starter, realize automatic assembly of components, and use them out of the box, which helps to improve development efficiency; however, when an application needs to integrate multiple service functions (including service platforms under different service frameworks, such as task platforms, scheduling platforms, unified configuration platforms, etc.), it is necessary to adapt to the service framework of each service function, and each corresponding data package for integration into SpringBootStarter is developed, which consumes a lot of research and development time and needs to be continuously updated and iterated with the iteration of these service frameworks. The corresponding data packages have high requirements for technical personnel in the research and development and maintenance process, and the time and labor costs are also high, and the development efficiency needs to be improved. Summary of the invention
[0004] In order to solve the above technical problems or at least partially solve the above technical problems, embodiments of the present disclosure provide a method, an apparatus, an electronic device, and a medium for integrating service functions of an application.
[0005] In the first aspect, an embodiment of the present disclosure provides a method for integrating service functions of an application. The method includes: loading a client integration configuration file from the automatic configuration class definition file of the target application according to a pre-built reference path; the client integration configuration file includes: a list of service functions to be integrated corresponding to the target application, and application local configuration information for each service function to be integrated; obtaining the target startup class definition information corresponding to the service function to be integrated; assembling based on the target startup class definition information and the application local configuration information to obtain a function object instance corresponding to each service function to be integrated; registering the function object instance to the management container of the target application to complete the integration of the target application with the service function to be integrated.
[0006] According to an embodiment of the present disclosure, the above-mentioned target application is built based on Springboot. After the above-mentioned target application is started, the automatic assembly logic of Springboot is executed, and the above-mentioned automatic assembly logic is used to implement the above-mentioned steps; according to the pre-built reference path, the client integration configuration file is loaded from the automatic configuration class definition file of the target application; the target startup class definition information corresponding to the above-mentioned service function to be integrated is obtained; based on the above-mentioned target startup class definition information and the above-mentioned application local configuration information, assembly is performed to obtain the function object instance corresponding to each service function to be integrated, and the above-mentioned function object instance is registered in the management container of the above-mentioned target application.
[0007] According to an embodiment of the present disclosure, the above-mentioned reference path is the path referenced by the above-mentioned client integration configuration file by the automatic configuration class definition file of the above-mentioned target application; the above-mentioned application local configuration information includes: the application identification of the user application, the access permission setting information of the user application, the address of the integration server and the custom startup parameters; wherein the above-mentioned user application includes the above-mentioned target application.
[0008] According to an embodiment of the present disclosure, obtaining the target startup class definition information corresponding to the above-mentioned service function to be integrated includes: based on the address of the above-mentioned integrated server and the remote procedure call method, obtaining the target startup class definition information corresponding to the above-mentioned service function to be integrated from the registration information of the registered service function of the above-mentioned integrated server; the above-mentioned registration information contains the startup class definition information of the above-mentioned registered service function. Based on the above-mentioned target startup class definition information and the above-mentioned application local configuration information, assembling to obtain the function object instance corresponding to each service function to be integrated includes: assembling the access permission setting information and the custom startup parameters under the same service function to be integrated into the corresponding definition fields of the corresponding target startup class definition information to obtain the function object instance corresponding to each service function to be integrated.
[0009] According to an embodiment of the present disclosure, the above method also includes: storing the mapping relationship between the application that has completed the service function integration and the corresponding service function and function object instance; in the case that the above target application needs to call the integrated service function, the above target application is used to perform the following steps: based on the above mapping relationship, determine the target function object instance corresponding to the service function to be called; obtain the above target function object instance from the above management container.
[0010] According to an embodiment of the present disclosure, the above method also includes: receiving an information query request for the service function integrated by the first application; according to the above mapping relationship, obtaining the target integrated service function and service function related information corresponding to the above first application and presenting them on the front display interface.
[0011] According to an embodiment of the present disclosure, the above method also includes: pre-building a client integration configuration file; pre-building a reference path for the above client integration configuration file to be referenced by the automatic configuration class definition file of the above target application; registering and storing the startup class definition information of the above service function to be integrated to the integration server.
[0012] According to an embodiment of the present disclosure, the above-mentioned pre-construction of the client integration configuration file includes: receiving list setting information of the service functions to be integrated contained in the target application; obtaining application local configuration information from the client local configuration files corresponding to each of the above-mentioned service functions to be integrated; and generating the client integration configuration file according to the above-mentioned list setting information and the application local configuration information for each service function to be integrated.
[0013] In the second aspect, an embodiment of the present disclosure provides a device for application integration service functions. The above-mentioned device includes: a configuration file loading module, an information acquisition module, an assembly module and a registration module. The above-mentioned configuration file loading module is used to load the client integration configuration file from the automatic configuration class definition file of the target application according to the pre-built reference path; the above-mentioned client integration configuration file contains: a list of service functions to be integrated corresponding to the target application, and application local configuration information for each service function to be integrated. The above-mentioned information acquisition module is used to obtain the target startup class definition information corresponding to the above-mentioned service function to be integrated. The above-mentioned assembly module is used to assemble based on the above-mentioned target startup class definition information and the above-mentioned application local configuration information to obtain the function object instance corresponding to each service function to be integrated. The above-mentioned registration module is used to register the above-mentioned function object instance in the management container of the above-mentioned target application to complete the integration of the above-mentioned service function to be integrated by the above-mentioned target application.
[0014] In a third aspect, an embodiment of the present disclosure provides an electronic device. The electronic device includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; the memory is used to store computer programs; and the processor is used to implement the method of the application integration service function as described above when executing the program stored in the memory.
[0015] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method for implementing the application integration service function described above is implemented.
[0016] The above technical solution provided by the embodiments of the present disclosure has at least some or all of the following advantages:
[0017] By pre-building a reference path and a client integration configuration file, the above-mentioned client integration configuration file includes: a list of service functions to be integrated corresponding to the target application, and application local configuration information for each service function to be integrated; in the process of building the target application, according to the pre-built reference path, the client integration configuration file is loaded from the automatic configuration class definition file of the target application; and combined with the obtained target startup class definition information corresponding to the above-mentioned service functions to be integrated, the function object instance corresponding to each service function to be integrated is assembled, and the above-mentioned function object instance is registered in the management container of the target application to realize the integration of the target application for one or more service functions to be integrated; based on a unified standard method, the client integration configuration file is built and the target startup class definition information corresponding to the registered service functions to be integrated is obtained, and one or more service functions to be integrated are integrated into the application in a configured form, which eliminates the development and testing links, and there is no need to write data packets for integration into SpringBoot Starter for multiple services to be integrated, which effectively improves the development efficiency of application function expansion, reduces the maintenance difficulty of the framework of the integrated service functions after upgrading, and also reduces the technical requirements for developers. In addition, for the users of each service function, they can access the corresponding service functions based on unified integration standards and processes. The access methods of the service function platforms under various frameworks are consistent, which improves the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0019] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or related technical descriptions are briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0020] Figure 1A The system architecture of the method for integrating application service functions applicable to the embodiment of the present disclosure is schematically shown;
[0021] Figure 1B A schematic diagram schematically shows an application scenario of the method for integrating application service functions according to an embodiment of the present disclosure;
[0022] Figure 2 A flowchart schematically illustrates a method for integrating application service functions according to an embodiment of the present disclosure;
[0023] Figure 3 A flowchart schematically illustrates a method for integrating application service functions according to another embodiment of the present disclosure;
[0024] Figure 4 A flowchart schematically illustrates a method for integrating application service functions according to another embodiment of the present disclosure;
[0025] Figure 5 The detailed implementation flow chart of step S410 according to the embodiment of the present disclosure is schematically shown;
[0026] Figure 6 The following schematically shows a method for implementing the application integration service function according to an embodiment of the present disclosure;
[0027] Figure 7 The following schematically shows a process diagram of implementing integrated service functions based on Springboot according to an embodiment of the present disclosure;
[0028] Figure 8 A structural block diagram schematically shows an apparatus for integrating application service functions according to an embodiment of the present disclosure; and
[0029] Fig. 9 The structural block diagram of the electronic device provided by the embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0030] Some development frameworks provide friendly automatic assembly functions. For example, SpringBoot has become a mainstream development framework. It is based on the design concept of convention over configuration, eliminates redundant code and XML mandatory configuration, and can integrate third-party independent service capabilities through the automatic assembly method of SpringBootStarter to achieve automatic assembly of components, which is ready to use out of the box and helps improve development efficiency. For example, many open source frameworks currently provide specifications and API integration implementations based on SpringBootStarter, which helps simplify the initial construction process of application development projects and the application development process, and improve development efficiency.
[0031] However, when an application needs to integrate multiple service functions (including service platforms under different service frameworks, such as task platforms, scheduling platforms, unified configuration platforms, unique serial number platforms, error code platforms, etc.), it is necessary to adapt to the service framework of each service function, and develop corresponding data packets for integration into SpringBoot Starter, which consumes a lot of R&D time and needs to continuously update and iterate the corresponding data packets with the iteration of these service frameworks. In addition, R&D personnel need to master the principles of Spring automatic assembly integration, and the R&D threshold is high. Therefore, there are the following technical problems: the R&D and maintenance processes have high requirements for technical personnel, the time and labor costs are also high, and the development efficiency needs to be further improved.
[0032] In view of this, the embodiments of the present disclosure provide a method for integrating service functions of an application, which constructs a client integration configuration file and target startup class definition information corresponding to the service function to be integrated based on a unified standard method, and integrates one or more service functions to be integrated into the application in a configured form, eliminating the development and testing steps, and there is no need to write data packets for integration into SpringBoot Starter for multiple services to be integrated, which effectively improves the development efficiency of application function expansion, reduces the maintenance difficulty of the framework of the integrated service function after upgrading, and also reduces the technical requirements for developers. In addition, for the users corresponding to each service function, they can access their corresponding service functions based on unified integration standards and processes, and the access methods corresponding to the service function platforms under various frameworks are consistent, which improves the user experience.
[0033] The method for integrating the application service function comprises: loading the client integration configuration file from the automatic configuration class definition file of the target application according to a pre-built reference path (the reference path is the path referenced by the automatic configuration class definition file of the target application); the client integration configuration file comprises: a list of service functions to be integrated corresponding to the target application, and application local configuration information for each service function to be integrated; obtaining the target startup class definition information corresponding to the service function to be integrated; assembling based on the target startup class definition information and the application local configuration information to obtain a function object instance corresponding to each service function to be integrated; registering the function object instance in the management container of the target application to complete the integration of the service function to be integrated by the target application.
[0034] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present disclosure.
[0035] Figure 1A The system architecture of the method for integrating application service functions applicable to the embodiment of the present disclosure is schematically shown; Figure 1B The following is a schematic diagram schematically showing an application scenario of the method for integrating application service functions according to an embodiment of the present disclosure.
[0036] Reference Figure 1A As shown, the system architecture 100 of the method for integrating service functions of applications in the embodiment of the present disclosure includes: terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is a medium that provides a communication link between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0037] Reference Figure 1BAs shown in the software development scenario corresponding to the single-point dashed arrow and user M, user M performs software development by operating the terminal device. In this scenario, the terminal devices 101, 102, and 103 in the system architecture 100 are application development terminals or application operation terminals, on which software development tools (which can be web-based online development tools or development applications) are installed. For example, the above-mentioned software development tools are development tools based on SpringBoot. User M is an application developer or application operator, and can perform software development based on the SpringBoot-based software development tools installed on the application development terminal or the operation terminal. Among them, during the software development process, the terminal device executes the method for integrating application service functions provided by the embodiment of the present disclosure, and realizes one or more service functions required for application integration based on unified standards and configurations, such as the schematic application A integrating service function 1 and service function 2; application B integrating service function 2, service function 3, service function 4, and service function 5. Correspondingly, the server 105 can be a server that provides service support for the above-mentioned software development tools, and can be an application server or a service cluster.
[0038] The above-mentioned service functions may be various basic service functions or extended service functions required by the application, and may include service platforms (also described as service functions) under various types of service frameworks, such as but not limited to: task platform, scheduling platform, unified configuration platform, unique serial number platform, error code platform, etc.
[0039] Reference Figure 1B As shown in the double-dotted arrow and the application usage scenario corresponding to user N, user N uses the application by operating the terminal device. In this scenario, the terminal devices 101, 102, and 103 in the system architecture 100 are terminal devices with the target application installed. The terminal device may also be installed with applications such as shopping applications, web browser applications, search applications, video playback applications, instant messaging tools, email clients, social platform software, etc. (only as an example). The above-mentioned target application is an application developed using the above-mentioned SpringBoot-based development tool and integrated with one or more required service functions. For example, user N can use service function 2 through application A or use service function 2 through application B. Correspondingly, the server 105 can be a server that provides service support for the above-mentioned target application, which can be an application server or a service cluster.
[0040] In the embodiment of the present disclosure, as a basic communication service framework example, it includes the following three parts: RPC communication framework (refer to Figure 1A As shown in the example system architecture 100), a service registration center (for example, a server in a software development scenario serving as a service registration center) and a management end (for example, a terminal device in a software development scenario).
[0041] It should be understood that Figure 1A The number of terminal devices, networks, and servers in the example is only illustrative. Any number of terminal devices, networks, and servers may be provided as required. The scenarios and frameworks to which the embodiments of the present disclosure can be applied are also not limited to the above examples.
[0042] The first exemplary embodiment of the present disclosure provides a method for integrating service functions of an application. The method of this embodiment can be applied to Figure 1A and Figure 1B A terminal device in an exemplary software development scenario. A software development tool is installed on the terminal device. In some embodiments, the software development tool may be a development tool based on SpringBoot.
[0043] Figure 2 The flowchart schematically shows a method for integrating service functions of an application according to an embodiment of the present disclosure. Figure 6 The following is a schematic diagram of a method for implementing an application integration service function according to an embodiment of the present disclosure. Figure 7 The figure schematically shows a process diagram of realizing integrated service functions based on Springboot according to an embodiment of the present disclosure.
[0044] Reference Figure 2 and Figure 6 As shown, the method for integrating application service functions provided by the embodiment of the present disclosure includes the following steps: S210, S220, S230 and S240.
[0045] In step S210, according to the pre-built reference path, the client integration configuration file is loaded from the automatic configuration class definition file of the target application; the client integration configuration file includes: a list of service functions to be integrated corresponding to the target application, and application local configuration information for each service function to be integrated.
[0046] In some embodiments, reference Figure 7As shown, the target application is built based on Springboot. After the target application is started, the automatic assembly logic of Springboot is executed. The automatic assembly logic is used to implement the following steps: according to the pre-built reference path, the client integration configuration file is loaded from the automatic configuration class definition file of the target application (step S210); the target startup class definition information corresponding to the service function to be integrated is obtained (step S220); based on the target startup class definition information and the local configuration information of the application, a function object instance corresponding to each service function to be integrated is obtained (step S230), and the function object instance is registered in the management container of the target application (step S240). The disclosed embodiment provides a logic for automatic assembly, which integrates one or more service functions to be integrated into the application in a configured form by constructing a standard client integration configuration file and obtaining the target startup class definition information corresponding to the registered service functions to be integrated (subsequently described in detail in step S220), eliminating the development and testing steps, and eliminating the need to write data packets for integration into SpringBoot Starter for multiple services to be integrated, effectively improving the development efficiency of application function expansion, and reducing the maintenance difficulty after the framework upgrade of the integrated service functions and the technical requirements for technical personnel.
[0047] The above-mentioned client integration configuration file is obtained by reading the list of service functions to be integrated corresponding to the target application, acquiring and constructing the application local configuration information of each service function to be integrated, and obtaining the configuration content under the same framework and language system. Compared with the data packet adapted to Sprinboot Stater under the framework of each service function separately constructed, the integration configuration file introduces the required configuration content and adopts a standardized framework and language system for integration. It is efficient when assembling and assembling in a configured form with the target startup class definition information corresponding to the registered service function to be integrated, and the development and subsequent upgrade iteration process are relatively simplified, which effectively improves the development efficiency of the application for functional expansion.
[0048] The above-mentioned service functions to be integrated can be various basic service functions or extended service functions required by the application, and can include service platforms (also described as service functions) under various types of service frameworks, such as but not limited to: task platform, scheduling platform, unified configuration platform, unique serial number platform, error code platform, etc. Each service function is a service framework including the front-end and back-end.
[0049] In some embodiments, the reference path is a path where the client integration configuration file is referenced by the automatic configuration class definition file of the target application. For example, the automatic configuration class definition file is a meta information file, and the corresponding file directory is in the following format: META-INF / spring.factories. There are many ways to reference the file path, for example, the client integration configuration file (as a subdirectory content) may be included under the file directory (as the root directory) of the automatic configuration class definition file.
[0050] In some embodiments, the client integration configuration file is, for example, a capability aggregation client jar package, wherein the jar package represents a file package in the Java Archive (a software package file format) format, and the capability aggregation client jar package is used to aggregate Java class files, related metadata and resources, etc. corresponding to the service functions to be integrated by the target application, and is implemented in the process of developing Java platform application software or libraries based on Springboot. In some embodiments, the capability aggregation client jar package can correspond to an application one-to-one, or a client integration configuration file can correspond to multiple applications, and the relevant configuration content of each application corresponds to multiple parallel subdirectories.
[0051] The above client integration configuration file is pre-built by user M (eg, an application developer or an application operator) through an application development end or an application operation end.
[0052] In some embodiments, the client integration configuration file may be a configuration file corresponding to each target application; for example, in the case where the target application is application A, the client integration configuration file S corresponding to application A may be: A , which may include a list of service functions to be integrated corresponding to application A, and application local configuration information for the service functions to be integrated (for example, including service functions 1 to 2) of application A. In the process of developing new applications (for example, new application B and new application C), client integration configuration files corresponding to the newly developed applications may be created. For example, client integration configuration files S corresponding to application B may be created separately. B , the client integration profile S corresponding to application C C .
[0053] In other embodiments, the client integration configuration file may be a configuration file corresponding to multiple target applications (e.g., application A and application B), and the configuration content corresponding to each target application is a branch content in the client integration configuration file S. In the process of developing a new application, a new branch content may be added to the original client integration configuration file S. Alternatively, a new client integration configuration file corresponding to the newly developed application may be created.
[0054] In some embodiments, the client integration configuration file includes: a list of service functions to be integrated corresponding to the target application, and application local configuration information for each service function to be integrated. The application local configuration information includes but is not limited to: application identification of the user application, access permission setting information of the user application (such as login key, login verification method, etc.), address of the integration server, and custom startup parameters; wherein the user application includes the target application.
[0055] As an example, the client integration configuration file adopts the format of a yml file, and the example is application-serviveproduct.yml. The configuration content example included in the client integration configuration file application-serviveproduct.yml is as follows, wherein the content in the brackets [ ] is used for explanation, and the code is only used as an example, and can be transformed or adjusted to other content and format according to actual conditions:
[0056] ability-client: [The root directory where the configuration content of the client integration configuration file is placed]
[0057] enable:true [enable indicates whether to load (or describe as enabling) the client integration configuration file at startup, true indicates starting loading]
[0058] APPcode:APPA [APPcode represents the application identifier of the user application. Here, the target application is application A as an example; the corresponding client integration profile represents the client integration profile corresponding to application A, which can be the client integration profile S in the previous example A or client integration profile S]
[0059] secret:123Abcxxxxx [secret represents the login key, as an example of access permission setting information;
[0060] 123Abcxxxxx is the parameter value example of the login key]
[0061] host:XXX.xxxx.yyyyy [host represents the address of the integration server, XXX.xxxx.yyyyy is an example of the parameter value of the address of the integration server]
[0062] services: [The plural form of services represents the list of service functions to be integrated corresponding to the target application. The multiple levels below represent the configuration contents of multiple services to be integrated of the target application A]
[0063] —serviceName:uuid [serviceName indicates the name of the service to be integrated. Here, the uuid unique serial number service function is used as an example of the parameter value of service function 1]
[0064] id:sequenceGenerator [id represents the sequence code, which is an example of a custom startup parameter for the unique serial number service function. sequenceGenerator is the value of the sequence code, which is generated by the serial number generator]
[0065] serverUrl:YYY.yyy.zzzzz [the server address corresponding to the unique serial number platform, as an example of a custom startup parameter for the unique serial number service function]
[0066] instanceNoLength:4 [instanceNoLength indicates the request number length, as an example of a custom startup parameter for the unique serial number service function. The specific parameter value can vary, and 4 is used as an example here]
[0067] sequenceLength:5 [sequenceLength indicates the sequence length, as an example of a custom startup parameter for the unique serial number service function. The specific parameter value can vary, and 5 is used as an example here]
[0068] —serviceName:task [Here, the task service function is used as an example of the parameter value of service function 2]
[0069] id:taskcenter [id represents the task identification code, which is an example of a custom startup parameter of the task service function, and taskcenter is an example of the value of the task identification]
[0070] inv:product [inv is the abbreviation of inventory, which means detailed catalog. It is an example of a custom startup parameter for the task service function. product is an example of a value for the detailed catalog, which means a product catalog.]
[0071] jmqProducer:producer [jmqProducer represents the message middleware. As an example of a custom startup parameter for the task service function, producer is an example of a value for the message middleware, indicating that the name of the message middleware is producer]
[0072] In step S220, the target startup class definition information corresponding to the service function to be integrated is obtained.
[0073] In some embodiments, the target startup class definition information of each service function to be integrated is pre-registered and stored in the integration service end. The registration of the startup class definition information is implemented based on a unified standard and format.
[0074] The target startup class definition information includes but is not limited to the following information: startup class, initialization method of startup class, destruction method of startup class, etc.
[0075] Some functions, classes, methods, etc. in the above target startup class definition information do not contain specific parameter values. In the subsequent step S230, it is necessary to load the custom startup parameters of each corresponding service function in the application local configuration information into the corresponding parameter field to obtain a function object instance.
[0076] Taking the target application built based on Springboot as an example, the target startup class definition information corresponding to the service function to be integrated is BeanDefinition, which is used to build Bean (an example of a functional object instance).
[0077] The Spring management container is the core of Spring, and all Spring beans are stored in the Spring management container. Bean configuration information defines the implementation and dependencies of beans. The Spring container creates bean instances based on various forms of bean configuration information and calls methods of bean instances to complete dependency injection. The Spring container is like a large factory, which can generate one or more product beans. The specific product bean looks like the configuration in the target startup class definition information. This configuration is created and maintained by developers, and can be implemented in SpringBoot through annotation injection.
[0078] As an example, the sample code of the target startup class definition information (specifically, Bean definition information) corresponding to service function 1 and service function 2 that have been registered and stored on the integration server is as follows, where the content in brackets [ ] is used for explanation. The code is only an example and can be transformed or adjusted to other content and format according to actual conditions:
[0079]
[0080]
[0081] According to an embodiment of the present disclosure, in the above step S220, the target startup class definition information corresponding to the above service function to be integrated is obtained, including: based on the address of the above integration server and the remote procedure call (RPC) method, the target startup class definition information corresponding to the above service function to be integrated is obtained from the registration information of the registered service function of the above integration server; the above registration information contains the startup class definition information of the above registered service function.
[0082] In some embodiments, the service identifier of the service to be integrated in the above list is read according to the client integration configuration file, the integration server is called, the remote configuration corresponding to the application is obtained, and the target startup class definition information corresponding to the service function to be integrated is read, such as the Bean definition information in the previous example. In other embodiments, in order to achieve high availability, the target startup class definition information can also be written into the local file of the target server adjacent to the above terminal device in the distributed service cluster, and when the RPC remote acquisition fails, it is downgraded to reading from the local file of the above target server.
[0083] In step S230, assembly is performed based on the target startup class definition information and the application local configuration information to obtain a function object instance corresponding to each service function to be integrated.
[0084] In some embodiments, in the above step S230, assembly is performed based on the above target startup class definition information and the above application local configuration information to obtain a function object instance corresponding to each service function to be integrated, including: assembling the access permission setting information and custom startup parameters under the same service function to be integrated into the corresponding definition field of the corresponding target startup class definition information (for example, the definition field is instanceNoLength, and the corresponding assembled custom startup parameter value is 4) to obtain a function object instance corresponding to each service function to be integrated.
[0085] In step S240, the function object instance is registered in the management container of the target application, thereby completing the integration of the target application with the service function to be integrated.
[0086] The target application implements the function call to the target function object instance by acquiring the required target function object instance.
[0087] In an embodiment including steps S210 to S240, a reference path and a client integration configuration file are pre-built, wherein the client integration configuration file includes: a list of service functions to be integrated corresponding to the target application, and application local configuration information for each service function to be integrated; during the construction of the target application, the client integration configuration file is loaded from the automatic configuration class definition file of the target application according to the pre-built reference path; and the function object instance corresponding to each service function to be integrated is assembled in combination with the target startup class definition information corresponding to the service function to be integrated, and the function object instance is registered in the management container of the target application to achieve the integration of one or more service functions to be integrated by the target application; the client integration configuration file is built based on a unified standard method and the target startup class definition information corresponding to the registered service function to be integrated is obtained, and one or more service functions to be integrated are integrated into the application in a configured form, thereby eliminating the development and testing links, and there is no need to write data packets for integration into SpringBoot Starter for multiple services to be integrated, which effectively improves the development efficiency of the application for functional expansion, reduces the maintenance difficulty after the framework of the integrated service function is upgraded, and also reduces the technical requirements for developers. In addition, for the users of each service function, they can access the corresponding service functions based on unified integration standards and processes. The access methods of the service function platforms under various frameworks are consistent, which improves the user experience.
[0088] Figure 3 The flowchart schematically shows a method for integrating service functions of an application according to another embodiment of the present disclosure.
[0089] According to an embodiment of the present disclosure, the above method for integrating service functions includes steps S210 to S240, and further includes the following steps: S310, S320 and S330. Figure 3 Steps S310 to S330 are illustrated in FIG. Steps S310 to S330 are performed after step S240.
[0090] In step S310, the mapping relationship between the application that has completed the service function integration and the corresponding service function and function object instance is stored. Specifically, the above mapping relationship can be stored in the client integration configuration file of the terminal device; in addition, the above mapping relationship can also be stored in the integration service end. For example, Figure 6 The example in the figure is to record which applications correspond to which self-developed platform capabilities.
[0091] For example, the stored mapping relationships include:
[0092] Application A-Service Function 1-beanA1;
[0093] Application A-Service Function 2-beanA2;
[0094] Application B-Service Function 2-beanB1;
[0095] Application B - Service Function 3 - beanB2;
[0096] Application B - Service Function 4 - beanB3;
[0097] Application B - Service Function 5 - beanB4.
[0098] When the target application needs to call an integrated service function, the target application is used to perform the following steps: based on the mapping relationship, determine the target function object instance corresponding to the service function to be called; and obtain the target function object instance from the management container.
[0099] In step S320, an information query request for a service function integrated by the first application is received.
[0100] In step S330, according to the above mapping relationship, the target integrated service function and service function related information corresponding to the above first application are obtained and presented on the front-end display interface.
[0101] The above service function related information includes but is not limited to: service function name, service function number, target application login key for service function, service function control console address, server address, responsible personnel information, etc.
[0102] In an embodiment including steps S310 to S330, by storing the mapping relationship between applications that have completed service function integration and the corresponding service functions and function object instances, developers or operators can query which applications have integrated which service functions and related information of each service function based on the above mapping relationship.
[0103] Figure 4 The flowchart schematically shows a method for integrating service functions of an application according to yet another embodiment of the present disclosure. Figure 5 The detailed implementation flow chart of step S410 according to the embodiment of the present disclosure is schematically shown.
[0104] According to an embodiment of the present disclosure, the method for integrating service functions of the application includes, in addition to the above steps S210 to S240, or includes the above steps S210 to S240 and S310, or includes the above steps S210 to S240 and S310 to S330, further including the following steps: S410, S420 and S430, in combination with Figure 4 and Figure 5 As shown, in Figure 4 Steps S210 to S240 and S410 to S430 are illustrated in FIG. Steps S410 and S420 are performed before step S210; and step S430 is performed before step S220.
[0105] In step S410, a client integration configuration file is pre-built.
[0106] In some embodiments, reference Figure 5 As shown, in the above step S410, pre-building the client integration configuration file includes the following steps: S510, S520 and S530.
[0107] In step S510, list setting information of the to-be-integrated service functions included in the target application is received.
[0108] For example, the list setting information may be information set by user M according to operational needs, or information set by user M according to the usage requirements of user N; as an example, for application A, the list setting information is: the list of service functions to be integrated includes service function 1, service function 2, and service function 3, which may specifically be the function identifiers of service functions 1 to 3 (such as platform names or platform numbers, etc.).
[0109] In step S520, application local configuration information is obtained from the client local configuration files corresponding to the above service functions to be integrated.
[0110] In some embodiments, the above-mentioned terminal device can access the client local configuration files corresponding to each service function to be integrated. Each client local configuration file is, for example, a client jar package corresponding to each service capability platform, such as: task platform client jar package, unified configuration client jar package, error code client jar package, etc. The application local configuration information corresponding to each service function can be obtained in each client local configuration file. For example, the application local configuration information corresponding to the task platform client jar package includes the custom startup parameters such as id:taskcenter, inv:product, jmqProducer:producer in the above example, and also includes relevant information about application login, service address, etc., such as APPcode:APPA, secret:123Abcxxxxx, host:XXX.xxxx.yyyyy, etc. in the above example.
[0111] In step S530, a client integration configuration file is generated according to the above list setting information and the application local configuration information for each service function to be integrated.
[0112] The application local configuration information and list setting information corresponding to the multiple service functions to be integrated generate a client integration configuration file according to the set encoding format, the set file directory format, etc.
[0113] Based on the above steps S510 to S530, a standardized framework and language system can be used to integrate and integrate multiple service functions to be integrated corresponding to the local configuration of the application, which is convenient and has a low-code construction process and high development efficiency.
[0114] In step S420, a reference path is pre-built for the client integration configuration file to be referenced by the automatic configuration class definition file of the target application.
[0115] When loading the startup class, the local configuration information of the application is read through the application path.
[0116] In step S430, the startup class definition information of the service function to be integrated is registered and stored in the integration service end.
[0117] For example, a startup class definition field writing box or options that need to be filled in are presented on the front-end display interface of the terminal device. The startup class definition field options can be obtained based on some historical usage scenarios of each service to be integrated, and the R&D personnel or operation personnel fill in the startup class definition fields or make selections based on the options.
[0118] Reference Figure 6 and Figure 7 As shown, in the embodiment including steps S410 to S430, as a prerequisite, a client integration configuration file is pre-built, a reference path of the client integration configuration file referenced by the automatic configuration class definition file of the target application, and the startup class definition information of the service function to be integrated is pre-registered and stored in the integration server. When the various service functions to be integrated are subsequently integrated for the target application, the various required service functions can be integrated in Springboot in a configured manner, and the configuration and registration of beans can be efficiently realized in a unified standard manner.
[0119] Reference Figure 7As shown in the figure, each service platform (which can be understood as a service function) registers and saves the startup class definition information to the integrated server, and the business application system references the capability aggregation client jar package and the client jar package corresponding to each service platform; the business application system configures the startup parameters of each service platform to the capability aggregation client (corresponding to the terminal device in the software development scenario). After the application is started, SpringBoot starts, retrieves the META-INF / spring.factories file, loads and assembles the capability aggregation client startup class, and registers the Bean. Among them, the capability aggregation client initializes and executes the following steps: calling the capability aggregation service, obtaining the registered service platform startup class definition, including startup class, startup method, destruction method and other information; obtaining the local configuration of the service platform in the application (client integration configuration file); assembling the startup class BeanDefinition of each research platform in a loop, and registering it to the Bean to the SpringBoot container. Record the context information of the capability aggregation client, including which applications correspond to which service platforms and related information of the service platforms, save the loaded Bean and parameters, and thus, the client startup class Bean of each research platform is created. After that, the business application system can obtain these Beans through dependency injection, and then use the functions of each service platform.
[0120] A second exemplary embodiment of the present disclosure provides an apparatus for integrating service functions with an application.
[0121] Figure 8 The structural block diagram of the device for integrating application service functions according to an embodiment of the present disclosure is schematically shown.
[0122] Reference Figure 8 As shown, the device 800 for application integration service function includes: a configuration file loading module 801, an information acquisition module 802, an assembly module 803 and a registration module 804.
[0123] The configuration file loading module 801 is used to load the client integration configuration file from the automatic configuration class definition file of the target application according to the pre-built reference path; the client integration configuration file includes: a list of service functions to be integrated corresponding to the target application, and application local configuration information for each service function to be integrated.
[0124] The information acquisition module 802 is used to acquire the target startup class definition information corresponding to the service function to be integrated.
[0125] The assembling module 803 is used to assemble based on the target startup class definition information and the application local configuration information to obtain a function object instance corresponding to each service function to be integrated.
[0126] The registration module 804 is used to register the function object instance into the management container of the target application, so as to complete the integration of the target application with the service function to be integrated.
[0127] According to an embodiment of the present disclosure, the above-mentioned target application is built based on Springboot. After the above-mentioned target application is started, the automatic assembly logic of Springboot is executed, and the above-mentioned automatic assembly logic is used to implement the above-mentioned steps; according to the pre-built reference path, the client integration configuration file is loaded from the automatic configuration class definition file of the target application; the target startup class definition information corresponding to the above-mentioned service function to be integrated is obtained; based on the above-mentioned target startup class definition information and the above-mentioned application local configuration information, assembly is performed to obtain the function object instance corresponding to each service function to be integrated, and the above-mentioned function object instance is registered in the management container of the above-mentioned target application.
[0128] According to an embodiment of the present disclosure, the above-mentioned reference path is the path referenced by the above-mentioned client integration configuration file by the automatic configuration class definition file of the above-mentioned target application; the above-mentioned application local configuration information includes: the application identification of the user application, the access permission setting information of the user application, the address of the integration server and the custom startup parameters; wherein the above-mentioned user application includes the above-mentioned target application.
[0129] According to an embodiment of the present disclosure, obtaining the target startup class definition information corresponding to the above-mentioned service function to be integrated includes: based on the address of the above-mentioned integrated server and the remote procedure call method, obtaining the target startup class definition information corresponding to the above-mentioned service function to be integrated from the registration information of the registered service function of the above-mentioned integrated server; the above-mentioned registration information contains the startup class definition information of the above-mentioned registered service function. Based on the above-mentioned target startup class definition information and the above-mentioned application local configuration information, assembling to obtain the function object instance corresponding to each service function to be integrated includes: assembling the access permission setting information and the custom startup parameters under the same service function to be integrated into the corresponding definition fields of the corresponding target startup class definition information to obtain the function object instance corresponding to each service function to be integrated.
[0130] According to an embodiment of the present disclosure, the above-mentioned device 700 further includes: a mapping relationship storage module, a query request receiving module and a presentation module.
[0131] The mapping relationship storage module is used to store the mapping relationship between the application that has completed the service function integration and the corresponding service function and function object instance.
[0132] When the target application needs to call an integrated service function, the target application is used to perform the following steps: based on the mapping relationship, determine the target function object instance corresponding to the service function to be called; and obtain the target function object instance from the management container.
[0133] The query request receiving module is used to receive an information query request for the service function integrated by the first application.
[0134] The above-mentioned presentation module is used to obtain the target integrated service function and service function related information corresponding to the above-mentioned first application according to the above-mentioned mapping relationship and present them on the front-end display interface.
[0135] The above device also includes: a construction module and a registration module.
[0136] The building module is used to pre-build a client integration configuration file and a reference path for the client integration configuration file to be referenced by the automatic configuration class definition file of the target application.
[0137] The registration module is used to register and store the startup class definition information of the service function to be integrated in the integration server.
[0138] According to an embodiment of the present disclosure, the above-mentioned pre-construction of the client integration configuration file includes: receiving list setting information of the service functions to be integrated contained in the target application; obtaining application local configuration information from the client local configuration files corresponding to each of the above-mentioned service functions to be integrated; and generating the client integration configuration file according to the above-mentioned list setting information and the application local configuration information for each service function to be integrated.
[0139] Any number of the functional modules included in the above-mentioned device 700 can be combined in one module for implementation, or any one of the modules can be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules can be combined with at least part of the functions of other modules and implemented in one module. At least one of the functional modules included in the device 700 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application-specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware and firmware or in any appropriate combination of any of them. Alternatively, at least one of the functional modules included in the device 700 can be at least partially implemented as a computer program module, and when the computer program module is run, the corresponding function can be executed.
[0140] A fifth exemplary embodiment of the present disclosure provides an electronic device.
[0141] Fig. 9 The structural block diagram of the electronic device provided by the embodiment of the present disclosure is schematically shown.
[0142] Reference Fig. 9 As shown, the electronic device 900 provided by the embodiment of the present disclosure includes a processor 901, a communication interface 902, a memory 903 and a communication bus 904, wherein the processor 901, the communication interface 902 and the memory 903 communicate with each other through the communication bus 904; the memory 903 is used to store computer programs; the processor 901 is used to implement the method of application integration service functions as described above when executing the program stored in the memory.
[0143] The sixth exemplary embodiment of the present disclosure further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method for implementing the application integration service function described above is implemented.
[0144] The computer-readable storage medium may be included in the device or apparatus described in the above embodiment; or it may exist independently without being assembled into the device or apparatus. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present disclosure is implemented.
[0145] According to an embodiment of the present disclosure, a computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, may include but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.
[0146] It should be noted that the collection, collection, update, analysis, processing, use, transmission, storage and other aspects of user personal information involved in the technical solution provided by the embodiments of the present disclosure are in compliance with the provisions of relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. Necessary measures are taken for user personal information to prevent illegal access to user personal information data and maintain the security of user personal information, network security and national security.
[0147] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0148] The foregoing is merely a specific embodiment of the present disclosure, which enables those skilled in the art to understand or implement the present disclosure. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features applied herein.
Claims
1. A method for application integration service function, characterized in that: include: Load the client integration configuration file from the target application's automatic configuration class definition file according to the pre-built reference path; The client integration configuration file includes: a list of service functions to be integrated corresponding to the target application, and application local configuration information for each service function to be integrated; Obtaining target startup class definition information corresponding to the service function to be integrated; Assemble based on the target startup class definition information and the application local configuration information to obtain a function object instance corresponding to each service function to be integrated; The function object instance is registered in the management container of the target application to complete the integration of the service function to be integrated by the target application.
2. The method according to claim 1, characterized in that The target application is built based on Springboot. After the target application is started, the automatic assembly logic of Springboot is executed, and the automatic assembly logic is used to implement the above steps; Load the client integration configuration file from the target application's automatic configuration class definition file according to the pre-built reference path; Obtaining target startup class definition information corresponding to the service function to be integrated; Based on the target startup class definition information and the application local configuration information, assembly is performed to obtain a function object instance corresponding to each service function to be integrated, and the function object instance is registered in the management container of the target application.
3. The method according to claim 1, characterized in that The reference path is a path where the client integration configuration file is referenced by the automatic configuration class definition file of the target application; The application local configuration information includes: an application identifier of a user application, access permission setting information of the user application, an address of an integrated server, and custom startup parameters; wherein the user application includes the target application.
4. The method according to claim 3, characterized in that Acquiring target startup class definition information corresponding to the service function to be integrated, comprising: acquiring the target startup class definition information corresponding to the service function to be integrated from registration information of a registered service function of the integration server based on the address of the integration server and the remote procedure call method; the registration information includes the startup class definition information of the registered service function; Based on the target startup class definition information and the application local configuration information, assembly is performed to obtain a function object instance corresponding to each service function to be integrated, including: assembling the access permission setting information and custom startup parameters under the same service function to be integrated into the corresponding definition fields of the corresponding target startup class definition information to obtain a function object instance corresponding to each service function to be integrated.
5. The method according to claim 1, characterized in that Also includes: Storing the mapping relationship between the application that has completed service function integration and the corresponding service function and function object instance; In the case where the target application needs to call an integrated service function, the target application is used to perform the following steps: based on the mapping relationship, determine the target function object instance corresponding to the service function to be called; and obtain the target function object instance from the management container.
6. The method according to claim 5, characterized in that Also includes: Receiving an information query request for a service function integrated by the first application; According to the mapping relationship, the target integrated service function and service function related information corresponding to the first application are obtained and presented on the front-end display interface.
7. The method according to any one of claims 1 to 6, characterized in that Also includes: Pre-built client integration profiles; Pre-building a reference path for the client integration configuration file to be referenced by the automatic configuration class definition file of the target application; The startup class definition information of the service function to be integrated is registered and stored in the integration service end.
8. The method according to claim 7, characterized in that Pre-built client integration profiles including: Receive list setting information of service functions to be integrated included in the target application; Acquire application local configuration information from the client local configuration files corresponding to the service functions to be integrated; A client integration configuration file is generated according to the list setting information and the application local configuration information for each service function to be integrated.
9. A device for application integration service function, characterized in that: include: The configuration file loading module is used to load the client integration configuration file from the automatic configuration class definition file of the target application according to the pre-built reference path; The client integration configuration file includes: a list of service functions to be integrated corresponding to the target application, and application local configuration information for each service function to be integrated; An information acquisition module, used to acquire target startup class definition information corresponding to the service function to be integrated; An assembling module, used to assemble based on the target startup class definition information and the application local configuration information to obtain a function object instance corresponding to each service function to be integrated; The registration module is used to register the function object instance into the management container of the target application, so as to complete the integration of the target application into the service function to be integrated.
10. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; Memory, used to store computer programs; A processor, for implementing the method according to any one of claims 1 to 8 when executing a program stored in a memory.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.