Extension method and device of web service public component, electronic equipment and storage medium

By configuring the controller layer as non-inheritable and placing the business logic in the service layer, and by creating new extension projects based on the dependencies between the service layer and the data access layer, the intrusion problem caused by component extension in existing technologies is solved, and flexible and efficient component extension is achieved.

CN114936046BActive Publication Date: 2026-05-22TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
TENCENT TECHNOLOGY (SHENZHEN) CO LTD
Filing Date
2021-02-04
Publication Date
2026-05-22

AI Technical Summary

Technical Problem

Existing technologies require modifications to the main body of web service components when extending them, leading to intrusion and preventing arbitrary extension.

Method used

By configuring the controller layer as non-inheritable and placing all business logic in the service layer, and leveraging the dependencies between the service layer and the data access layer to create new extension projects, a strong extension with zero intrusion can be achieved.

Benefits of technology

It enables zero-intrusion strong extension of common components of web services, improving the flexibility and efficiency of extension, and reducing code duplication and modification costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114936046B_ABST
    Figure CN114936046B_ABST
Patent Text Reader

Abstract

The application provides an extension method and device of a WEB service public component, electronic equipment and a storage medium. The public component includes a controller layer for parameter exchange with the outside world, a service layer for service under the call of the controller layer, and a data access layer for operating a database under the call of the service layer. The controller layer is not inheritable. The business logic of the public component is concentrated in the service layer. The method includes: creating an extension project dependent on the public component by depending on the service layer or the data access layer; deploying an extension service into the extension project by depending on the service layer; and configuring the extension project based on a startup class of the public component, so as to trigger the public component to provide the extension service based on the startup class of the public component. The application embodiment realizes zero-invasion strong extension of the WEB service public component.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of web services, specifically to a method, apparatus, electronic device, and storage medium for extending common components of web services. Background Technology

[0002] In web services, common components are indispensable, such as those used for log management, user management, and scheduling management. During the invocation of these common components, it is often necessary to extend their services according to actual application requirements, enabling them to provide customized extended services.

[0003] In existing technologies, extending a public component will inevitably modify the main application of the public component, causing intrusion into the public component; moreover, the prerequisite for extension is to define the interface first, and extension cannot be arbitrarily performed. Summary of the Invention

[0004] One objective of this application is to provide a method, apparatus, electronic device, and storage medium for extending common components of web services, which can achieve non-intrusive and strong extension of common components of web services.

[0005] According to one aspect of the embodiments of this application, a method for extending a common component of a web service is disclosed. The common component includes a controller layer for exchanging parameters with the outside world, a service layer for providing services under the invocation of the controller layer, and a data access layer for operating the database under the invocation of the service layer. The controller layer is not inheritable, and all the business logic of the common component is located in the service layer. The method includes:

[0006] Create new extension projects that depend on the public components by relying on the service layer or the data access layer;

[0007] By relying on the service layer, the extended services are deployed into the extended project;

[0008] Configure the extension project based on the startup class of the common component, so as to trigger the common component to provide the extension service based on the startup class of the common component.

[0009] According to one aspect of the embodiments of this application, an extension device for a common WEB service component is disclosed. The common component includes a controller layer for exchanging parameters with the outside world, a service layer for providing services under the invocation of the controller layer, and a data access layer for operating a database under the invocation of the service layer. The device is characterized in that it includes:

[0010] The new module of the project is configured to create an extension project that depends on the service layer or the data access layer;

[0011] The project deployment module is configured to deploy extended services into the extended project by relying on the service layer;

[0012] The project configuration module is configured to configure the extended project based on the startup class of the common component, so as to trigger the common component to provide the extended service based on the startup class of the common component.

[0013] In an exemplary embodiment of this application, the apparatus is configured to encapsulate the controller layer, the service layer, and the data access layer of the common component into corresponding sub-modules.

[0014] In one exemplary embodiment of this application, the device is configured as follows:

[0015] The dependency on the service layer is achieved by writing the submodule containing the service layer as a dependency into the extension project;

[0016] By writing the submodule containing the data access layer as a dependency into the extension project, the dependency on the data access layer is achieved.

[0017] In one exemplary embodiment of this application, the device is configured as follows:

[0018] The extended service is added by relying on the service layer;

[0019] Deploy the extended services into the extended project.

[0020] In one exemplary embodiment of this application, the device is configured as follows:

