CN117111903A - Method and device for integrating application components - Google Patents

Method and device for integrating application components Download PDF

Info

Publication number
CN117111903A
CN117111903A CN202210527081.5A CN202210527081A CN117111903A CN 117111903 A CN117111903 A CN 117111903A CN 202210527081 A CN202210527081 A CN 202210527081A CN 117111903 A CN117111903 A CN 117111903A
Authority
CN
China
Prior art keywords
configuration
component
application
configuration information
code
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210527081.5A
Other languages
Chinese (zh)
Inventor
秦鹏飞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Tuoxian Technology Co Ltd
Original Assignee
Beijing Jingdong Tuoxian Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Tuoxian Technology Co Ltd filed Critical Beijing Jingdong Tuoxian Technology Co Ltd
Priority to CN202210527081.5A priority Critical patent/CN117111903A/en
Publication of CN117111903A publication Critical patent/CN117111903A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/73Program documentation
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

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

Abstract

The application discloses a method and a device for integrating application components, and relates to the technical field of application development. One embodiment of the method comprises the following steps: acquiring a configuration information template of a component, analyzing a code frame, configuration notes and configuration information required by an integrated component contained in the configuration information template, and generating a configuration code corresponding to the configuration information; adding configuration code to the application method indicated by the configuration annotation to complete the application integration component; the step of integrating the components improves the automation degree of the application component integration, reduces the labor cost and the time cost required by the integration of the components in the application, and improves the efficiency of developing the application.

Description

