Integration method and device of main application and micro-front-end architecture
Through the combination of micro front-end architecture and injection scripts, the problem of intrusive rewriting of application integration in the existing technology is solved, flexible control and security guarantee of sub-applications are achieved, user experience and integration efficiency are improved, and development and Maintenance cost.
Patent Information
- Application Number
- CN202410983926.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-22
- Publication Date
- 2024-11-22
AI Technical Summary
The existing application integration method requires invasive rewriting of the code of the middle platform system, resulting in poor security, possible injection attacks, poor communication flexibility, style conflicts, poor user experience, and high development and maintenance costs.
The micro front-end architecture is combined with injection scripts to generate injection scripts and inject sub-application code to achieve flexible control and security guarantees for sub-applications, adapt to the main application page style, simplify the integration process, and reduce learning and maintenance costs.
Without invading the sub-application code, flexible control and security guarantee for sub-applications are achieved, flexibility in the display of main applications, user experience is improved, integration process is simplified, and learning and maintenance costs are reduced.
Smart Images

Figure CN119011207A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of application integration technology, and in particular to a main application integration method, device and micro-frontend architecture. Background Art
[0002] During the processing of marketing projects, business personnel often need to log in to multiple middle-office systems to fill in multiple configuration information separately. Moreover, since each middle-office system can perform different functions and the functions corresponding to the execution steps of the marketing business may involve different middle-office systems, multiple middle-office systems may need to be logged in repeatedly for settings, resulting in high learning costs for use between different platforms, cumbersome operations, and large differences between different platforms, which can easily lead to errors.
[0003] Existing developers use frameworks such as native iframe and qiankun micro front-end to integrate multiple middle-office systems into a large middle-office system without affecting the functions of each platform system, so as to avoid the various problems of the above-mentioned multiple middle-office systems. The native iframe framework embeds iframe tags corresponding to multiple middle-office systems into the iframe framework, and the corresponding middle-office system can be accessed by accessing the iframe tag; the qiankun micro front-end framework uses the routing distribution mechanism to access the middle-office system corresponding to the route, and can freely adjust the interface style, etc.
[0004] However, for the native iframe framework, on the one hand, since the adaptation of the function requires cross-site intrusive rewriting of the code of the middle-office system, its security is poor and injection attacks may exist; on the other hand, due to the unique sandbox isolation mechanism, the communication is one-to-one and the communication information needs to be pre-configured. Once the communication relationship changes, the configuration information needs to be modified again, which has poor flexibility; furthermore, since the style cannot be adjusted, it is not synchronized with the original system display, which not only has poor flexibility, but also brings a bad user experience to users. For the qiankun micro-frontend framework, the introduction of different middle-office systems requires the modification of the packaging methods of various files to match the qiankun framework. The adaptability adjustment of the interface style requires the modification of the system code of the middle-office system, which will also bring invasive problems, and the development and maintenance costs are high. Summary of the invention
[0005] In view of this, the embodiments of the present disclosure provide a main application integration method, device and micro-front-end architecture, which can solve the problems that existing application integration requires invasive rewriting, resulting in poor security and possible injection attacks; poor communication flexibility, style conflicts, poor user experience, and high development and maintenance costs.
[0006] To achieve the above objective, according to one aspect of the present disclosure, a main application integration method is provided, the method is applied to a micro front-end architecture, and the method includes:
[0007] Receiving an application generation request; wherein the application generation request includes an application type of a target main application;
[0008] Displaying a main application page corresponding to the application type, wherein the main application page includes multiple sub-application tabs;
[0009] Generate an injection script for each of the sub-application tabs, and inject the injection script into the corresponding sub-application code;
[0010] Parse the response information returned by the sub-application corresponding to each of the sub-application tabs when executing the injected script, execute the behavior script corresponding to the response information, and receive the user's operation results on each of the sub-application tabs. When the operation result of each sub-application tab is page completion, automatically jump to the next sub-application tab;
[0011] Determine whether an operation result confirming submission is received from each sub-application tab page, and if an operation result confirming submission is received, generate the target main application using page data of each of the sub-application tab pages.
[0012] According to another aspect of the present disclosure, a main application integration method is provided, the method is applied to a sub-application, and the method includes:
[0013] Receive the injected script;
[0014] The injected script is executed and response information is returned.
[0015] According to another aspect of the present disclosure, a main application integration device is provided, the device is applied to a micro front-end architecture, and the device includes:
[0016] A receiving module, configured to receive an application generation request; wherein the application generation request includes an application type of a target main application;
[0017] A display module, used to display a main application page corresponding to the application type, wherein the main application page includes a plurality of sub-application tabs;
[0018] An injection module, used to generate an injection script for each of the sub-application tabs, and inject the injection script into the corresponding sub-application code;
[0019] An execution module, used to parse the response information returned by the sub-application corresponding to each of the sub-application tabs when executing the injection script, execute the behavior script corresponding to the response information, and receive the user's operation results on each of the sub-application tabs, and automatically jump to the next sub-application tab when the operation result of each sub-application tab is page completion;
[0020] The generation module is used to determine whether the operation results of confirming submission are received from each sub-application tab page, and if the operation results of confirming submission are received, the target main application is generated using the page data of each of the sub-application tab pages.
[0021] According to another aspect of the present disclosure, there is provided an integration device of a main application, the device being applied to a sub-application, the device comprising:
[0022] A receiving module, used to receive the injected script;
[0023] The execution module is used to execute the injection script and return response information.
[0024] According to another aspect of the present disclosure, a micro-frontend architecture is provided, including: an architecture frontend and an architecture backend, wherein the architecture frontend includes a decentralized communication tool, a webpage development component, a sub-application loading component, and an injection plug-in, wherein:
[0025] The decentralized communication tool is used for interactive communication between the main application and the sub-application;
[0026] The architecture foreground receives an application generation request; wherein the application generation request includes an application type of a target main application;
[0027] The sub-application loading component accesses multiple sub-applications corresponding to the application type;
[0028] The webpage development component displays a main application page corresponding to the application type, the main application page including sub-application tabs of a plurality of sub-applications;
[0029] The injection plug-in generates an injection script for each of the sub-application tabs, and injects the injection script into the corresponding sub-application code;
[0030] The architecture frontend parses the response information returned by the sub-application corresponding to each of the sub-application tabs when executing the injected script, executes the behavior script corresponding to the response information, and receives the user's operation results on each of the sub-application tabs. When the operation result of each sub-application tab is page completion, it automatically jumps to the next sub-application tab;
[0031] The architecture foreground determines whether it has received confirmation of submission from each sub-application tab page. If confirmation of submission is received, the page data of each sub-application tab page is sent to the architecture background, and the architecture background uses the page data to generate the target main application.
[0032] According to another aspect of the present disclosure, there is provided an integration system of a main application, characterized in that it includes a micro-frontend architecture and multiple sub-applications.
[0033] According to another aspect of the present disclosure, there is provided an electronic device, comprising:
[0034] Processor; and
[0035] Memory for storing programs,
[0036] The program includes instructions, which, when executed by the processor, cause the processor to execute the integration method of the main application.
[0037] According to another aspect of an embodiment of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to execute the main application integration method.
[0038] One or more technical solutions provided in the embodiments of the present application integrate multiple sub-applications into the main application by utilizing a micro-frontend architecture in combination with an injected script, so that users can complete operations on multiple sub-applications in the main application page. Scripts can be injected into the sub-application environment for execution without intruding the sub-application, thereby flexibly controlling the sub-application, avoiding invasive rewriting of the sub-application, and preventing injection attacks on the sub-application, thereby ensuring the security of the sub-application. In addition, the technical solutions can adapt to the page style of the main application, improve the display flexibility of the main application, enhance the user experience, greatly reduce user operations, simplify the integration process, and thus reduce learning costs, improve the integration efficiency of the main application, and reduce development and maintenance costs.
[0039] Furthermore, through the free configuration script method disclosed in the present invention, sub-applications can be flexibly controlled without the need for packaging modifications, life cycle modifications, and script intrusive rewriting of the sub-applications. Even if the sub-applications undergo changes such as URL changes or functional changes, it is only necessary to adaptively modify the application information and corresponding relationships in the architecture database, which greatly reduces development and maintenance costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Further details, features and advantages of the present disclosure are disclosed in the following description of exemplary embodiments in conjunction with the accompanying drawings, in which:
[0041] Figure 1 A flowchart showing a method for integrating a main application according to a first exemplary embodiment of the present disclosure is shown;
[0042] Figure 2 A concise schematic diagram of a micro frontend architecture according to an exemplary embodiment of the present disclosure is shown;
[0043] Figure 3 A schematic diagram showing the correspondence between a main application and a sub-application according to an exemplary embodiment of the present disclosure is shown;
[0044] Figure 4 A flowchart of a method for displaying a main application page according to an exemplary embodiment of the present disclosure is shown;
[0045] Figure 5 A schematic diagram showing a main application page according to an exemplary embodiment of the present disclosure is shown;
[0046] Figure 6 A flowchart of a script injection method according to an exemplary embodiment of the present disclosure is shown;
[0047] FIG. 7( a) shows a schematic diagram of an injection template according to an exemplary embodiment of the present disclosure;
[0048] FIG7( b) shows a schematic diagram of an injection script according to an exemplary embodiment of the present disclosure;
[0049] Figure 8 A flowchart showing a method for integrating a main application according to a second exemplary embodiment of the present disclosure is shown;
[0050] Fig. 9 A schematic block diagram showing a generating device of an application according to a first exemplary embodiment of the present disclosure;
[0051] Fig.10 A schematic block diagram showing a generating device of an application according to a second exemplary embodiment of the present disclosure;
[0052] Fig.11 A schematic diagram of a micro front-end architecture according to an exemplary embodiment of the present disclosure is shown;
[0053] Fig.12 A schematic diagram showing an integration flow of a main application using a micro front-end architecture according to an exemplary embodiment of the present disclosure is shown;
[0054] Fig.13 A schematic diagram showing a configuration of application information of a sub-application according to an exemplary embodiment of the present disclosure is shown;
[0055] Fig.14 A schematic diagram showing a configuration of a correspondence relationship between a main application and sub-applications according to an exemplary embodiment of the present disclosure;
[0056] Fig.15 A structural block diagram of an exemplary electronic device that can be used to implement the embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0057] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0058] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0059] The term "including" and its variations used in this document are open inclusions, that is, "including but not limited to". The term "based on" means "based at least in part on". The term "in the embodiment of the present disclosure" means "at least one embodiment"; the term "another exemplary embodiment" means "at least one other embodiment". Relevant definitions of other terms will be given in the following description. It should be noted that the concepts of "first", "second", etc. mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0060] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0061] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0062] Micro front-end architecture: an architectural style that consists of multiple independently delivered main applications, breaking down the main application into smaller, simpler sub-applications that can be independently developed, tested, and deployed, while still appearing as a cohesive single product to users.
[0063] Main application: A system that integrates various sub-applications.
[0064] Sub-applications: The existing middle-office systems need to be integrated into a single system.
[0065] In the existing marketing project creation process, business personnel often need to log in to 7 or 8 middle-office systems, and fill in multiple configuration information for each system before completion. Among them, once the execution steps of the marketing project require multiple participation of the same middle-office system, the same middle-office system may need to be logged in repeatedly for configuration. Therefore, business personnel need to be familiar with the architecture, interface, and relevant knowledge of each configuration item of multiple middle-office systems, resulting in a high learning cost for the creation of marketing projects. In addition, logging in to different middle-office systems is cumbersome, and the large differences between platforms make it easy to make mistakes.
[0066] Therefore, in order to reduce the learning cost and simplify the creation operation, existing developers use frameworks such as native iframe and qiankun micro-frontend to integrate multiple middle-end systems into a large system. Among them, iframe embeds the functional tags of multiple middle-end systems to achieve the effect of accessing another web page in one page, realizing the integration of multiple middle-end systems; qiankun uses the routing distribution mechanism to access the route to access the resources of the corresponding middle-end system. Compared with iframe, it is different in that it has free communication and can make advance judgments on the interface style, so as to adjust the display and other configurations to synchronize with the original system, with a higher degree of freedom.
[0067] However, for the native iframe framework, cross-site invasive rewriting will bring more serious security threats. One-to-one communication makes communication inefficient, and it is impossible to flexibly control and adjust the middle-end systems. The flexibility is very poor, and there are style problems such as the window size being out of sync with the original system, which will bring a bad user experience.
[0068] For the qiankun micro-frontend framework, the introduction of different middle-office systems requires the modification of the corresponding packaging methods, life cycle functions, etc. to match the qiankun framework. At the same time, environmental adaptability adjustments to interface styles (for example, different sidebar positions, etc.) or functional adaptability adjustments to the middle-office system also require the modification of the system code of the middle-office system, which will also bring about highly invasive problems and high development and maintenance costs.
[0069] In the embodiments of the present disclosure, through the integration method of the main application of the present disclosure, a micro-front-end architecture is combined with an injection script to integrate multiple sub-applications (i.e., traditional middle-office systems) into the main application (i.e., a large system integrating multiple traditional middle-office systems), thereby flexibly controlling the sub-applications, greatly reducing the user's learning cost, improving the user experience, and improving the main application configuration efficiency. Moreover, since the sub-application code is not invasively rewritten, the security of the sub-application can be guaranteed.
[0070] Aspects of the present disclosure are described below with reference to the accompanying drawings.
[0071] Figure 1 A flowchart of a method for integrating a main application according to a first exemplary embodiment of the present disclosure is shown. Figure 1 As shown, the main application integration method of the first embodiment of the present disclosure includes the following steps:
[0072] In an embodiment of the present disclosure, the integration method of the main application of the first embodiment of the present disclosure is executed by a micro front-end architecture.
[0073] Step 101: Receive an application generation request; wherein the application generation request includes an application type of a target main application.
[0074] In the disclosed embodiment, the micro-frontend architecture receives an application generation request, which includes an application identifier and an application type of the target main application to be generated. The application type of the main application can be selectively set according to the actual usage scenario, marketing needs, etc. For example, the application type of the main application can be a real-time business application, a rights and interests application, an ease of use application, etc.; and the application identifier of the main application corresponds to the application type, which can be selectively set by the developer according to the actual application scenario and scenario scale. For example, the application identifiers of the real-time business main application, the rights and interests main application, and the ease of use main application are 161, 165, and 168, respectively.
[0075] Step 102: Display a main application page corresponding to the application type, wherein the main application page includes a plurality of sub-application tabs.
[0076] In the embodiment of the present disclosure, each main application is composed of multiple sub-applications, such as Figure 2 As shown, the micro-frontend architecture is used to carry the main application, including a configuration management unit and a mapping management unit. The configuration management unit is used to configure the application information of each sub-application and store the application information in the architecture database. The application information includes the application name, URL address, initialization interface, save interface, behavior script, etc. of each sub-application. Among them, the URL address refers to the access address of the sub-application; the initialization interface is a listening interface for the jump timing of the application behavior in various sub-applications, which is used to be injected into the sub-application code so that the sub-application returns the interface message of the corresponding timing; the save interface is a listening interface for various data in various sub-applications, which is also used to be injected into the sub-application code, and when the sub-application returns the corresponding interface data, it is saved for subsequent direct calling and use; the behavior script includes a new script, an editing script, a copy script, a parsing script, a response script, etc., which are used to simulate the user's operation behavior in the sub-application, and can be constructed according to the actual sub-application operations that the user needs to perform.
[0077] The mapping management unit is used to manage the correspondence between various types of main applications and sub-applications, and store the correspondence in the architecture database. For example, traditional sub-applications include rights management platform, Bole business platform, operation management platform, usability platform, and unified reach platform. The rights management platform includes coupon templates, external rights templates, red envelope templates and other functions. The Bole business platform includes strategy tree instances, business plans, crowd management and other functions. The usability platform includes credit trial pages, component instance management, rule management and other functions. The unified reach platform includes template list and other functions. Taking the real-time operation main application as the main application as an example, the real-time operation main application requires the coupon template function of the rights management platform + the template list function of the unified reach platform + the strategy tree instance function of the Bole business platform + the component instance management function, rule management function and credit trial page function of the usability platform + the crowd management function and business plan function of the Bole business platform. Accordingly, Figure 3 As shown, the real-time business main application includes multiple sub-applications, namely, coupon templates, template lists, policy tree instances, component instance management, rule management, credit trial calculation page, crowd management, and business plan.
[0078] Furthermore, in response to the application generation request, the micro-frontend architecture accesses the URL addresses of each sub-application included in the target main application, obtains the corresponding resources and renders and generates each sub-application tab, which is displayed on the main application page. Figure 4 As shown, the method for displaying the main application page of the present disclosure includes the following steps:
[0079] Step 401: search the architecture database according to the application identifier corresponding to the application type to determine a plurality of sub-applications corresponding to the target main application.
[0080] In an embodiment of the present disclosure, the micro-frontend architecture searches for multiple sub-applications included in the target main application to be generated in the application generation request according to the corresponding relationship between each type of main application and sub-application in the architecture database.
[0081] Step 402: Match URL addresses of multiple sub-applications corresponding to the target main application from the architecture database.
[0082] In an embodiment of the present disclosure, the micro-frontend architecture matches the URL addresses of each sub-application included in the target main application to be generated in the application generation request according to the application information of each sub-application in the architecture database.
[0083] Step 403 , access each of the URL addresses, and render and generate each of the sub-application tabs under the main application page of the target main application.
[0084] In the disclosed embodiment, the micro-frontend architecture accesses the URL addresses of each sub-application included in the target main application to be generated in the application generation request, obtains the application resources of the corresponding sub-application, and renders the sub-application tabs of each corresponding sub-application in the main application page of the micro-frontend architecture. Figure 5 As shown, under the main application page of the real-time business main application, the sub-application tabs are the coupon template tab, template list tab, strategy tree instance tab, component instance management tab, rule management tab, credit trial calculation page tab, crowd management tab, and business plan tab.
[0085] In the embodiment of the present disclosure, through the display method of the main application page of the present disclosure, it is possible to use the pre-stored mapping data to determine which sub-applications correspond to the target main application; then use the pre-stored application information of the sub-application to access the sub-application under the target main application, obtain the corresponding sub-application resources and render them under the main application page, thereby realizing the display of multiple sub-application tabs in one main application page, and then subsequently realizing the configuration of each sub-application under one main application page without the need to frequently log in to multiple sub-applications, greatly simplifying the integration operation of the main application, and at the same time, there is no need to learn the different interfaces, operations, languages, data formats, etc. of multiple sub-applications, thereby reducing learning costs, avoiding frequent errors, and improving the integration efficiency and accuracy of the main application, thereby also reducing testing costs and shortening the development cycle.
[0086] Step 103, generating an injection script for each of the sub-application tabs, and injecting the injection script into the corresponding sub-application code.
[0087] In the embodiment of the present disclosure, the micro-frontend architecture matches the application information of each sub-application under the target main application from the architecture database, and uses the application information to fill the injection template to obtain the injection script; before injecting the injection script into the corresponding sub-application code, accordingly, Figure 6 As shown, the script injection method disclosed in the present invention includes the following steps:
[0088] Step 601: searching the architecture database for storage paths of application information of each sub-application.
[0089] In the disclosed embodiment, after the micro-frontend architecture displays the main application page of the target main application, it searches the architecture database for the storage path of the application information of each sub-application according to the sub-application identifier corresponding to the sub-application tab.
[0090] Step 602: fill in the injection template of the corresponding sub-application tab page using the storage path of the application information to generate an injection script for the sub-application tab page.
[0091] In the embodiment of the present disclosure, the injection template stored in the architecture database is shown in Figure 7(a), which is used to enable the sub-application to interact with the main application, return the interface message required to initialize the interface to the main application, return the interface data required to save the interface to the main application, etc. before injecting all the codes of the sub-application after filling.
[0092] Furthermore, the storage path of the application information corresponding to the sub-application tab is used as the external script src to fill in the injection template. During subsequent operation, the sub-application can return an interface message to the main application when the initialization interface is triggered, return interface data to the main application when the save interface is triggered, and execute various behavior scripts under the instruction of the main application, so that the main application can flexibly and freely configure and call the sub-application.
[0093] The callback target (i.e., tar*) of the callback function can be selectively set as needed, such as the window object of the sub-application and the execution context. The callback target is filled into the callback function callback() of the injection template to obtain the injection script. For example, as shown in Figure 7(b), the callback function is used to print the name of the sub-application.
[0094] Furthermore, the display style of the sub-application tab can be used as an inline content fill injection template, so that when the main application page calls the sub-application resource to render the sub-application tab, it can be selectively set according to the display requirements.
[0095] Step 603: Add the injection script corresponding to the sub-application tab page before the corresponding sub-application code.
[0096] In the disclosed embodiment, the micro-frontend architecture adds the injection script corresponding to the sub-application tab to the corresponding sub-application code according to the sub-application identifier corresponding to the sub-application tab, so that the sub-application can execute the injection script when running, and return messages or data required by various interfaces as needed. For example, the sub-application uses JavaScript language, and the injection script is inserted before all js of the sub-application.
[0097] In the embodiment of the present disclosure, through the script injection method of the present disclosure, it is possible to utilize pre-stored mapping data to determine the access addresses and interface information corresponding to the various sub-application tab targets included in the target main application, and then use the access address and interface information to fill in the injection script and inject it before all the codes of the sub-application, so that the subsequent sub-application can return various messages or data as required by the injection script. Since there is no need to invasively rewrite the sub-application code, but only add a set of functions before the sub-application code, the security threats brought by injection attacks can be avoided, thereby ensuring the security of the sub-application while reducing the learning cost and improving the integration efficiency of the main application.
[0098] Step 104, parse the response information returned by the sub-application corresponding to each of the sub-application tabs when executing the injected script, execute the behavior script corresponding to the response information, and receive the user's operation results on each of the sub-application tabs. When the operation result of each sub-application tab is page completion, automatically jump to the next sub-application tab.
[0099] In the embodiment of the present disclosure, the response information can be an interface message or interface data. The micro-frontend architecture can execute the behavior script that requires user operation on the corresponding sub-application tab page according to the interface message returned by each sub-application. Thus, the effect of operating the sub-application on the main application page can be achieved. Except for the input of key information, the remaining operation behaviors can be implemented through the behavior script, which greatly reduces user operations, simplifies the integration process, reduces the learning cost and improves the generation efficiency. Compared with the traditional middle-end integration that requires users to create, edit, copy, save and other operations, the micro-frontend architecture of the present disclosure does not require users to perform the above-mentioned operations. For example, the traditional modification of the edit page of the generated main application requires users to ① click "Main Application Modification" -> ② Enter the generated id -> ③ Click "Search" -> ④ Select the target in the result list -> ⑤ Click "Edit", and using the micro-frontend architecture of the present disclosure, the user's history list will be automatically displayed after the user logs in. The user only needs to ① select the operation to directly enter the edit page of the main application, that is, the search, jump, input and other processes can be automatically executed without user operation.
[0100] In addition, the micro-frontend architecture can store the interface data returned by each sub-application.
[0101] Furthermore, the web page data of each sub-application tab can be automatically brought into the subsequent sub-application tabs, and the subsequent sub-application tabs can extract and use it as needed. For example, the web page data of each sub-application tab can generate a web page snapshot or web page backup, and store it according to the snapshot id or backup id. The subsequent sub-application tabs can directly use the data in the web page snapshot or web page backup, such as Figure 5 As shown, the coupon type, applicable products, and using business parties in the coupon template can be directly brought into the subsequent sub-application tabs. When the subsequent sub-application tabs encounter the same fields, they directly extract the field data in the web page snapshot or web page backup of the coupon template for filling in, without the need for users to fill in repeatedly, further reducing user operations, simplifying the integration process, reducing learning costs, and improving generation efficiency.
[0102] Furthermore, after displaying the main application page of the target main application to be generated, the user can operate on each sub-application tab, and can view the various field data that have been filled, and can also modify and edit the various field data that have been filled. The micro-frontend architecture receives the user's operation information on each sub-application tab, including the operation object, operation behavior, operation result, etc. Figure 5 As shown, the user fills in the name of the equity template as Equity Test, and accordingly, the operation object is the input box, the operation behavior is input, the operation result is successful input and the filled-in field data "Equity Test", that is, the equity template is the equity test template; for another example, the user selects the business department as Credit Products and Marketing Department, and accordingly, the operation object is the selection box, the operation behavior is clicking, the operation result is successful selection and the selected field data "Credit Products and Marketing Department".
[0103] In addition, except for the last sub-application tab, each sub-application tab corresponding to the main application is provided with a "Next" button and a "Submit" button, and the last sub-application tab is only provided with a "Submit" button. For sub-application tabs other than the last sub-application tab, when the micro-frontend architecture receives operation information that the operation object is the "Next" button and the operation behavior is a click, it determines that the operation result of the sub-application tab is page completion, that is, the current sub-application tab is completed, so it automatically jumps to the next sub-application tab.
[0104] Alternatively, it should be noted that the micro-frontend architecture can also jump to any sub-application tab according to the user's free choice. Accordingly, after the user selects another sub-application tab, the operation result of the current sub-application tab is automatically confirmed as page completion.
[0105] Step 105, determining whether a confirmation submission operation result is received from each sub-application tab page, and if a confirmation submission operation result is received, generating the target main application using the page data of each of the sub-application tab pages.
[0106] In the disclosed embodiment, when the micro-front-end architecture receives operation information that the operation object of any sub-application tab is a "Submit" button and the operation action is a click, it determines that the target main application is successfully generated, and realizes a main application page to connect multiple sub-applications in series. Subsequently, the main application can be directly used to implement the functions of multiple sub-applications.
[0107] Furthermore, the page data may be page fields and corresponding field data, image data, etc., depending on the actual sub-application tab.
[0108] In the embodiments of the present disclosure, through the integration method of the main application of the first embodiment of the present disclosure, it is possible to avoid intrusive rewriting of sub-applications and prevent injection attacks on sub-applications, thereby ensuring the security of sub-applications. In addition, it is possible to adapt the page style of the main application, improve the display flexibility of the main application, enhance the user experience, greatly reduce user operations, simplify the integration process, thereby reducing learning costs, and improve the integration efficiency of the main application, reducing development and maintenance costs.
[0109] Furthermore, if there are changes in the sub-application such as URL changes or functional changes, you only need to adaptively modify the application information in the architecture database, inject scripts, etc., without the need for rewriting, which greatly reduces development and maintenance costs.
[0110] Figure 8 A flowchart of a method for integrating a main application according to a second exemplary embodiment of the present disclosure is shown. Figure 8 As shown, the main application integration method of the second embodiment of the present disclosure includes the following steps:
[0111] In the embodiment of the present disclosure, the integration method of the main application of the second embodiment of the present disclosure is executed by each sub-application.
[0112] Step 801, receiving an injection script.
[0113] In the embodiment of the present disclosure, each sub-application receives an injection script of a target main application.
[0114] Step 802, execute the injection script and return response information.
[0115] In the disclosed embodiment, each sub-application executes a corresponding injection script, monitors the initialization interface and the storage interface, and returns the interface message of each jump opportunity corresponding to the initialization interface to the target main application, and returns the interface data corresponding to the storage interface to the target main application.
[0116] In the embodiment of the present disclosure, through the integration method of the main application of the second embodiment of the present disclosure, it is possible to avoid invasive rewriting, prevent injection attacks, ensure application security, and reduce application security threats.
[0117] Fig. 9 is a schematic diagram of main modules of an integrated device of a main application according to a first exemplary embodiment of the present disclosure, such as Fig. 9 As shown, the main application integration device 900 of the first embodiment of the present disclosure is applied to the micro front-end architecture, including:
[0118] The receiving module 901 is used to receive an application generation request; wherein the application generation request includes an application type of a target main application.
[0119] The display module 902 is used to display the main application page corresponding to the application type, and the main application page includes multiple sub-application tabs.
[0120] The injection module 903 is used to generate an injection script for each of the sub-application tabs, and inject the injection script into the corresponding sub-application code.
[0121] Execution module 904 is used to parse the response information returned by the sub-application corresponding to each of the sub-application tabs when executing the injection script, execute the behavior script corresponding to the response information, and receive the user's operation results on each of the sub-application tabs. When the operation result of each sub-application tab is page completion, it automatically jumps to the next sub-application tab.
[0122] The generation module 905 is used to determine whether a confirmation submission operation result is received from each sub-application tab page, and if a confirmation submission operation result is received, the target main application is generated using the page data of each of the sub-application tab pages.
[0123] Fig.10 is a schematic diagram of main modules of an integrated device of a main application according to a second exemplary embodiment of the present disclosure, such as Fig.10 As shown, the main application integration device 1000 of the second embodiment of the present disclosure is applied to the sub-application, including:
[0124] The receiving module 1001 is used to receive the injection script.
[0125] The execution module 1002 is used to execute the injection script and return response information.
[0126] Fig.11 is a schematic diagram of a micro front-end architecture according to an exemplary embodiment of the present disclosure, such as Fig.11 As shown, the micro front-end architecture of the present disclosure includes:
[0127] The micro-frontend architecture includes an architecture backend and an architecture frontend. The architecture backend is equipped with configuration components, and the architecture frontend is equipped with decentralized communication tools, web development components, sub-application loading components, and injection plug-ins, among which:
[0128] The configuration component is used to configure the application information of the sub-application, the correspondence between the main application and the sub-application, etc.;
[0129] Decentralized communication tools are used for interactive communication between the main application and sub-applications. Since the main application and sub-applications use free decentralized communication, there is no need to configure or modify the communication relationship, etc., which avoids the communication isolation caused by the unique sandbox isolation, greatly improves the flexibility of the communication mechanism, and enables flexible communication between the main application and sub-applications.
[0130] The web development component is used to develop the interface style of the sub-application integrated into the main application, so that each sub-application tab can retain the original style under the main application page, avoiding the intrusive rewriting of the sub-application code caused by style conflicts, preventing injection attacks on the sub-application, and thus ensuring the security of the sub-application;
[0131] The sub-application loading component is used to access the sub-application URL address according to the application information in the architecture database, thereby loading the sub-application resources, so that the web development component can use the loaded sub-application resources to restore the sub-application tab page in the main application page, and then the user does not need to frequently log in to each different sub-application, and can edit each sub-application in the main application page to generate the target main application;
[0132] The injection plug-in is used to inject scripts into the sub-application code, thereby receiving various interface messages or interface data returned by the sub-application, and then executing different behavior scripts to simulate user operation behaviors under the instruction of the architecture foreground.
[0133] In the disclosed embodiment, for example, taking the micro-frontend architecture using the unbounded micro-frontend framework as an example, correspondingly, the decentralized communication tool is eventBus, the web development component is webcomponent, the sub-application loading component is the Vue component, and the injection plug-in is the js-before-loaders plug-in. Among them, since Shadow DOM is used in webcomponent, the dom structure of the sub-application can be placed in Shadow DOM, so that the sub-application style and the main application style do not affect each other. After the sub-application is integrated into the main application, the original style can still be retained. Each sub-application tab that the user sees in the main application page presents the original style of the sub-application. Among them, the js-before-loaders plug-in can use the xhr.js (i.e., xmlhttprequest) of the sub-application code to implement script injection and execution.
[0134] Alternatively, the injection plug-in can be implemented using a browser plug-in, creating a new script tag in the execution context of the sub-application and injecting the js script into the sub-application. Decentralized communication tools can also be implemented through the communication mechanism of the browser plug-in.
[0135] Furthermore, the micro-frontend architecture can adopt different operating modes according to the actual main application generation requirements, including reconstruction mode and saturation mode. When using the reconstruction mode, historical usage resources are not retained; when using the saturation mode, historical resources are still retained for use.
[0136] Fig.12 is a schematic diagram of the integration process of the main application using the micro front-end architecture according to an exemplary embodiment of the present disclosure, such as Fig.12As shown, the integration process of the main application using the micro front-end architecture of the present disclosure includes:
[0137] The configuration management unit of the configuration component of the architecture background configures the application information of each sub-application, including the application name, URL address, initialization interface, save interface, behavior script, etc. of each sub-application, and stores the application information in the architecture database. For example, the configuration of the application information of the sub-application is as follows: Fig.13 shown.
[0138] The mapping management unit of the configuration component configures the correspondence between the main application and the sub-application, including the main application name, main application description, main application type, adding sub-applications, etc., and stores the correspondence in the architecture database. For example, the configuration of the correspondence between the main application and the sub-application is as follows Fig.14 shown.
[0139] It should be noted that the configured application information, corresponding relationships, etc. can be edited, viewed, copied, deleted, etc. according to actual environment requirements.
[0140] After the architecture backend configuration is completed, the architecture frontend receives an application generation request, and the application generation request includes an application type of a target main application.
[0141] The sub-application loading component searches for the corresponding relationship in the architecture database according to the application identifier corresponding to the application type, and determines the multiple sub-applications corresponding to the target main application;
[0142] The sub-application loading component matches the URL addresses of multiple sub-applications corresponding to the target main application from the architecture database;
[0143] The sub-application loading component accesses the URL addresses of each sub-application corresponding to the target main application, and renders and generates each sub-application tab under the main application page of the target main application.
[0144] The web development component adapts each sub-application tab to display the main application page corresponding to the target main application, for example, Figure 5 As shown, the main application page of the real-time business main application includes a coupon template tab, a template list tab, a strategy tree instance tab, a component instance management tab, a rule management tab, a credit trial calculation tab, a crowd management tab, and a business plan tab.
[0145] The injection plug-in searches the storage path of the application information of each sub-application from the architecture database, fills the injection template of the corresponding sub-application tab page with the storage path of the application information, and generates the injection script of each sub-application tab page; for example, the injection script is shown in FIG7(b);
[0146] The injection plug-in adds the injection script corresponding to the sub-application tab before the corresponding sub-application code. For example, inject the head tag of the sub-application code.
[0147] The sub-application corresponding to each sub-application tab executes the injection script, responds to the initialization interface in the injection script, and returns an interface message.
[0148] Based on the interface message, the architecture front-end executes the behavior script corresponding to the interface message in the sub-application environment to simulate various operation behaviors, including creating, editing, copying, deleting, etc. Therefore, the user only needs to type some key information (such as privacy information, etc.) or check the data of each tab. The vast majority of operation behaviors are implemented by the architecture front-end executing pre-built behavior scripts, which greatly reduces user operations, reduces learning costs, and improves the accuracy of application generation.
[0149] At the same time, each sub-application receives the user's operation behavior on each sub-application tab page and returns operation information of the operation behavior.
[0150] The sub-application corresponding to each sub-application tab executes the injection script, responds to the saved interface in the injection script, and returns the interface data.
[0151] The architecture frontend receives interface data, operation data, etc., and when the user's operation result on each sub-application tab is page completion, the page data of the sub-application tab is sent to the architecture backend, and the page automatically jumps to the next sub-application tab;
[0152] When the architecture foreground receives a confirmation submission operation result returned from any sub-application tab, the architecture background generates a target main application using the page data of each sub-application tab.
[0153] The exemplary embodiment of the present disclosure also provides an electronic device, comprising: at least one processor; and a memory connected to the at least one processor in communication. The memory stores a computer program that can be executed by the at least one processor, and the computer program is used to cause the electronic device to perform the method according to the embodiment of the present disclosure when executed by the at least one processor.
[0154] The exemplary embodiments of the present disclosure also provide a non-transitory computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor of a computer, is used to cause the computer to perform the method according to the embodiments of the present disclosure.
[0155] The exemplary embodiments of the present disclosure further provide a computer program product, including a computer program, wherein when the computer program is executed by a processor of a computer, the computer is used to enable the computer to perform the method according to the embodiments of the present disclosure.
[0156] refer to Fig.15 , a block diagram of an electronic device 1500 that can be used as a server or client of the present disclosure will now be described, which is an example of a hardware device that can be applied to various aspects of the present disclosure. The electronic device is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0157] like Fig.15 As shown, the electronic device 1500 includes a computing unit 1501, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 1502 or a computer program loaded from a storage unit 1508 into a random access memory (RAM) 1503. In the RAM 1503, various programs and data required for the operation of the device 1500 can also be stored. The computing unit 1501, the ROM 1502, and the RAM 1503 are connected to each other via a bus 1504. An input / output (I / O) interface 1505 is also connected to the bus 1504.
[0158] Multiple components in the electronic device 1500 are connected to the I / O interface 1505, including: an input unit 1506, an output unit 1507, a storage unit 1508, and a communication unit 1509. The input unit 1506 can be any type of device that can input information to the electronic device 1500, and the input unit 1506 can receive input digital or character information, and generate key signal input related to the user settings and / or function control of the electronic device. The output unit 1507 can be any type of device that can present information, and can include but is not limited to a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. The storage unit 1508 can include but is not limited to a disk, an optical disk. The communication unit 1509 allows the electronic device 1500 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks, and can include but is not limited to a modem, a network card, an infrared communication device, a wireless communication transceiver, and / or a chipset, such as a Bluetooth™ device, a WiFi device, a WiMax device, a cellular communication device, and / or the like.
[0159] The computing unit 1501 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 1501 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 1501 performs the various methods and processes described above. For example, in some embodiments, Figure 1 , Figure 4 , Figure 6 , Figure 8 , Fig.12 The method can be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as storage unit 1508. In some embodiments, part or all of the computer program can be loaded and / or installed on electronic device 1500 via ROM 1502 and / or communication unit 1509. In some embodiments, computing unit 1501 can be configured to execute by any other appropriate means (for example, by means of firmware). Figure 1 , Figure 4 , Figure 6 , Figure 8 , Fig.12 method.
[0160] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0161] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, 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), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0162] As used in this disclosure, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and / or device (e.g., disk, optical disk, memory, programmable logic device (PLD)) for providing machine instructions and / or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to a programmable processor.
[0163] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0164] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0165] A computer system may include clients and servers. Clients and servers are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship to each other.
Claims
1. A main application integration method, It is characterized in that The method is applied to a micro front-end architecture, and the method includes: receiving an application generation request; wherein the application generation request includes an application type of a target main application; Displaying a main application page corresponding to the application type, wherein the main application page includes multiple sub-application tabs; Generate an injection script for each of the sub-application tabs, and inject the injection script into the corresponding sub-application code; Parse the response information returned by the sub-application corresponding to each of the sub-application tabs when executing the injected script, execute the behavior script corresponding to the response information, and receive the user's operation results on each of the sub-application tabs. When the operation result of each sub-application tab is page completion, automatically jump to the next sub-application tab; Determine whether an operation result confirming submission is received from each sub-application tab page, and if an operation result confirming submission is received, generate the target main application using page data of each of the sub-application tab pages.
2. The main application integration method according to claim 1, It is characterized in that The display of the main application page corresponding to the application type includes: According to the application identifier corresponding to the application type, searching the architecture database to determine a plurality of sub-applications corresponding to the target main application; Matching the URL addresses of multiple sub-applications corresponding to the target main application from the architecture database; Access each of the URL addresses, and render and generate each of the sub-application tabs under the main application page of the target main application.
3. The main application integration method according to claim 1, It is characterized in that The injection script for generating each of the sub-application tabs includes: Searching the architecture database for storage paths of application information of each sub-application; The storage path of the application information is used to fill in the injection template of the corresponding sub-application tab page, and the injection script of the sub-application tab page is generated.
4. The main application integration method according to claim 1 or 3, It is characterized in that The step of injecting the injection script into the sub-application code corresponding to the sub-application tab page includes: Add the injection script corresponding to the sub-application tab before the corresponding sub-application code.
5. The main application integration method according to claim 1, It is characterized in that The injection script includes an initialization interface, and the response information includes an interface message, and the interface message is returned in response to the initialization interface when the sub-application executes the injection script.
6. The main application integration method as claimed in claim 3, It is characterized in that The injection script also includes a storage interface, and the response information also includes interface data; and further includes: The interface data returned by the save interface in response to the execution of the injection script by the sub-application corresponding to each of the sub-application tabs is saved.
7. A method for integrating a main application, It is characterized in that The method is applied to a sub-application, and the method comprises: Receive the injected script; Execute the injected script and return response information.
8. The main application integration method according to claim 7, It is characterized in that The injection script includes an initialization interface, the response information includes an interface message, and the execution of the injection script and the return of the interface message include: In response to one or more initialization interfaces in the injection script, the interface message is returned.
9. The main application integration method according to claim 7, It is characterized in that The injection script also includes a storage interface, and the response information also includes interface data; and further includes: In response to one or more saved interfaces in the injected script, the interface data is returned.
10. An integrated device of a main application, It is characterized in that The device is applied to a micro front-end architecture, and the device includes: A receiving module, configured to receive an application generation request; wherein the application generation request includes an application type of a target main application; A display module, used to display a main application page corresponding to the application type, wherein the main application page includes a plurality of sub-application tabs; An injection module, used to generate an injection script for each of the sub-application tabs, and inject the injection script into the corresponding sub-application code; An execution module, used to parse the response information returned by the sub-application corresponding to each of the sub-application tabs when executing the injection script, execute the behavior script corresponding to the response information, and receive the user's operation results on each of the sub-application tabs, and automatically jump to the next sub-application tab when the operation result of each sub-application tab is page completion; The generation module is used to determine whether the operation results of confirming submission are received from each sub-application tab page, and if the operation results of confirming submission are received, the target main application is generated using the page data of each of the sub-application tab pages.
11. An integrated device of a main application, It is characterized in that The device is applied to a sub-application, and the device includes: A receiving module, used to receive the injected script; The execution module is used to execute the injection script and return response information.
12. A micro front-end architecture, It is characterized in that include: The architecture frontend and the architecture backend, the architecture frontend includes decentralized communication tools, web development components, sub-application loading components and injection plug-ins, wherein: The decentralized communication tool is used for interactive communication between the main application and the sub-application; The architecture foreground receives an application generation request; wherein the application generation request includes an application type of a target main application; The sub-application loading component accesses multiple sub-applications corresponding to the application type; The webpage development component displays a main application page corresponding to the application type, the main application page including sub-application tabs of a plurality of sub-applications; The injection plug-in generates an injection script for each of the sub-application tabs, and injects the injection script into the corresponding sub-application code; The architecture frontend parses the response information returned by the sub-application corresponding to each of the sub-application tabs when executing the injected script, executes the behavior script corresponding to the response information, and receives the user's operation results on each of the sub-application tabs. When the operation result of each sub-application tab is page completion, it automatically jumps to the next sub-application tab; The architecture foreground determines whether it has received confirmation of submission from each sub-application tab page. If confirmation of submission is received, the page data of each sub-application tab page is sent to the architecture background, and the architecture background uses the page data to generate the target main application.
13. The micro frontend architecture according to claim 12, It is characterized in that The architecture backend includes a configuration component, and before the architecture foreground receives an application generation request, it also includes: The configuration component configures application information of the sub-application and the corresponding relationship between the main application and the sub-application.
14. An integrated system of main applications, It is characterized in that include: The micro-frontend architecture and multiple sub-applications as described in claim 12.
15. An electronic device, include: processor; as well as Memory for storing programs, The program includes instructions, which, when executed by the processor, cause the processor to perform the main application integration method according to any one of claims 1-9.
16. A non-transitory computer-readable storage medium storing computer instructions, in, The computer instructions are used to cause the computer to execute the integration method of the main application according to any one of claims 1-9.
Citation Information
Cited By
Method, device and equipment for compatibly loading micro-front-end framework sub-applications and storage medium
CN119645484A
Double-layer routing identity authentication device and identity authentication method for application integration platform
CN120750677A