[0021] The extended service is obtained by modifying the existing services of the public components based on the service layer.

[0022] Deploy the extended service into the extended project and increase the injection priority of the extended service.

[0023] In one exemplary embodiment of this application, the device is configured as follows:

[0024] Create a new startup class for the aforementioned extended project;

[0025] Obtain the annotation configuration of the startup class of the public component;

[0026] Copy the annotation configuration to the startup class of the extension project so that the public component can be triggered to provide the extension service through the startup class of the extension project.

[0027] In one exemplary embodiment of this application, the device is configured as follows:

[0028] Configure the startup class path associated with the startup class of the common component in the extended project, so as to trigger the common component to provide the extended service through the startup class of the common component.

[0029] According to one aspect of the embodiments of this application, an electronic device is disclosed, comprising: a memory storing computer-readable instructions; and a processor reading the computer-readable instructions stored in the memory to perform the method described in any of the preceding claims.

[0030] According to one aspect of the embodiments of this application, a computer program medium is disclosed, on which computer-readable instructions are stored, which, when executed by a computer's processor, cause the computer to perform the method described in any of the preceding claims.

[0031] According to one aspect of the embodiments of this application, a computer program product or computer program is provided, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in the various optional implementations described above.

[0032] In this embodiment of the application, by configuring the common component as non-inheritable in the controller layer and setting all business logic in the service layer, the extension project that depends on the common component can provide extended services on the basis of the common component without causing any intrusion into the common component, thus realizing zero-intrusion strong extension of the WEB service common component.

[0033] Other features and advantages of this application will become apparent from the following detailed description, or may be learned in part from practice of this application.

[0034] It should be understood that the above general description and the following detailed description are merely exemplary and do not limit this application. Attached Figure Description

[0035] The above and other objectives, features and advantages of this application will become more apparent from a detailed description of exemplary embodiments thereof with reference to the accompanying drawings.

[0036] Figure 1 A schematic diagram of the architecture between common components and their extensions according to one embodiment of this application is shown.

[0037] Figure 2 A flowchart illustrating an extension method for a common component of a web service according to an embodiment of this application is shown.

[0038] Figure 3 This illustration shows an architecture diagram of encapsulating a common component into multiple sub-modules according to one embodiment of this application.

[0039] Figure 4 A block diagram of an extension device for a common component of web services according to an embodiment of this application is shown.

[0040] Figure 5 A hardware diagram of an extended electronic device for a common component of web services according to an embodiment of this application is shown. Detailed Implementation

[0041] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, they are provided to make the description of this application more comprehensive and complete, and to fully convey the concept of the exemplary embodiments to those skilled in the art. The drawings are merely illustrative of this application and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted.

[0042] Furthermore, the described features, structures, or characteristics can be combined in any suitable manner in one or more exemplary embodiments. Numerous specific details are provided in the following description to give a full understanding of exemplary embodiments of this application. However, those skilled in the art will recognize that the technical solutions of this application can be practiced with one or more of the specific details omitted, or other methods, components, steps, etc., can be employed. In other instances, well-known structures, methods, implementations, or operations are not shown or described in detail to avoid obscuring various aspects of this application.

[0043] Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.

[0044] Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and networks within a wide area network or local area network to achieve data computing, storage, processing, and sharing.

[0045] Cloud technology is a collective term for network technologies, information technologies, integration technologies, management platform technologies, and application technologies applied to the cloud computing business model. It can form resource pools, providing flexible and convenient on-demand access. Cloud computing technology will become a crucial support. Backend services of technical network systems require substantial computing and storage resources, such as video websites, image websites, and many portal websites. With the rapid development and application of the internet industry, every item may have its own identification mark in the future, requiring transmission to backend systems for logical processing. Data at different levels will be processed separately, and various industry data will all require robust system support, which can only be achieved through cloud computing.

[0046] This application relates to a website platform using cloud technology.

[0047] This application provides a method for extending common components of a web service. The common components in this application can be common components of the Spring Boot framework or common components of a non-Spring Boot framework. For ease of understanding, this application uses common components of the Spring Boot framework as an example for description, but this does not mean that this application is only applicable to common components of the Spring Boot framework.

[0048] The public components in this application embodiment mainly include three parts related to service provision and service extension: the controller layer, referred to as controller in this application embodiment; the service layer, referred to as service in this application embodiment; and the data access layer, referred to as dao (data access object) in this application embodiment.