Method and device for integrating application components
Technical Field
The present application relates to the field of application development technologies, and in particular, to a method and an apparatus for integrating application components.
Background
With popularization of internet applications, functions of the internet applications are more and more abundant, complexity of developing the internet is higher and higher, and a modularized development method can be adopted when the internet applications with higher complexity are developed, namely, the applications are divided into a plurality of modules by utilizing service functions, and development of the applications is completed by developing each module.
Components developed using modular approaches need to be integrated into the application; currently, the method for integrating the components is that a component user adds configuration code information required by the operation of the components into the code of an application according to the content of a component document provided by a component developer; when the number of components is large and the complexity of configuration codes is high, the problem of low automation program of the integrated components exists, so that the consumption of manpower and time cost of the integrated components is increased, and the efficiency of developing and applying is reduced.
Disclosure of Invention
In view of this, an embodiment of the present application provides a method and an apparatus for integrating an application component, which can obtain a configuration information template of the component, analyze a code frame, a configuration annotation, and configuration information required by the integrated component included in the configuration information template, and generate a configuration code corresponding to the configuration information; adding configuration code to the application method indicated by the configuration annotation to complete the application integration component; the step of integrating the components improves the automation degree of the application component integration, reduces the labor cost and the time cost required by the integration of the components in the application, and improves the efficiency of developing the application.
To achieve the above object, according to an aspect of an embodiment of the present application, there is provided a method for integrating application components, including: responding to a request of an integrated component, and acquiring a configuration information template of the component to be integrated indicated by the request of the integrated component, wherein the configuration information template comprises a code framework required by the integrated component and configuration notes, and the configuration notes indicate configuration information required by the integration of the component to be integrated into an application and an application method to which the configuration information belongs; analyzing the configuration information of the component to be integrated indicated by the configuration annotation, and generating a configuration code corresponding to the configuration information based on a code frame required by the integrated component and the configuration information; and adding the configuration code to the application method according to the application method to which the configuration information indicated by the configuration annotation belongs, so that the application to which the application method belongs integrates the component.
Optionally, the method for integrating application components further includes: providing configuration information required by the components to be integrated, which are indicated by the configuration notes, to a user, so that the user adds the adaptation information of the components to be integrated at the position with characteristic notes in the configuration information.
Optionally, generating a configuration code corresponding to the configuration information based on the code framework required by the integrated component and the configuration information includes: acquiring a preset text replacement template set for the application; acquiring a characteristic text contained in the configuration information; searching matched replacement feature symbols for the feature text from the preset text replacement template, and adding the configuration information to the code position indicated by the replacement feature symbols under the condition of searching to generate a target text; and generating configuration codes corresponding to the configuration information based on the code frames required by the integrated component and the target text.
Optionally, the adding the configuration code to the application method includes: determining an application class to which the application method belongs; and analyzing each method contained in the application class by using an abstract syntax tree, searching the application method from each method, and adding the configuration code to the application method.
Optionally, the method for integrating the application component searches the application method from the methods, and adds the configuration code to the application method includes: determining a code range corresponding to the application method; and adding the configuration code into a code range corresponding to the application method.
Optionally, the parsing the configuration information of the component to be integrated indicated by the configuration annotation includes: and under the condition that the component type of the component to be integrated is a custom plug-in, acquiring a target configuration information class corresponding to the target key value from the corresponding relation between a plurality of preset key values and a plurality of configuration information classes according to the target key value of the configuration information which is further indicated by the configuration annotation and belongs to the custom plug-in, and taking the data contained in the target configuration information class as configuration information.
Optionally, the method for integrating application components further includes: acquiring one or more pieces of information of the dependent code modules of the component to be integrated from a preset configuration file of the application; and executing compiling operation on the application, the dependent code of the dependent code module information and the component to start the component to be integrated in the application.
To achieve the above object, according to a second aspect of the embodiments of the present application, there is provided an application component integration apparatus, including: the method comprises the steps of obtaining a configuration template module, generating a configuration code module and integrating the configuration code module; wherein,
the configuration template acquisition module is used for responding to a request of an integrated component and acquiring a configuration information template of the component to be integrated indicated by the request of the integrated component, wherein the configuration information template comprises a code frame required by the integrated component and configuration notes, and the configuration notes indicate configuration information required by the integration of the component to be integrated into an application and an application method to which the configuration information belongs;
the configuration code generating module is used for analyzing the configuration information of the component to be integrated indicated by the configuration annotation and generating a configuration code corresponding to the configuration information based on a code frame required by the integrated component and the configuration information;
and the integrated configuration code module is used for adding the configuration code to the application method according to the application method to which the configuration information indicated by the configuration annotation belongs, so that the application to which the application method belongs integrates the component.
Optionally, the device for integrating the application component is further configured to provide configuration information required by the component to be integrated, indicated by the configuration annotation, to a user, so that the user adds the adaptation information of the component to be integrated at a location with a feature annotation in the configuration information.
Optionally, the device for integrating the application component is configured to generate, based on a code framework required by the integrated component and the configuration information, a configuration code corresponding to the configuration information, including: acquiring a preset text replacement template set for the application; acquiring a characteristic text contained in the configuration information; searching matched replacement feature symbols for the feature text from the preset text replacement template, and adding the configuration information to the code position indicated by the replacement feature symbols under the condition of searching to generate a target text; and generating configuration codes corresponding to the configuration information based on the code frames required by the integrated component and the target text.
Optionally, the application component integrating means is configured to add the configuration code to the application method, including: determining an application class to which the application method belongs; and analyzing each method contained in the application class by using an abstract syntax tree, searching the application method from each method, and adding the configuration code to the application method.
Optionally, the application component integrating means is configured to find the application method from the methods, and add the configuration code to the application method, where the application method includes: determining a code range corresponding to the application method; and adding the configuration code into a code range corresponding to the application method.
Optionally, the device for integrating the application component is configured to parse configuration information of the component to be integrated indicated by the configuration annotation, and includes: and under the condition that the component type of the component to be integrated is a custom plug-in, acquiring a target configuration information class corresponding to the target key value from the corresponding relation between a plurality of preset key values and a plurality of configuration information classes according to the target key value of the configuration information which is further indicated by the configuration annotation and belongs to the custom plug-in, and taking the data contained in the target configuration information class as configuration information.
Optionally, the device for integrating an application component is further configured to obtain information of one or more code-dependent modules of the component to be integrated from a preset configuration file of the application; and executing compiling operation on the application, the dependent code of the dependent code module information and the component to start the component to be integrated in the application.
To achieve the above object, according to a third aspect of the embodiments of the present application, there is provided an electronic device with application component integration, including: one or more processors; and a storage device for storing one or more programs that, when executed by the one or more processors, cause the one or more processors to implement the method as described in any of the methods of application component integration described above.
To achieve the above object, according to a fourth aspect of the embodiments of the present application, there is provided a computer readable medium having stored thereon a computer program, characterized in that the program, when executed by a processor, implements a method as described in any one of the above methods of application component integration.
One embodiment of the above application has the following advantages or benefits: the method comprises the steps of obtaining a configuration information template of a component, analyzing a code frame, configuration notes and configuration information required by an integrated component contained in the configuration information template, and generating a configuration code corresponding to the configuration information; adding configuration code to the application method indicated by the configuration annotation to complete the application integration component; the step of integrating the components improves the automation degree of the application component integration, reduces the labor cost and the time cost required by the integration of the components in the application, and improves the efficiency of developing the application.
Further effects of the above-described non-conventional alternatives are described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the application and are not to be construed as unduly limiting the application. Wherein:
FIG. 1 is a flow chart of a method for application component integration according to one embodiment of the present application;
FIG. 2 is a flow diagram of an application component integration provided by one embodiment of the present application;
FIG. 3 is a schematic diagram of an apparatus for application component integration according to an embodiment of the present application;
FIG. 4 is an exemplary system architecture diagram in which embodiments of the present application may be applied;
fig. 5 is a schematic diagram of a computer system suitable for use in implementing an embodiment of the application.
Detailed Description
Exemplary embodiments of the present application will now be described with reference to the accompanying drawings, in which various details of the embodiments of the present application are included to facilitate understanding, and are to be considered merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the application. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
As shown in fig. 1, an embodiment of the present application provides a method for integrating application components, where the method may include the following steps:
step S101: and responding to the request of the integrated component, and acquiring a configuration information template of the component to be integrated indicated by the request of the integrated component, wherein the configuration information template comprises a code framework required by the integrated component and configuration notes, and the configuration notes indicate configuration information required by the integration of the component to be integrated into an application and an application method to which the configuration information belongs.
In particular, in the case of modular development of an application, development of the application is generally divided into development of a plurality of modules for types of functions or services, for example: the application ABC divides a module 1, a module 2 and a module 3 … module N according to functions; a developer (i.e., a component provider) develops each module for a service or a function, and generates a component corresponding to the module, for example: component 1, component 2 …, component N; the components may be in the form of compressed file packages, library files, plug-in files, etc., and after each component is generated, one or more components need to be integrated into an application, so that each component runs in the application to implement the service logic of the component.
Integrating the components into an application, and performing operations such as initialization, configuration and the like on the components; the current method of integrating components includes: a developer of the component user needs to manually add code required to initialize the component in a setup method, and may need to modify the code in multiple files or methods. Meanwhile, it is necessary to refer to an API (application program interface) document used by the component when configuring the component to acquire information on how to configure the component. When the API document is complex, it takes a lot of time to learn how the configuration items are configured. Especially, when the number of components is large, there is a problem that labor cost and time cost are wasted.
In view of the above, the method and the system respond to the request of the integrated component to acquire the configuration information template of the component to be integrated indicated by the request of the integrated component, wherein the configuration information template comprises a code framework required by the integrated component and configuration notes, and the configuration notes indicate configuration information required by the integration of the component to be integrated into an application and an application method to which the configuration information belongs; the configuration information template can be constructed by a component provider and is used for providing configuration information required for initializing and configuring the component; the format of the configuration information template may be code, text, HTML formatted text, etc.
Further, the configuration information template comprises a code framework required by the integrated component and configuration notes; for example, an exemplary fragment of a code framework contained in a configuration information template is shown below, wherein the code framework contains configuration annotations, configuration information, and the format and composition of the configuration annotations, configuration information:
@AInit(method=”attachBaseContext”)
Ainit(){…}
wherein, the method= "attchbasecontext") is a configuration note set for the initialization of the component a, and the initialization method of the component a is the AInit () method. AInit (method= "attchbasecontext") indicates configuration information (e.g., code included in the AInit () method) required for the integrated component a, and an application method to which the configuration information belongs is attchbasecontext; specifically, taking an android application as an example, the method for initializing the component may be a lifecycle method, such as onCreate (), attchBaseContext (), and a custom initialization method, which are included in an application class or an application subclass; it follows that by configuring the annotations, it is possible to set the application method for which the initialization code of the component to be integrated needs to be integrated; similarly, configuration information of component A in other methods of application may be set with configuration annotations; that is, the configuration annotation indicates configuration information required for the component to be integrated into an application and an application method to which the configuration information pertains. It will be appreciated that for different components, the initialization or configuration information required to be configured is different as different functions are implemented, the configuration information being directly related to the component functions, may include authentication of the component, interaction with other components, etc.
Further, providing configuration information required by the components to be integrated, which are indicated by the configuration notes, to a user, so that the user adds adaptation information of the components to be integrated at a position with characteristic notes in the configuration information. Specifically, the component provider may publish the component and the component configuration information template to the server, and the component user may download the component correspondingly; searching the position with characteristic annotation in the configuration information contained in the configuration information template, and adding the adaptation information of the component to be integrated; the feature annotation is, for example, "TODO" annotation text, and is used to determine the location where the adaptation information (e.g., code) needs to be added, for example: the configuration information contains the following information, and the component user can add an adaptation code (i.e. the adaptation information of the integrated component) at the position of TODO so that the getDeviceInfo returns the result required by the adaptation component; getDeviceInfo (para 1, para 2) {// TODO … }. For example, a component user in the Android application can develop a component by using an Android Studio tool, and can prompt all positions containing the feature annotation TODO through prompt information of the Android Studio, so that a developer of the component user can quickly locate the position where the adaptation information of the component to be integrated needs to be added. The efficiency of the integrated assembly is improved. Preferably, the configuration information template can also contain JAVA doc notes which are added by the component provider and describe the API contained in the configuration information, so that developers of the component user do not need to additionally inquire API documents, and the efficiency of integrating the components is further improved.
Step S102: and analyzing the configuration information of the component to be integrated indicated by the configuration annotation, and generating a configuration code corresponding to the configuration information based on a code frame required by the integrated component and the configuration information.
Specifically, one or more configuration notes are parsed from the configuration information template, the parsing method can be used for positioning the configuration notes through an @ character, and a character string corresponding to the configuration notes and configuration information associated with the configuration notes are obtained; the configuration information of the component indicated by the configuration annotation thus parsed, for example: initializing the primary configuration information, code, etc. of the component.
Further, according to the component type, different configuration information can be configured, for example, in the case that the component type is a custom plug-in APlugin, a class of configuration annotation @ APlugin mark can be utilized to indicate that the class is an initialization class of the custom plug-in, a return value of a method of @ APluginInit mark can be used as a key value (key) of custom plug-in configuration data during initialization, and a class of @ APlugin mark can be used as initialization data and added to a registry of configuration items to construct a corresponding relation between a plurality of preset key values (can be) and a plurality of configuration information classes. When the configuration information is analyzed, that is, when the component type of the component to be integrated is analyzed as a custom plug-in, according to a target key value (key) of configuration information, which is further indicated by the configuration annotation and belongs to the custom plug-in, acquiring a target configuration information class corresponding to the target key value from the corresponding relation between a plurality of preset key values and a plurality of configuration information classes, and taking data contained in the target configuration information class as configuration information.
Further, a configuration code is generated based on the code framework of the component to be integrated and the configuration information contained in the configuration information template. Acquiring a preset text replacement template set for the application; acquiring a characteristic text contained in the configuration information; searching matched replacement feature symbols for the feature text from the preset text replacement template, and adding the configuration information to the code position indicated by the replacement feature symbols under the condition of searching to generate a target text; and generating configuration codes corresponding to the configuration information based on the code frames required by the integrated component and the target text.
The method for generating the configuration code can utilize a preset text replacement template set for the application to which the component belongs, wherein the preset text replacement template can be a template of a template engine, and the template engine can be FreeMarker, velocity, jsp and the like; specifically, the configuration information may include feature text set for the component, for example: the feature text is output; the preset text substitution template is provided with a substitution feature symbol @ { output }, which is matched with the feature text, and further, a parameter value corresponding to the feature text 'output' is added to the position of @ { output }, namely, the output in @ { output } is replaced by the parameter value of the output so as to achieve the purpose of filling data of the preset text substitution template (such as an engine template), namely, the configuration information is added to the code position indicated by the substitution feature symbol, and a target text is generated; it can be appreciated that, in the case that there are a plurality of components to be configured, the degree of universality of performing configuration on the plurality of components is improved by using the preset text replacement template (for example, the engine template), so that the efficiency of configuring the components is improved; further, generating configuration codes corresponding to the configuration information based on the code frames required by the integrated component and the target text. For example, the FreeMarker tool can be used for generating the configuration code of the component adapted to the application based on the target text added with the component configuration information, for example, if the application is an android application, the configuration code is the configuration code conforming to the grammar format of the android application; if the application is an iOS application, the configuration code is one conforming to the grammatical format of the iOS application.
Step S103: and adding the configuration code to the application method according to the application method to which the configuration information indicated by the configuration annotation belongs, so that the application to which the application method belongs integrates the component.
Specifically, an application method to which the configuration information indicated by the configuration annotation belongs is determined, and an exemplary method for initializing a component may be an onCreate (), an attachBaseContext (), a custom initialization method and the like contained in an application class or an application subclass; for example, the application method to which the configuration information indicated by the configuration note @ AInit (method= "attchbasecontext") belongs is attchbasecontext ().
Further, the generated configuration code described in step S102 is added (inserted) to the determined application method, that is, the configuration code is added to the application method so that the application to which the application method belongs integrates the component.
Further, adding the configuration code to the application method includes: determining an application class to which the application method belongs; and analyzing each method contained in the application class by using an abstract syntax tree, searching the application method from each method, and adding the configuration code to the application method. After determining an Application class (Application class or Application subclass, etc.) to which the Application method belongs, the Application class may be parsed by using an abstract syntax tree (Abstract Syntax Tree, AST), where the Application class is, for example, an Application class or Application subclass in an android Application, an Application delegatedeeng in an iOS Application, etc., so as to obtain each Application method contained in the Application class, and further find an Application method to which a configuration code of a component belongs from each Application method, for example, find an attachBaseContext (); further, searching the application method from the methods, and adding the configuration code to the application method includes: determining a code range corresponding to the application method; and adding the configuration code into a code range corresponding to the application method. The code range is a method body boundary corresponding to the application method and is marked by a symbol { }; after determining the code range, adding the configuration code into the code range corresponding to the application method. It can be understood that by analyzing the application class and determining the code range of the application method through the abstract syntax tree, the accuracy of determining the addition position of the configuration code is improved, so that the problems of inaccurate code range and compiling failure caused by determining the code range by using symbol "{" and "}" matching are solved.
As shown in fig. 2, an embodiment of the present application provides a process for integrating application components, where the process may include the following steps:
step S201: the method comprises the steps of developing a component by a component provider, constructing configuration notes and configuration information in a configuration information template, setting feature notes in the configuration information, enabling the user to add the adapting information of the component to be integrated and release the component at the position with the feature notes in the configuration information.
Preferably, an insert may be built based on the method of the application, for example: taking android application as an example, in the case that the item of the android application is compiled and operated by using a Gradle tool, the application can be constructed into a Gradle plug-in. The Gradle plug-in can be used for acquiring a configuration template file provided by a developer of a component provider from a setting folder, and the steps from the step S101 to the step S103 are automatically executed. Further, the plug-in may also set up the dependent software package required for providing tools such as configuration notes, a template engine, an abstract syntax tree, maven, and the like, and one or more pieces of dependent code module information of the components to be integrated, so as to implement an operation of automatically executing compiling and running the added configuration code. Namely, acquiring one or more pieces of information of the dependent code modules of the component to be integrated from a preset configuration file of the application; and executing compiling operation on the application, the dependent code of the dependent code module information and the component to start the component to be integrated in the application.
Step S202: the component user obtains a configuration information template provided by the component provider, updates the template according to the position of the feature annotation in the configuration value information template, compiles the component and runs the component.
Specifically, taking a Gradle plug-in as an example, a developer of a component user can use and run the Maven dependence of the Gradle plug-in by adding a folder corresponding to an android application. In the App sub-project, importing a Gradle plug-in; the task of the preparation work of Gradle is operated, and a folder of the component template file is generated; adding Maven dependence of the component in the build. Gradle in the code engineering; and placing the configuration information template file of the component provided by the component provider into a folder of the component template file. Updating the template based on the location of the feature annotation in the configuration value information template, i.e., modifying the code in the template file that marks the location of the TODO to implement one or more methods. And compile and run the components.
The description of step S201-step S202 can be used for knowing that the configuration information needed to be configured in the component to be integrated is put into a configuration information template, and a developer of a component user changes the configuration information template to complete the component configuration; then the Gradle plug-in analyzes the configuration annotation in the configuration information template, then automatically generates configuration codes according to the configuration information indicated by the configuration annotation and combines with a preset text substitution template (template engine), analyzes the applied code engineering by using the abstract syntax tree, and determines the position (code range) for inserting the configuration codes, thereby dynamically and automatically inserting the generated codes and completing the automatic configuration of the components. Therefore, by the method for integrating the components into the application, the automation degree of configuring the components is improved, particularly under the conditions of more components and more complex component functions, the labor cost and the time cost are reduced, and the development and application efficiency is improved.
As shown in fig. 3, an embodiment of the present application provides an apparatus 300 for integrating application components, including: the method comprises the steps of acquiring a configuration template module 301, generating a configuration code module 302 and integrating the configuration code module 303; wherein,
the configuration template obtaining module 301 is configured to obtain, in response to a request for an integrated component, a configuration information template of a component to be integrated indicated by the request for the integrated component, where the configuration information template includes a code frame required by the integrated component and a configuration annotation, and the configuration annotation indicates configuration information required by the integrated component to be integrated into an application and an application method to which the configuration information belongs;
the configuration code generating module 302 is configured to parse configuration information of the component to be integrated indicated by the configuration annotation, and generate a configuration code corresponding to the configuration information based on a code frame required by the integrated component and the configuration information;
the integrated configuration code module 303 is configured to add the configuration code to the application method according to the application method to which the configuration information indicated by the configuration annotation belongs, so that the application to which the application method belongs integrates the component.
The embodiment of the application also provides electronic equipment integrated by the application component, which comprises: one or more processors; and a storage device for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement the method provided by any of the embodiments described above.
The embodiment of the application also provides a computer readable medium, on which a computer program is stored, which when executed by a processor implements the method provided by any of the above embodiments.
Fig. 4 illustrates an exemplary system architecture 400 of a method of application component integration or an apparatus of application component integration to which embodiments of the application may be applied.
As shown in fig. 4, the system architecture 400 may include terminal devices 401, 402, 403, a network 404, and a server 405. The network 404 is used as a medium to provide communication links between the terminal devices 401, 402, 403 and the server 405. The network 404 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
A user may interact with the server 405 via the network 404 using the terminal devices 401, 402, 403 to receive or send messages or the like. Various client applications, such as an electronic mall client application, a web browser application, a search class application, an instant messaging tool, a mailbox client, and the like, may be installed on the terminal devices 401, 402, 403.
The terminal devices 401, 402, 403 may be various electronic devices having a display screen and supporting various client applications including, but not limited to, smartphones, tablets, laptop and desktop computers, and the like.
The server 405 may be a server providing various services, such as a background management server providing support for client applications used by the user with the terminal devices 401, 402, 403. The background management server can process the received request for the integration of the components and send files required by the integrated components to the terminal equipment.
It should be noted that, the method for integrating application components provided in the embodiment of the present application is generally executed by the terminal devices 401, 402, 403, and accordingly, the device for integrating application components is generally disposed in the terminal devices 401, 402, 403.
It should be understood that the number of terminal devices, networks and servers in fig. 4 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 5, there is illustrated a schematic diagram of a computer system 500 suitable for use in implementing an embodiment of the present application. The terminal device shown in fig. 5 is only an example, and should not impose any limitation on the functions and the scope of use of the embodiment of the present application.
As shown in fig. 5, the computer system 500 includes a Central Processing Unit (CPU) 501, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 502 or a program loaded from a storage section 508 into a Random Access Memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the system 500 are also stored. The CPU 501, ROM 502, and RAM 503 are connected to each other through a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
The following components are connected to the I/O interface 505: an input section 506 including a keyboard, a mouse, and the like; an output portion 507 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker, and the like; a storage portion 508 including a hard disk and the like; and a communication section 509 including a network interface card such as a LAN card, a modem, or the like. The communication section 509 performs communication processing via a network such as the internet. The drive 510 is also connected to the I/O interface 505 as needed. A removable medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 510 as needed so that a computer program read therefrom is mounted into the storage section 508 as needed.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication portion 509, and/or installed from the removable media 511. The above-described functions defined in the system of the present application are performed when the computer program is executed by a Central Processing Unit (CPU) 501.
The computer readable medium shown in the present application may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present application, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules and/or units involved in the embodiments of the present application may be implemented in software, or may be implemented in hardware. The described modules and/or units may also be provided in a processor, e.g., may be described as: a processor includes a get configuration template module, a generate configuration code module, and an integrate configuration code module; the names of these modules do not constitute a limitation on the module itself in some cases, and for example, the module for acquiring a configuration template may also be described as "a module for acquiring, in response to a request for an integrated component, a configuration information template of a component to be integrated indicated by the request for the integrated component".
As another aspect, the present application also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be present alone without being fitted into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to include: responding to a request of an integrated component, and acquiring a configuration information template of the component to be integrated indicated by the request of the integrated component, wherein the configuration information template comprises a code framework required by the integrated component and configuration notes, and the configuration notes indicate configuration information required by the integration of the component to be integrated into an application and an application method to which the configuration information belongs; analyzing the configuration information of the component to be integrated indicated by the configuration annotation, and generating a configuration code corresponding to the configuration information based on a code frame required by the integrated component and the configuration information; and adding the configuration code to the application method according to the application method to which the configuration information indicated by the configuration annotation belongs, so that the application to which the application method belongs integrates the component.
According to the embodiment of the application, the configuration information template of the component can be obtained, the code frame, the configuration annotation and the configuration information required by the integrated component contained in the configuration information template are analyzed, and the configuration code corresponding to the configuration information is generated; adding configuration code to the application method indicated by the configuration annotation to complete the application integration component; the step of integrating the components improves the automation degree of the application component integration, reduces the labor cost and the time cost required by the integration of the components in the application, and improves the efficiency of developing the application.
The above embodiments do not limit the scope of the present application. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives can occur depending upon design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present application should be included in the scope of the present application.

Claims (10)

1. A method of application component integration, comprising:
responding to a request of an integrated component, and acquiring a configuration information template of the component to be integrated indicated by the request of the integrated component, wherein the configuration information template comprises a code framework required by the integrated component and configuration notes, and the configuration notes indicate configuration information required by the integration of the component to be integrated into an application and an application method to which the configuration information belongs;
analyzing the configuration information of the component to be integrated indicated by the configuration annotation, and generating a configuration code corresponding to the configuration information based on a code frame required by the integrated component and the configuration information;
and adding the configuration code to the application method according to the application method to which the configuration information indicated by the configuration annotation belongs, so that the application to which the application method belongs integrates the component.
2. The method as recited in claim 1, further comprising:
providing configuration information required by the components to be integrated, which are indicated by the configuration notes, to a user, so that the user adds the adaptation information of the components to be integrated at the position with characteristic notes in the configuration information.
3. The method of claim 1, wherein the step of determining the position of the substrate comprises,
based on the code framework required by the integrated component and the configuration information, generating a configuration code corresponding to the configuration information comprises the following steps:
acquiring a preset text replacement template set for the application;
acquiring a characteristic text contained in the configuration information;
searching matched replacement feature symbols for the feature text from the preset text replacement template, and adding the configuration information to the code position indicated by the replacement feature symbols under the condition of searching to generate a target text;
and generating configuration codes corresponding to the configuration information based on the code frames required by the integrated component and the target text.
4. The method of claim 1, wherein the step of determining the position of the substrate comprises,
the adding the configuration code to the application method comprises the following steps:
determining an application class to which the application method belongs;
and analyzing each method contained in the application class by using an abstract syntax tree, searching the application method from each method, and adding the configuration code to the application method.
5. The method of claim 4, wherein the step of determining the position of the first electrode is performed,
searching the application method from the methods and adding the configuration code to the application method comprises the following steps:
determining a code range corresponding to the application method;
and adding the configuration code into a code range corresponding to the application method.
6. The method of claim 1, wherein the step of determining the position of the substrate comprises,
the parsing the configuration information of the component to be integrated indicated by the configuration annotation comprises the following steps:
in case of analyzing that the component type of the component to be integrated is a custom plug-in,
and according to the target key value of the configuration information belonging to the custom plug-in unit further indicated by the configuration annotation, acquiring a target configuration information class corresponding to the target key value from the corresponding relation between a plurality of preset key values and a plurality of configuration information classes, and taking data contained in the target configuration information class as configuration information.
7. The method as recited in claim 1, further comprising:
acquiring one or more pieces of information of the dependent code modules of the component to be integrated from a preset configuration file of the application;
and executing compiling operation on the application, the dependent code of the dependent code module information and the component to start the component to be integrated in the application.
8. An apparatus for application component integration, comprising: the method comprises the steps of obtaining a configuration template module, generating a configuration code module and integrating the configuration code module; wherein,
the configuration template acquisition module is used for responding to a request of an integrated component and acquiring a configuration information template of the component to be integrated indicated by the request of the integrated component, wherein the configuration information template comprises a code frame required by the integrated component and configuration notes, and the configuration notes indicate configuration information required by the integration of the component to be integrated into an application and an application method to which the configuration information belongs;
the configuration code generating module is used for analyzing the configuration information of the component to be integrated indicated by the configuration annotation and generating a configuration code corresponding to the configuration information based on a code frame required by the integrated component and the configuration information;
and the integrated configuration code module is used for adding the configuration code to the application method according to the application method to which the configuration information indicated by the configuration annotation belongs, so that the application to which the application method belongs integrates the component.
9. An electronic device, comprising:
one or more processors;
storage means for storing one or more programs,
when executed by the one or more processors, causes the one or more processors to implement the method of any of claims 1-7.
10. A computer readable medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any of claims 1-7.
CN202210527081.5A 2022-05-16 2022-05-16 Method and device for integrating application components Pending CN117111903A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210527081.5A CN117111903A (en) 2022-05-16 2022-05-16 Method and device for integrating application components

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210527081.5A CN117111903A (en) 2022-05-16 2022-05-16 Method and device for integrating application components

Publications (1)

Publication Number Publication Date
CN117111903A true CN117111903A (en) 2023-11-24

Family

ID=88811522

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210527081.5A Pending CN117111903A (en) 2022-05-16 2022-05-16 Method and device for integrating application components

Country Status (1)

Country Link
CN (1) CN117111903A (en)

Similar Documents

Publication Publication Date Title
CN111399840B (en) Module development method and device
CN110543297B (en) Method and apparatus for generating source code
CN107643984B (en) Method and apparatus for outputting information
CN110865889A (en) Method and apparatus for transferring events between components
CN112769706B (en) Componentized routing method and system
CN110888794B (en) Interface testing method and device
CN112947912A (en) Method and device for generating code, electronic equipment and storage medium
CN112130830B (en) Interface generation method and device and electronic equipment
CN110888639A (en) Business code compiling and packaging method and device
CN111880778B (en) Method and device for generating interface document, electronic equipment and storage medium
CN112463256A (en) Method, system, electronic device and storage medium for determining configuration file
CN113377342B (en) Project construction method and device, electronic equipment and storage medium
CN111078230A (en) Code generation method and device
CN112835568A (en) Project construction method and device
CN111414154A (en) Method and device for front-end development, electronic equipment and storage medium
CN112015384A (en) Interface mapping method and device
US10606569B2 (en) Declarative configuration elements
CN113032004A (en) Method, apparatus and program product for managing development jobs in a development environment
CN115640279A (en) Method and device for constructing data blood relationship
CN117111903A (en) Method and device for integrating application components
CN113535221B (en) Method and device for managing application version
CN112783903B (en) Method and device for generating update log
CN114625373A (en) Application conversion method and device, electronic equipment and storage medium
CN114115855A (en) Code multiplexing method and device, computer readable storage medium and electronic equipment
CN112882698A (en) Development environment generation method and device, computer storage medium and electronic device

Legal Events

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