[0049] The controller is the code layer that defines the API (Application Programming Interface) path and input / output parameters of the public components. It is used for parameter exchange between the public components and the outside world, and is mainly responsible for the input parameter validation and output parameter packaging of the public components.

[0050] The service layer is the code layer containing the specific business logic, invoked by the controller. It provides functional services to common components, primarily responsible for data analysis and assembly. Further, the service layer includes: a service layer interface, denoted as the service interface in this embodiment; and the service layer interface implementation, denoted as serviceImpl in this embodiment. The service implementation is mainly concentrated in serviceImpl, and extensions to common components are primarily achieved through operations on serviceImpl.

[0051] The DAO is the code layer that interacts with the database and is called by the service. It is used to manipulate the database, specifically to add, retrieve, update, and delete data.

[0052] In short, a database can be viewed as an electronic filing cabinet—a place to store electronic files, where users can perform operations such as adding, querying, updating, and deleting data. A "database" is a collection of data stored together in a certain way, capable of being shared by multiple users, with minimal redundancy, and independent of application programs.

[0053] A Database Management System (DBMS) is a computer software system designed to manage databases, generally possessing basic functions such as storage, retrieval, security, and backup. DBMSs can be classified according to the database model they support, such as relational or XML (Extensible Markup Language); or according to the type of computer they support, such as server clusters or mobile devices; or according to the query language used, such as SQL (Structured Query Language) or XQuery; or according to performance priorities, such as maximum scale or maximum operating speed; or other classification methods. Regardless of the classification method used, some DBMSs can cross categories, for example, simultaneously supporting multiple query languages.

[0054] In this embodiment, to achieve zero-intrusion strong extension of the common component, the controller in the common component is configured as non-inheritable, meaning that all classes in the controller are not allowed to be inherited. The reason is that if the controller were configured as inheritable, service extensions based on this would cause changes to the API URL and input / output parameters when the API defined in the controller is called by the frontend or other related services, intruding into the common component and causing some services to become unavailable. Furthermore, if the controller were configured as inheritable, when users manually extend services in the common component, they need to fully understand the business logic of the common component, the role and usage of each input and output parameter, and the usage of each interface, and all of these must be modified synchronously, which is costly. Moreover, if users do not fully understand the business logic, modifying an immutable field can cause some services to become unavailable, or missing a user can cause that user to become unavailable, easily introducing problems.

[0055] In addition to configuring the controller in the common component to be non-inheritable, this embodiment of the application also places all the business logic of the common component in the service. More specifically, all the business logic is placed in the serviceImpl within the service. Through this configuration, the controller is made as thin as possible, only handling service interface calls, parameter validation, and response wrapping.

[0056] Furthermore, in this embodiment of the application, when extending a common component based on the principles of "controller non-inheritability" and "all business logic set in the service," the extension project used to implement the extended service is configured to depend on the common component. This ensures that while the extension project extends the service of the common component, it does not cause any intrusion into the common component (i.e., it does not modify the main body of the common component). Specifically, the extension project can be configured to depend on the common component through code dependency.

[0057] The public components proposed in this application embodiment can be extended in two ways.

[0058] The first approach involves building an extension system on a server that integrates the extension method proposed in this public embodiment. This extension system stores various common components of web services (all stored common components are configured so that the controller cannot be inherited, and all business logic is set in the service). Users specify the target common component and the target extension service to the extension system via their terminals. The extension system then automatically retrieves the specified common component and extends its service according to the extension method proposed in this application embodiment, subsequently providing the extended version of the specified common component to the user.

[0059] The second approach involves building a public component platform on a server that stores various common components for web services (all stored common components are configured so that the controller cannot be inherited and all business logic is set in the service). After users obtain the common components to be extended from this extension system through their terminals, they can manually extend the services according to their needs.

[0060] The server can be a standalone physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server providing cloud computing services. The terminal can be a smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, etc., but is not limited to these. The terminal and server can be connected directly or indirectly via wired or wireless communication, which is not limited herein.

[0061] Figure 1 A schematic diagram of the architecture between common components and extensions of an embodiment of this application is shown.

[0062] like Figure 1 As shown in this embodiment, the expansion of public components relies on the public components for service expansion. Service expansion falls into two categories: first, adding entirely new functional services, which is achieved by adding new API interfaces; second, modifying existing services, which is achieved through service overriding.

[0063] Service extension through service overriding can be divided into two cases: First, for method-level services, service overriding is performed by using the Java class ServiceImplExt, which inherits from the serviceImpl class, thereby modifying the original method-level service; Second, for class-level services, service overriding is performed by using the implementation class ServiceExtImpl, which implements the service interface, thereby modifying the original class-level service.

[0064] When service extension is achieved through service overriding, the extended class (i.e., ServiceImplExt or ServiceExtImpl) will override the original method's corresponding serviceImpl. Therefore, in the original public component, serviceImpl conditional wiring only loads serviceImpl when there is no extended class.

[0065] It should be noted that this embodiment is merely an illustrative example and should not be construed as limiting the functionality and scope of this application.

[0066] Based on the improved public components proposed in the embodiments of this application, the extension method proposed in the embodiments of this application can be further applied to achieve strong extension of the public components with zero intrusion.

[0067] Figure 2 A flowchart illustrating a method for extending a common component of a web service according to an embodiment of this application is shown. As shown, the method includes:

[0068] Step S110: Create a new extension project that depends on common components through the service layer or data access layer;

[0069] Step S120: Deploy the extended service into the extended project by relying on the service layer;

[0070] Step S130: Configure the extension project based on the startup class of the public component, so as to trigger the public component to provide the extension service based on the startup class of the public component.

[0071] Specifically, based on the improved public component (controller is not inheritable, and all business logic is set in the service) provided in the embodiments of this application: by depending on the service or dao of the original public component, a new extension project that depends on the public component is created; since all the business logic used to implement the functional service is set in the service of the public component, the extension service is deployed into the extension project by depending on the service; and the extension project is configured based on the startup class of the public component, so that the public component can be triggered to provide the extension service based on the startup class of the public component.

[0072] Before detailing the complete process of alternative embodiments for service expansion, the processing procedures of each embodiment of this disclosure will be shown first.

[0073] In one embodiment, the method further includes: encapsulating the controller layer, the service layer, and the data access layer of the common component into corresponding sub-modules.

[0074] In this embodiment, the controller of the common component is configured to be non-inheritable, and all business logic is placed in the service. Then, the controller, service, and DAO are further encapsulated into corresponding sub-modules. The process of encapsulating the service into the corresponding sub-module includes: encapsulating the service interface into the corresponding sub-module, and encapsulating the serviceImpl into the corresponding sub-module.

[0075] The advantage of this embodiment is that by configuring the common components as separate sub-modules, the service can be extended as needed for dependency reuse, making full use of the existing implementations in the common components, reducing code duplication and improving the flexibility of service extension.

[0076] Figure 3 This illustration shows an architecture diagram of an embodiment of the present application in which a common component is encapsulated as multiple sub-modules.

[0077] like Figure 3 As shown in this embodiment, the controller, serviceImpl, service interface, and dao in the common components are all modularized and encapsulated into their respective sub-modules. This architecture divides the common components into multiple loosely coupled sub-modules, allowing for service extensions based on existing serviceImpl, service interface, and dao sub-modules as needed. This facilitates dependency implementation, reduces code duplication during service extensions, and improves the flexibility of service extensions.

[0078] It should be noted that this embodiment is merely an illustrative example and should not be construed as limiting the functionality and scope of this application.

[0079] In one embodiment, relying on the service layer includes: implementing reliance on the service layer by writing the submodule containing the service layer as a dependency into the extension project;

[0080] Dependence on the data access layer includes: implementing dependency on the data access layer by writing the submodule containing the data access layer as a dependency into the extension project.

[0081] In this embodiment, the controller, service, and dao of the common component are pre-encapsulated into corresponding sub-modules. During the creation of a new extension project, depending on the needs of the extended service, the extension project can depend on the service of the common component by writing the service sub-module (including the service interface sub-module and the serviceImpl sub-module) as a dependency; alternatively, the extension project can depend on the dao of the common component by writing the dao sub-module as a dependency.

[0082] In this application embodiment, there are two scenarios for extending the services of public components: 1. Adding entirely new functional services; 2. Modifying existing services. Therefore, the specific implementation process of deploying extended services in these two scenarios will be described below.

[0083] In one embodiment, deploying extended services into the extended project by relying on the service layer includes:

[0084] This extended service is added by relying on this service layer;

[0085] Deploy the extended service into the extended project.

[0086] In this embodiment, the target extended service is entirely new compared to the original common component. In this case, the extended service is added by depending on the service of the original common component, and then the new extended service is deployed into the extended project. If the original common component has been pre-divided into sub-modules, the extended service can be added and deployed into the extended project by writing the service sub-module of the common component as a dependency.

[0087] Specifically, in one embodiment, the controller, service, and DAO of the common component are pre-encapsulated into corresponding sub-modules. The extended service to be extended is entirely new compared to the common component.

[0088] The process of extending this common component is as follows: Create a new Spring Boot project as the extension project, and create controller, service, and dao components to implement the extended service. During the implementation of this extended service, if a method in the service of the common component is needed, add the service submodule of the common component as a dependency to the pom.xml of the extension project, and then use the corresponding bean and method. If a method in the dao of the common component is also needed, add the dao submodule of the common component as a dependency to the pom.xml of the extension project, and then use the corresponding bean and method. If beans from other submodules of the common component are also needed, add the required submodules as dependencies to the pom.xml of the extension project, and then use the corresponding beans.

[0089] Once the extension is complete, starting the extension project will enable the public components to provide extended services.

[0090] It should be noted that this embodiment is merely an illustrative example and should not be construed as limiting the functionality and scope of this application.

[0091] In one embodiment, deploying extended services into the extended project by relying on the service layer includes:

[0092] This extended service is obtained by modifying the existing services of the public component based on this service layer;

[0093] Deploy the extension service into the extension project and increase the injection priority of the extension service.

[0094] In this embodiment, the extended service, compared to the original public component, modifies an existing service. In this case, the extended service is obtained by modifying the existing service of the public component through its dependent service. The modified extended service is then deployed into the extension project, and its injection priority is increased (e.g., using `@primary` to increase injection priority) so that it can override the existing service of the public component. If the original public component has been pre-divided into sub-modules, the existing service of the public component can be modified by adding its service sub-module as a dependency to the extension project and then modifying it to obtain the modified extended service, which is then deployed into the extension project.

[0095] Furthermore, modifying the existing services of this public component can be further divided into two cases: First, for method-level services, service overriding is achieved by inheriting the implementation class of serviceImpl; Second, for class-level services, service overriding is achieved by implementing the service interface in service.

[0096] Specifically, in one embodiment, the controller, service, and DAO of the common component are pre-encapsulated into corresponding sub-modules. The extended service, compared to the original common component, modifies the existing service.

[0097] If the modification is to an existing method-level service, the process of extending the public component is as follows: create a new Spring Boot project as the extension project; add the serviceImpl submodule as a dependency to the pom.xml of the extension project, then create a new class that inherits the corresponding serviceImpl class and override the methods that need to be modified in the serviceImpl class.

[0098] If the modification is to an existing class-level service, the process of extending the common component is as follows: create a new Spring Boot project as the extension project; add the service submodule as a dependency to the pom.xml of the extension project, then create a new class to implement the corresponding service interface, and implement all methods in the service interface according to the logic of the extended service.

[0099] Once the extension is complete, starting the extension project will enable the public components to provide extended services.

[0100] It should be noted that this embodiment is merely an illustrative example and should not be construed as limiting the functionality and scope of this application.

[0101] In this embodiment, there are two ways to trigger the public component to provide extended services: 1. By triggering the public component to provide extended services through the startup class of the extended project; 2. By triggering the public component to provide extended services through the startup class of the public component. The specific implementation process of triggering the public component to provide extended services under these two methods will be described below.

[0102] In one embodiment, the extension project is configured based on the startup class of the common component, so that the common component is triggered to provide the extension service based on the startup class of the common component, including:

[0103] Create a new startup class for this expansion project;

[0104] Retrieve the annotation configuration of the startup class of this public component;

[0105] Copy the annotation configuration to the startup class of the extension project so that the public component can be triggered to provide the extension service through the startup class of the extension project.

[0106] In this embodiment, the public component is triggered to provide extended services by extending the startup class of the extended project.

[0107] Specifically, a new startup class is created for the extension project (the startup class for the extension project is different from the startup class for the common component). Then, the annotation configuration of the startup class for the common component is copied and pasted into the startup class of the extension project. Thus, when the extension project is started through the startup class of the extension project, the common component is also started, triggering the common component to provide the extension services in the extension project.

[0108] The advantages of this embodiment are that it provides extended services by extending the startup class of the extended project. When it is necessary to add new existing services, the corresponding annotations can be added directly to the startup class of the extended project without intruding on public components. The startup class of the extended project is custom-made, which makes it easier to extend. The extended project is still a component project with a clear structure. When developing an extension, the startup class can be easily located from the project code and started, avoiding the need to rely on JAR packages to find the startup class.

[0109] In one embodiment, the extension project is configured based on the startup class of the common component, so that the common component is triggered to provide the extension service based on the startup class of the common component, including:

[0110] Configure the startup class path associated with the startup class of the public component in the extension project, so that the public component can be triggered to provide the extension service through the startup class of the public component.

[0111] In this embodiment, the public component is triggered to provide extended services through the startup class of the public component.

[0112] Specifically, the startup classpath is configured in the pom.xml file of the extension project, and this startup classpath is associated with the startup class of the common component. Thus, after the common component is started through its startup class, the extension project is then started through this startup classpath, triggering the common component to provide the extended services provided in the extension project.

[0113] Figure 4 An extension device for a common WEB service component according to an embodiment of this application is shown, the device comprising:

[0114] Project module 210 is configured to create an extension project that depends on the public component by relying on the service layer or the data access layer.

[0115] The project deployment module 220 is configured to deploy extended services into the extended project by relying on the service layer;

[0116] The project configuration module 230 is configured to configure the extended project based on the startup class of the common component, so as to trigger the common component to provide the extended service based on the startup class of the common component.

[0117] In an exemplary embodiment of this application, the apparatus is configured to encapsulate the controller layer, the service layer, and the data access layer of the common component into corresponding sub-modules.

[0118] In one exemplary embodiment of this application, the device is configured as follows:

[0119] The dependency on the service layer is achieved by writing the submodule containing the service layer as a dependency into the extension project;

[0120] By writing the submodule containing the data access layer as a dependency into the extension project, the dependency on the data access layer is achieved.

[0121] In one exemplary embodiment of this application, the device is configured as follows:

[0122] The extended service is added by relying on the service layer;

[0123] Deploy the extended services into the extended project.

[0124] In one exemplary embodiment of this application, the device is configured as follows:

[0125] The extended service is obtained by modifying the existing services of the public components based on the service layer.

[0126] Deploy the extended service into the extended project and increase the injection priority of the extended service.

[0127] In one exemplary embodiment of this application, the device is configured as follows:

[0128] Create a new startup class for the aforementioned extended project;

[0129] Obtain the annotation configuration of the startup class of the public component;

[0130] Copy the annotation configuration to the startup class of the extension project so that the public component can be triggered to provide the extension service through the startup class of the extension project.

[0131] In one exemplary embodiment of this application, the device is configured as follows:

[0132] Configure the startup class path associated with the startup class of the common component in the extension project, so as to trigger the common component to provide the extension service through the startup class of the common component.

[0133] The following is for reference. Figure 5 This describes an extended electronic device 30 for a common WEB service component according to an embodiment of this application. Figure 5 The electronic device 30 shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.

[0134] like Figure 5 As shown, the electronic device 30 is presented in the form of a general-purpose computing device. The components of the electronic device 30 may include, but are not limited to: at least one processing unit 310, at least one storage unit 320, and a bus 330 connecting different system components (including storage unit 320 and processing unit 310).

[0135] The storage unit stores program code that can be executed by the processing unit 310, causing the processing unit 310 to perform the steps described in the exemplary method description section of this specification according to various exemplary embodiments of the present invention. For example, the processing unit 310 can perform actions such as... Figure 2 The steps shown are as follows.

[0136] Storage unit 320 may include readable media in the form of volatile storage units, such as random access memory (RAM) 3201 and / or cache memory 3202, and may further include read-only memory (ROM) 3203.

[0137] Storage unit 320 may also include a program / utility 3204 having a set (at least one) program module 3205, such program module 3205 including but not limited to: operating system, one or more application programs, other program modules and program data, each or some combination of these examples may include an implementation of a network environment.

[0138] Bus 330 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the various bus structures.

[0139] Electronic device 30 can also communicate with one or more external devices 400 (e.g., keyboard, pointing device, Bluetooth device, etc.), and with one or more devices that enable a user to interact with electronic device 30, and / or with any device that enables electronic device 30 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 350. Input / output (I / O) interface 350 is connected to display unit 340. Furthermore, electronic device 30 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 360. As shown, network adapter 360 communicates with other modules of electronic device 30 via bus 330. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 30, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0140] Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the method according to the embodiments of this application.

[0141] In an exemplary embodiment of this application, a computer-readable storage medium is also provided, on which computer-readable instructions are stored, which, when executed by a computer's processor, cause the computer to perform the methods described in the above method embodiments.

[0142] According to one embodiment of this application, a program product for implementing the methods in the above-described method embodiments is also provided. This product may employ a portable compact disc read-only memory (CD-ROM) and include program code, and may run on a terminal device, such as a personal computer. However, the program product of this invention is not limited thereto. In this document, a 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.

[0143] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0144] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting programs for use by or in conjunction with an instruction execution system, apparatus, or device.

[0145] The program code contained on the readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.

[0146] Program code for performing the operations of this invention can be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as JAVA and C++, and conventional procedural programming languages ​​such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0147] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to the embodiments of this application, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.

[0148] Furthermore, although the steps of the method in this application are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in that specific order, or that all the steps shown must be performed to achieve the desired result. Additional or alternative steps may be omitted, multiple steps may be combined into one step, and / or a step may be broken down into multiple steps.

[0149] Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, mobile terminal, or network device, etc.) to execute the method according to the embodiments of this application.

[0150] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the appended claims.

Claims

1. A method for extending a common component of a web service, the common component comprising a controller layer for exchanging parameters with the outside world, a service layer for providing services under the invocation of the controller layer, and a data access layer for operating a database under the invocation of the service layer, characterized in that, The controller layer is not inheritable, the business logic of the common components is concentrated in the service layer, and the method includes: As needed for extended services, the submodule containing the service layer or the submodule containing the data access layer is written as a dependency into the configuration file of the extended project through code dependency, so as to create an extended project that depends on the common component. The submodule containing the service layer is obtained by encapsulating the service layer of the common component into a corresponding submodule, and the submodule containing the data access layer is obtained by encapsulating the data access layer of the common component into a corresponding submodule. By relying on the service layer, the extended services are deployed into the extended project; Configure the extension project based on the startup class of the common component, so as to trigger the common component to provide the extension service based on the startup class of the common component.

2. The method according to claim 1, characterized in that, The method further includes: encapsulating the controller layer of the common component into a corresponding sub-module.

3. The method according to claim 1, characterized in that, By relying on the service layer, the extended services are deployed into the extended project, including: The extended service is added by relying on the service layer; Deploy the extended services into the extended project.

4. The method according to claim 1, characterized in that, By relying on the service layer, the extended services are deployed into the extended project, including: The extended service is obtained by modifying the existing services of the public components based on the service layer. Deploy the extended service into the extended project and increase the injection priority of the extended service.

5. The method according to claim 1, characterized in that, Configure the extension project based on the startup class of the common component, so as to trigger the common component to provide the extension service based on the startup class of the common component, including: Create a new startup class for the aforementioned extended project; Obtain the annotation configuration of the startup class of the public component; Copy the annotation configuration to the startup class of the extension project so that the public component can be triggered to provide the extension service through the startup class of the extension project.

6. The method according to claim 1, characterized in that, Configure the extension project based on the startup class of the common component, so as to trigger the common component to provide the extension service based on the startup class of the common component, including: Configure the startup class path associated with the startup class of the common component in the extension project, so as to trigger the common component to provide the extension service through the startup class of the common component.

7. An extension device for a common component of a web service, the common component comprising a controller layer for exchanging parameters with the outside world, a service layer for providing services under the invocation of the controller layer, and a data access layer for operating a database under the invocation of the service layer, characterized in that, The device includes: The newly created module of the project is configured to, according to the needs of the extended service, write the sub-module where the service layer is located or the sub-module where the data access layer is located as a dependency into the configuration file of the extended project through code dependency, so as to create an extended project that depends on the common component. The sub-module where the service layer is located is obtained by encapsulating the service layer of the common component into a corresponding sub-module, and the sub-module where the data access layer is located is obtained by encapsulating the data access layer of the common component into a corresponding sub-module. The project deployment module is configured to deploy extended services into the extended project by relying on the service layer; The project configuration module is configured to configure the extended project based on the startup class of the common component, so as to trigger the common component to provide the extended service based on the startup class of the common component.

8. An extended electronic device for a common component of web services, characterized in that, include: Memory, which stores computer-readable instructions; The processor reads computer-readable instructions stored in memory to execute the method described in any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, It stores computer-readable instructions that, when executed by the computer's processor, cause the computer to perform the method described in any one of claims 1-6.