Component initialization method and device, equipment, storage medium and program product
By integrating component initialization plug-ins and initialization management classes in the application, component initialization is managed uniformly, and the initialization sequence and thread model are optimized, which solves the problem of low component initialization efficiency in the existing technology and achieves efficient component initialization and application instant launch effects.
Patent Information
- Application Number
- CN202410672054.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-28
- Publication Date
- 2024-09-20
AI Technical Summary
The component initialization efficiency in the existing technology is low, the manual coding method is cumbersome and costly, the advantages of multi-core CPUs are not fully utilized, and there is a lack of dependency and loading timing configuration support, resulting in slow application startup and running speeds and poor user experience.
By integrating the component initialization plug-in in the target application, using the initialization management class to uniformly manage component initialization, obtaining initialization configuration parameters through the reflection mechanism and annotation parameters, optimizing the initialization sequence and thread model, using multi-core CPU parallel initialization, and supporting the application in startup and idle states. initialization scenario.
It significantly improves the efficiency of component initialization, reduces code intrusion and maintenance costs, achieves the instant application launch effect, and improves user experience.
Smart Images

Figure CN118672689A
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a component initialization method, device, equipment, storage medium and program product. Background Art
[0002] A component is a collection of tools, resources, documentation, and sample code for building software applications, libraries, or systems. Components are designed to help developers create, test, and deploy software more easily, and provide the necessary tools and resources to integrate applications or functions into a specific platform, framework, or environment.
[0003] Currently, when an application needs to integrate a component (such as a third-party component), the initialization code of the component is usually added to the application by manual coding, and then the component is initialized by the initialization code of the component at an appropriate time (usually when the application is started). However, the initialization of the component in the above manner has the problem of low initialization efficiency. Summary of the invention
[0004] The present application provides a component initialization method, device, equipment, storage medium and program product to solve the problem of low initialization efficiency when initializing components using the current method.
[0005] In a first aspect, the present application provides a component initialization method, comprising:
[0006] Obtain the class name and initialization method of the initialization class of the initialization component through the initialization management class;
[0007] Create instance objects corresponding to the class name by initializing the management class and reflection mechanism;
[0008] Obtain the initialization configuration parameters of the initialization component by initializing the annotation parameters in the management class and target class files;
[0009] By initializing the management class and initializing the configuration parameters, the application instance object calls the initialization method to initialize the initialization component.
[0010] Optionally, if the target application is started for the first time, the initialization configuration parameters are the first initialization configuration parameters obtained from the configuration center through the initialization management class; if the target application is not started for the first time, the initialization configuration parameters are the second initialization configuration parameters obtained from the local cache through the initialization management class; the annotation parameters include the component priority and component initialization time of the initialization component, and the component initialization time includes when the target application is in the startup state and when the target application is in the idle state.
[0011] Optionally, when the target application is in a startup state, the first initialization configuration parameter includes an initialization order and a thread model of the initialization components; wherein the initialization order is determined based on component dependencies and component priorities of the initialization components; the thread model is determined based on the optimal number of threads and / or the historical average initialization time of the initialization components, and the optimal number of threads is determined based on relevant information of the terminal where the target application is located, and the relevant information includes the terminal model of the terminal and the current running status of the terminal's operating system; when the target application is in an idle state, the first initialization configuration parameter includes the initialization order of the initialization components.
[0012] Optionally, the initialization order is determined based on component dependencies and component priorities of the initialization components, including: constructing a directed acyclic graph based on component dependencies; obtaining a topological sorting corresponding to the directed acyclic graph based on a breadth-first search (BFS) algorithm; and determining the initialization order from the topological sorting based on the component priorities.
[0013] Optionally, the second initialization configuration parameter is determined in the following manner: when the target application is in the startup state, the initialization order and thread model of the initialization components are obtained from the local cache through the initialization management class, and the thread model is determined based on the thread model and initialization time of the initialization components when the target application was started last time; when the target application is in the idle state, the initialization order of the initialization components is obtained from the local cache through the initialization management class.
[0014] Optionally, after initializing the initialization component, the component initialization method further includes: when the target application is in the startup state, updating the locally cached thread model according to the thread model and initialization time of the initialization component when starting the target application through the initialization management class.
[0015] Optionally, after initializing the initialization component, the component initialization method further includes: sending the terminal model of the terminal where the target application is located and the initialization time of the initialization component to the configuration center through the initialization management class, so that the configuration center updates the initialization configuration parameters of the initialization component.
[0016] Optionally, by initializing the management class and initializing the configuration parameters, the application instance object calls the initialization method to initialize the initialization component, including: creating a target thread for the initialization component according to the initialization configuration parameters; and in the target thread, the application instance object calls the initialization method in the initialization order to initialize the initialization component.
[0017] In a second aspect, the present application provides a component initialization device, comprising:
[0018] A first acquisition module is used to acquire the class name and initialization method of the initialization class of the initialization component through the initialization management class;
[0019] Create a module to create instance objects corresponding to the class name by initializing the management class and reflection mechanism;
[0020] The second acquisition module is used to obtain the initialization configuration parameters of the initialization component through the annotation parameters in the initialization management class and the target class file;
[0021] The processing module is used to initialize the initialization component by initializing the management class and initializing the configuration parameters and calling the initialization method of the application instance object.
[0022] Optionally, if the target application is started for the first time, the initialization configuration parameters are the first initialization configuration parameters obtained from the configuration center through the initialization management class; if the target application is not started for the first time, the initialization configuration parameters are the second initialization configuration parameters obtained from the local cache through the initialization management class; the annotation parameters include the component priority and component initialization time of the initialization component, and the component initialization time includes when the target application is in the startup state and when the target application is in the idle state.
[0023] Optionally, when the target application is in a startup state, the first initialization configuration parameter includes an initialization order and a thread model of the initialization components; wherein the initialization order is determined based on component dependencies and component priorities of the initialization components; the thread model is determined based on the optimal number of threads and / or the historical average initialization time of the initialization components, and the optimal number of threads is determined based on relevant information of the terminal where the target application is located, and the relevant information includes the terminal model of the terminal and the current running status of the terminal's operating system; when the target application is in an idle state, the first initialization configuration parameter includes the initialization order of the initialization components.
[0024] Optionally, the initialization order is determined based on component dependencies and component priorities of the initialization components, including: constructing a directed acyclic graph based on component dependencies; obtaining a topological sorting corresponding to the directed acyclic graph based on a breadth-first search (BFS) algorithm; and determining the initialization order from the topological sorting based on the component priorities.
[0025] Optionally, the second acquisition module determines the second initialization configuration parameters in the following manner: when the target application is in the startup state, the initialization order and thread model of the initialization components are obtained from the local cache through the initialization management class, and the thread model is determined based on the thread model and initialization time of the initialization components when the target application was started last time; when the target application is in the idle state, the initialization order of the initialization components is obtained from the local cache through the initialization management class.
[0026] Optionally, the processing module is further used to: after initializing the initialization component, when the target application is in the startup state, update the locally cached thread model through the initialization management class according to the thread model and initialization time of the initialization component when starting the target application.
[0027] Optionally, the processing module is also used to: after initializing the initialization component, send the terminal model of the terminal where the target application is located and the initialization time of the initialization component to the configuration center through the initialization management class, so that the configuration center updates the initialization configuration parameters of the initialization component.
[0028] Optionally, the processing module is specifically used to: create a target thread for initializing the component according to the initialization configuration parameters; and in the target thread, the application instance object calls the initialization method in accordance with the initialization sequence to initialize the initialization component.
[0029] In a third aspect, the present application provides an electronic device, comprising: a processor, and a memory communicatively connected to the processor;
[0030] Memory stores computer-executable instructions;
[0031] The processor executes the computer-executable instructions stored in the memory to implement the component initialization method as described in the first aspect of the present application.
[0032] In a fourth aspect, the present application provides a computer-readable storage medium, in which computer program instructions are stored. When the computer program instructions are executed, the component initialization method described in the first aspect of the present application is implemented.
[0033] In a fifth aspect, the present application provides a computer program product, including a computer program, which implements the component initialization method described in the first aspect of the present application when the computer program is executed.
[0034] The component initialization method, device, equipment, storage medium and program product provided by the present application obtain the class name and initialization method of the initialization class of the initialization component through the initialization management class; create the instance object corresponding to the class name through the initialization management class and the reflection mechanism; obtain the initialization configuration parameters of the initialization component through the annotation parameters in the initialization management class and the target class file; through the initialization management class and the initialization configuration parameters, the application instance object calls the initialization method to initialize the initialization component. The present application uniformly manages the initialization of the initialization component through the initialization management class, wherein the initialization component is initialized through the initialization management class and the initialization configuration parameters, and the initialization configuration parameters are obtained through the annotation parameters in the initialization management class and the target class file. Compared with adding the initialization code of the initialization component to the application by manual coding, the present application can effectively improve the initialization efficiency of the initialization component of the application, has low code intrusion to the application, can significantly reduce the cost of the application party to access and maintain the component, and achieve the effect of "opening the application in seconds" with "zero cost", thereby improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0036] Figure 1 A schematic diagram of an application scenario provided for an embodiment of the present application;
[0037] Figure 2 A flowchart of a component initialization method provided in an embodiment of the present application;
[0038] Figure 3 A schematic diagram of a directed acyclic graph provided in one embodiment of the present application;
[0039] Figure 4 A schematic diagram of topological sorting provided in one embodiment of the present application;
[0040] Figure 5 A schematic diagram of a thread model provided in an embodiment of the present application;
[0041] Figure 6 A schematic diagram of a thread model provided for another embodiment of the present application;
[0042] Figure 7 A flowchart of a component initialization method provided by another embodiment of the present application;
[0043] Figure 8A schematic diagram of the structure of a component initialization device provided in one embodiment of the present application;
[0044] Fig. 9 A schematic diagram of the structure of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0046] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0047] First, some technical terms involved in this application are explained:
[0048] A component, also known as a component software development kit (SDK), is a collection of tools, resources, documentation, and sample codes for building software applications, libraries, or systems. Components are designed to help developers create, test, and deploy software more easily, and provide the necessary tools and resources to integrate applications or functions into specific platforms, frameworks, or environments.
[0049] Annotation Processor, in programming, an annotation interpreter is a tool for processing annotations in Java (an object-oriented programming language) source code; it can scan, analyze, and process annotations at compile time to generate additional code, configuration files, or other resources to achieve automated code generation and other compile-time tasks.
[0050] App Startup (a library that can be used to speed up application startup) provides a simple and efficient way to initialize components when the application starts; both library developers and application developers can use AppStartup to simplify the startup sequence and explicitly set the initialization order; App Startup allows you to define component initializers that share a single content provider, rather than defining a separate content provider for each component that needs to be initialized, which can significantly improve the startup time of the application.
[0051] At present, when an application needs to integrate a component (such as a third-party component), it usually adds the initialization code of the component to the application through manual coding, and then initializes the component at the appropriate time (usually when the application starts). However, the initialization of components in the above way has the following main problems: (1) In actual development, applications generally reference multiple different components, such as dozens or hundreds of components. If each component needs to be initialized by manual coding, application developers need to carefully read the usage help document of each component to find the initialization method of the corresponding component; in some cases, an application may need to initialize a large number of components, which will be a very tedious and inefficient task, resulting in low component initialization efficiency; (2) Each component needs to call its initialization method when the application starts, which means that a large amount of initialization code needs to be written and maintained; during the iteration process of the project, new team members may accidentally delete or modify the initialization code, resulting in application operation errors and business losses; (3) The disordered initialization of a large number of components will cause the application to start and run slowly, and the user experience will deteriorate; for application developers, as market competition becomes increasingly fierce, how to improve the application startup and running performance becomes increasingly important.
[0052] In addition, in the related art, when a component is integrated into an application, the component can be initialized in the following ways: calling the initialization code of the component of the application, registering the initialization class instantiation object in the initialization code of the component into the management queue; obtaining the initialization class instantiation object corresponding to the initialization component in the management queue, running the initialization class instantiation object of the initialization component, and performing the initialization operation on the initialization component. However, initializing the component in the above way has the following disadvantages: (1) Low initialization efficiency and poor performance; due to the central processing unit (Central Processing Unit) of the terminal (such as a mobile phone) Unit, CPU) is multi-core, and supports starting multiple threads to initialize components at the same time to improve the initialization speed. This related technology uses the first-in-first-out serial execution of the queue, which does not fully utilize the advantages of multi-core; (2) There is a lack of configuration support such as dependencies and loading timing, and a lack of practical engineering capabilities. For example, an application needs to integrate four components, represented by A (for data storage), B (for crash collection), C (for long-connection channels) and D (for message push); among them, B needs to use A, so it can only be initialized after A is initialized, or D needs to use A and C, so it needs to wait for A and C to be completed. (3) The cost of integrating components into applications and maintaining component initialization is high. In some businesses, such as short videos and reading, where competition is fierce, the instant opening of applications will bring a slight increase in user conversion rates. However, the instant opening of applications often consumes a lot of development resources and the effect is not ideal.
[0053] Based on the above problems, the present application provides a component initialization method, which integrates a component initialization plug-in in a target application, and uniformly manages the initialization of the initialization component of the target application through the initialization management class generated by the component initialization plug-in; wherein, the initialization class of the initialization component is added with annotations and annotation parameters, so that when building the target application, the annotation interpreter in the component initialization plug-in scans the initialization class annotated with annotations and annotation parameters in the target application, and generates a target class file containing the class name and initialization method of the initialization class of the initialization component; the initialization configuration parameters of the initialization component are obtained based on the annotation parameters contained in the target class file through the initialization management class, so that based on the initialization configuration parameters, the initialization method is called through the application instance object corresponding to the class name to initialize the initialization component. The present application can effectively improve the initialization efficiency of the initialization component of the target application, and because the integration method of the component initialization plug-in is simple and convenient, and the code intrusion to the target application is extremely low, it can significantly reduce the cost of the application party to access and maintain the component.
[0054] In the following, the application scenarios of the solutions provided in this application are first illustrated.
[0055] Figure 1 This is a schematic diagram of an application scenario provided by an embodiment of the present application. Figure 1 As shown, the application scenario may include: terminal ( Figure 1 101 is taken as an example) and server 102. The target application on mobile phone 101 is integrated with a component initialization plug-in; the server and configuration center of the target application are deployed on server 102; mobile phone 101 communicates with server 102 via a wireless network or a wired network. The user opens the target application on mobile phone 101, triggering the startup instruction of the target application; mobile phone 101 responds to the startup instruction for the target application, and uniformly manages the initialization of the initialization component of the target application through the initialization management class generated by the component initialization plug-in integrated in the target application, thereby completing the initialization of the initialization component of the target application. Among them, when the target application is started for the first time, the initialization configuration parameters of the initialization component are obtained from the configuration center on server 102, and the initialization configuration parameters include, for example, the initialization order and / or thread model of the initialization component; at the subsequent startup, the initialization configuration parameters are obtained from the local cache. For the specific implementation process of initializing the initialization component through the initialization management class, please refer to the schemes of the following embodiments.
[0056] It should be noted that Figure 1 This is only a schematic diagram of an application scenario provided by the embodiment of the present application. Figure 1 does not limit the equipment included in Figure 1 The positional relationship between the devices is limited.
[0057] The technical solution of the present application is described in detail below through specific embodiments. It should be noted that the following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0058] Figure 2 A flowchart of a component initialization method provided in an embodiment of the present application. The component initialization method can be executed by software and / or hardware devices. For example, the hardware device can be a component initialization device, the component initialization device can be an electronic device or a processing chip in the electronic device, and the electronic device can be Figure 1 The terminal shown. Figure 2 As shown, the method of the embodiment of the present application includes:
[0059] S201. Obtain the class name and initialization method of the initialization class of the initialization component through the initialization management class.
[0060] In the embodiment of the present application, the initialization management class (for example, represented by MdpInitializerManager) is generated by the component initialization plug-in integrated in the target application, and the component initialization plug-in is used to customize annotations, annotation interpreters, and initialization management classes. Among them, the custom annotation is, for example, @MdpInitializer, and the annotation interpreter is, for example, represented by MdpInitializerProcessor. For specific information on how to obtain the component initialization plug-in, please refer to the subsequent embodiments, which will not be repeated here. The initialization of multiple initialization components of the target application can be uniformly managed through the initialization management class.
[0061] Optionally, the target application integrates the component initialization plug-in by referencing the access address of the component initialization plug-in. Exemplarily, the component initialization plug-in is stored in a code repository manager (such as Nexus), and the remote access address of the component initialization plug-in is, for example: 'com.msxf.mdp:initer-compiler:1.0.0', then the target application can integrate the component initialization plug-in by referencing the remote access address of the component initialization plug-in. It can be understood that the target application only needs to reference the remote access address of the component initialization plug-in to achieve "second opening" of the application, and the access cost is extremely low.
[0062] In this step, when the target application is started, the initialization management class of the target application can be obtained, and the class name and initialization method of the initialization class of the initialization component can be obtained through the initialization management class. Exemplarily, the class name and initialization method of the initialization class of the initialization component of the target application contained in the target class file are obtained through the initialization management class, wherein the target class file is a class file generated by the annotation interpreter scanning the initialization class annotated with annotations and annotation parameters in the target application when the target application is built. Specifically, when creating the initialization class of the component, the component developer can add annotations (such as @MDPInitializer) and annotation parameters to the initialization class, and the annotation parameters include, for example, the component priority and component initialization time of the initialization component of the target application. For the components that have been developed, annotations and annotation parameters can be added to the initialization class of each component to obtain the added component, and the added component can be updated to the component remote library. The access address of the component is, for example: 'com.msxf.mdp:xx:1.0.1'. It can be seen from this that the modification cost of the components in the embodiments of the present application is very low, and only annotations and annotation parameters need to be added to the initialization class of each component.
[0063] After adding annotations and annotation parameters to the component initialization class, the target class file can be obtained in the following ways: the application developer references the access address of the component initialization plug-in in the target application to integrate the component initialization plug-in. The access address of the component initialization plug-in is, for example, 'com.msxf.mdp:initer-compiler:1.0.0'; the application developer references the access address corresponding to the initialization component in the target application according to business needs to integrate the initialization component. The access address of the initialization component is, for example, 'com.msxf.mdp:xx:1.0.1'; the application developer starts to package the target application. When building the target application, the annotation interpreter in the component initialization plug-in scans all initialization classes in the target application that are marked with annotations and annotation parameters, and generates new class files in the specified folder. Optionally, the access address of the component initialization plug-in and the access address of the initialization component can be added to the configuration file, and the configuration file can be used for convenient and flexible management.
[0064] S202: Create an instance object corresponding to the class name by initializing the management class and the reflection mechanism.
[0065] For example, taking Java's reflection mechanism as an example, Java's reflection mechanism means that in the running state of the program, objects of any class can be constructed, the class to which any object belongs can be understood, the member variables and methods of any class can be understood, and the properties and methods of any object can be called. Therefore, after obtaining the class name of the initialization class of the initialization component of the target application through the initialization management class, an instance object corresponding to the class name can be created based on the reflection mechanism, and the instance object can be put into the initialization management class for unified management.
[0066] S203. Obtain initialization configuration parameters of the initialization component by initializing annotation parameters in the management class and target class files.
[0067] In this step, the method of obtaining the target class file can refer to the example of step S201, and the annotation parameters include, for example, the component priority and component initialization time of the initialization component of the target application. Exemplarily, if the target application is started for the first time, the initialization configuration parameters of the initialization component can be obtained from the configuration center through the initialization management class. Specifically, the terminal model of the terminal (such as a mobile phone), the operation information of the terminal operating system, the identification of the component (such as the class name of the initialization class), the component priority of the initialization component, and the component initialization time and other information are read through the initialization management class, and the initialization configuration parameters of the initialization component are pulled from the configuration center according to the above information and cached locally. Among them, the configuration center is used to manage various related parameters of the target application, and the initialization configuration parameters can be understood as the optimal initialization configuration parameters obtained by the configuration center according to the preset generation rules, and the preset generation rules include determining the initialization order of the initialization component and / or determining the thread model of the initialization component. Among them, the thread model is determined, for example, according to the optimal number of threads and / or the historical average initialization time of the initialization component, and the thread model is used to improve the initialization efficiency of the initialization component. Accordingly, the initialization configuration parameters include the initialization order and / or thread model of the initialization component. If the target application is not started for the first time, the initialization configuration parameters of the initialization component can be obtained from the local cache through the initialization management class.
[0068] For details on how to obtain the initialization configuration parameters of the initialization component by initializing the annotation parameters in the management class and the target class file, please refer to the subsequent embodiments, which will not be described in detail here.
[0069] S204: By initializing the management class and initializing the configuration parameters, the application instance object calls the initialization method to initialize the initialization component.
[0070] In this step, after the initialization configuration parameters of the initialization component are obtained, the initialization management class can be used to call the initialization method based on the initialization configuration parameters and the application instance object to initialize the initialization component.
[0071] Further, optionally, by initializing the management class and initializing the configuration parameters, the application instance object calls the initialization method to initialize the initialization component, which may include: creating a target thread for the initialization component according to the initialization configuration parameters; and in the target thread, the application instance object calls the initialization method in the initialization order to initialize the initialization component.
[0072] For example, it is assumed that the initialization configuration parameters of the initialization component obtained are as follows:
[0073] {[
[0074] "thread1":["task1","task2","task3"],
[0075] "thread2":["task4","task5"],
[0076] "thread3":["task6","task7"],...],...
[0077] }
[0078] Each thread represents a thread; each task represents a task for initializing the initialization component. According to the length of the thread array, you can create a target thread with the corresponding number of threads, assign each task to the corresponding target thread, and call the initialization method of the application instance object in the initialization order to initialize the initialization component.
[0079] The component initialization method provided in the embodiment of the present application obtains the class name and initialization method of the initialization class of the initialization component through the initialization management class; creates an instance object corresponding to the class name through the initialization management class and the reflection mechanism; obtains the initialization configuration parameters of the initialization component through the annotation parameters in the initialization management class and the target class file; and initializes the initialization component by calling the initialization method through the initialization management class and the initialization configuration parameters. In the embodiment of the present application, the initialization of the initialization component is uniformly managed through the initialization management class, wherein the initialization component is initialized through the initialization management class and the initialization configuration parameters, and the initialization configuration parameters are obtained through the annotation parameters in the initialization management class and the target class file. Compared with adding the initialization code of the initialization component to the application by manual coding, the embodiment of the present application can effectively improve the initialization efficiency of the initialization component of the application, has low code intrusion to the application, can significantly reduce the cost of the application party to access and maintain the component, and achieve the effect of "opening in seconds" of the application at "zero cost", thereby improving the user experience.
[0080] Based on the above embodiment, in the embodiment of the present application, the component initialization plug-in can be obtained through the following three steps:
[0081] Step 1: The plug-in developer customizes the annotation (for example, @MdpInitializer) and the annotation interpreter MdpInitializerProcessor.
[0082] After scanning all the initialization classes of components marked with annotation @MdpInitializer and annotation parameters in the target application through the annotation interpreter, the target class file is generated in the specified folder. The annotation interpreter can also be understood as an annotation processing tool (APT). This step allows component developers to customize the annotation parameters of the component, such as the component priority and component initialization time of the initialization component of the target application.
[0083] Step 2: The plug-in developer customizes the initialization manager class MdpInitializerManager.
[0084] This step allows application developers to no longer need to manually call the component initialization code when integrating components. The specific principle is similar to monitoring the cold start of the application. A hook is hung in the startup lifecycle method, such as App Startup. MdpInitializerManager is added to the hook. When the application starts, AppStartup is initialized, thereby initializing MdpInitializerManager, and the component initialization code is executed through MdpInitializerManager.
[0085] Step 3: The plug-in developer uploads the developed component initialization plug-in to the code repository manager (Nexus) and obtains the remote access address of the component initialization plug-in, for example: 'com.msxf.mdp:initer-compiler:1.0.0'.
[0086] Based on the above embodiment, optionally, if the target application is started for the first time, the initialization configuration parameter is a first initialization configuration parameter obtained from the configuration center through the initialization management class; if the target application is not started for the first time, the initialization configuration parameter is a second initialization configuration parameter obtained from the local cache through the initialization management class; the annotation parameters include the component priority and component initialization time of the initialization component, and the component initialization time includes when the target application is in the startup state and when the target application is in the idle state.
[0087] Exemplarily, for the case where the target application is started for the first time, the initialization configuration parameters of the initialization component are obtained from the configuration center through the initialization management class, that is, the first initialization configuration parameters are obtained. Specifically, the terminal model of the terminal (such as a mobile phone), the running information of the terminal operating system, the component identifier (such as the class name of the initialization class), the component priority of the initialization component included in the annotation parameters, and the component initialization time and other information are read through the initialization management class, and the initialization configuration parameters of the initialization component are pulled from the configuration center according to the above information and cached locally. Among them, the component initialization time includes when the target application is in the startup state and when the target application is in the idle state. For the case where the target application is not started for the first time, the initialization configuration parameters of the initialization component are obtained from the local cache through the initialization management class, that is, the second initialization configuration parameters are obtained.
[0088] In one possible implementation, when the target application is in a startup state, the first initialization configuration parameter includes an initialization order and a thread model of the initialization components; wherein the initialization order is determined based on component dependencies and component priorities of the initialization components; the thread model is determined based on an optimal number of threads and / or an average historical initialization time of the initialization components, and the optimal number of threads is determined based on relevant information of the terminal where the target application is located, and the relevant information includes a terminal model of the terminal and a current running status of the terminal's operating system; when the target application is in an idle state, the first initialization configuration parameter includes an initialization order of the initialization components.
[0089] Exemplarily, when the target application is in the startup state, the first initialization configuration parameter of the initialization component is obtained from the configuration center through the initialization management class. The first initialization configuration parameter includes the initialization order and thread model of the initialization component, wherein the initialization order is determined by the configuration center according to the component dependencies and component priorities of the initialization component; the thread model is, for example, determined by the configuration center according to the optimal number of threads and the historical average initialization time of the initialization component, or, is determined according to the optimal number of threads, or, is determined according to the historical average initialization time of the initialization component. Among them, the optimal number of threads is determined based on the relevant information of the terminal where the target application is located, and the relevant information includes the terminal model of the terminal and the current running state of the terminal's operating system. When the target application is in an idle state, that is, the thread of the terminal is in an idle state, there is no need to consider the thread model of the initialization component. Therefore, the first initialization configuration parameter includes the initialization order of the initialization component.
[0090] Further, optionally, the initialization order is determined based on component dependencies and component priorities of the initialization components, which may include: constructing a directed acyclic graph based on component dependencies; obtaining a topological sorting corresponding to the directed acyclic graph based on a breadth-first search (BSF) algorithm; and determining the initialization order from the topological sorting based on component priorities.
[0091] Exemplarily, when determining the initialization order of initialization components, two influencing factors are mainly considered: component dependencies and component priorities corresponding to the initialization components. Among them, the sorting principle follows: component dependencies > component priorities, that is, component dependencies are given priority; for component dependencies, for example, the initialization of component D needs to be performed after component A and component C are initialized; for component priority, it is the component initialization order customized by the user through annotation parameters, and the value range is an integer between -10 and 10. The default value is 0. The smaller the value, the higher the initialization order. For example, if the component priority value of component A is -10, and the component priority value of component B is 10, component A will be initialized first.
[0092] Specifically, suppose there are five components with serial numbers 1, 2, 3, 4 and 5 that need to be initialized. Figure 3 A schematic diagram of a directed acyclic graph provided in an embodiment of the present application is shown in FIG. Figure 3 As shown in the figure, according to the component dependencies corresponding to the five components 1, 2, 3, 4 and 5, the following can be constructed: Figure 3 Then, the BSF algorithm is used to obtain Figure 3 The two topological orderings corresponding to the directed acyclic graph shown. Figure 4 A schematic diagram of a topological sorting provided in an embodiment of the present application is shown in FIG. Figure 4 As shown, it is shown Figure 3 The two topological sortings corresponding to the directed acyclic graph shown in FIG. Finally, assuming that the component priority value of the component with sequence number 2 is -2, and the component priority value of the component with sequence number 4 is -4, since the smaller the value, the higher the initialization order, the second topological sorting is finally selected as the initialization order of the initialization components.
[0093] In this embodiment, exemplarily, when determining the thread model of the initialization component, two influencing factors are mainly considered: the optimal number of threads and the historical average initialization time of the initialization component. Among them, the sorting principle follows: optimal number of threads -> initialization time, that is, the optimal number of threads is given priority; for the optimal number of threads, the optimal number of threads can be analyzed through big data based on the terminal model of the terminal where the target application is located and the current running state of the terminal's operating system and other data. The formula for determining the optimal number of threads is, for example, (2*c)+x, where c represents the number of CPU cores, x represents the score corresponding to the current running state of the terminal's operating system, and the value range of x can be determined as needed, and the value of x is, for example, 1. For example, for a certain model of mobile phone, the number of CPU cores is 6, and the value of x is 1, then the optimal number of threads can be obtained as 13. For the historical average initialization time of the initialization component, it is the historical average initialization time of the initialization component on a certain terminal, which can be analyzed by the data center in the configuration center.
[0094] Specifically, in an example, refer to Figure 4 , assuming that the initialization order of the initialization components is Figure 4 The second topological sorting shown takes the mobile phone as an example. Assuming that the optimal number of threads of the mobile phone is 12, five threads can be directly initialized to give full play to the performance of the mobile phone due to its superior performance. Figure 5 A schematic diagram of a thread model provided in an embodiment of the present application is shown in FIG. Figure 5 As shown, five threads are used to initialize Figure 4 In another example, refer to Figure 4 , assuming that the optimal number of threads is 3, since the optimal number of threads is less than the number of initialization components, it is necessary to consider the historical average initialization time of the initialization components at the same time. Figure 6 A schematic diagram of a thread model provided for another embodiment of the present application is shown in FIG. Figure 6 As shown in the figure, assuming that the historical average initialization time of the component with serial number 1 is 100ms, the historical average initialization time of the component with serial number 2 is 300ms, the historical average initialization time of the component with serial number 3 is 100ms, the historical average initialization time of the component with serial number 4 is 500ms, and the historical average initialization time of the component with serial number 5 is 200ms, then according to the optimal number of threads and the historical average initialization time corresponding to the five components, the thread model is determined as follows Figure 6 shown.
[0095] Based on the above embodiments, in a possible implementation, the second initialization configuration parameter is determined in the following manner: when the target application is in the startup state, the initialization order and thread model of the initialization component are obtained from the local cache through the initialization management class, and the thread model is determined based on the thread model and initialization time of the initialization component when the target application was started last time; when the target application is in the idle state, the initialization order of the initialization component is obtained from the local cache through the initialization management class.
[0096] It can be understood that the target application obtains the initialization configuration parameters of the initialization component from the configuration center through the initialization management class only when it is started for the first time. In subsequent startups, the initialization configuration parameters are obtained from the local cache through the initialization management class. When the target application is in the startup state, the initialization order and thread model of the initialization component are obtained from the local cache through the initialization management class. Among them, the initialization order of the initialization component is the initialization order obtained from the configuration center; the thread model is determined based on the thread model and initialization time of the initialization component when the target application was started last time, that is, according to the thread model and initialization time of the initialization component each time the target application is started, the thread model of the initialization component is continuously optimized when the target application is started next time. When the target application is in an idle state, the initialization order of the initialization component can be obtained from the local cache through the initialization management class.
[0097] Based on the above embodiments, Figure 7 This is a flowchart of a component initialization method provided by another embodiment of the present application. Figure 7 As shown, the method of the embodiment of the present application may include:
[0098] S701. In response to a startup instruction for a target application, an initialization management class of the target application is obtained. The initialization management class is generated by a component initialization plug-in integrated in the target application. The component initialization plug-in is used to customize annotations, annotation interpreters, and initialization management classes.
[0099] The detailed description of this step can be found in Figure 2 The relevant description of S201 in the illustrated embodiment will not be repeated here.
[0100] S702. Obtain the class name and initialization method of the initialization class of the initialization component through the initialization management class.
[0101] The detailed description of this step can be found in Figure 2 The relevant description of S201 in the illustrated embodiment will not be repeated here.
[0102] S703: Create an instance object corresponding to the class name by initializing the management class and the reflection mechanism.
[0103] The detailed description of this step can be found in Figure 2 The relevant description of S202 in the illustrated embodiment will not be repeated here.
[0104] S704: Determine whether the target application is started for the first time.
[0105] Exemplarily, a flag field may be set in the initialization management class to determine whether the target application is started for the first time. For example, if the target application is started for the first time, the flag field takes a value of 1; if the target application is not started for the first time, the flag field takes a value of 2. If the target application is started for the first time, step S705 is executed; if the target application is not started for the first time, step S706 is executed.
[0106] S705: Obtain the initialization configuration parameters of the initialization component from the configuration center by initializing the annotation parameters in the management class and the target class file, wherein the initialization configuration parameters include the initialization sequence and / or thread model of the initialization component.
[0107] In this step, the target class file is a class file generated by the annotation interpreter scanning the initialization class annotated with annotations and annotation parameters in the target application when building the target application. When it is determined that the target application is started for the first time, the initialization configuration parameters of the initialization component are obtained from the configuration center, and step S707 is continued.
[0108] S706: Obtain the initialization configuration parameters of the initialization component from the local cache by using the annotation parameters in the initialization management class and the target class file, wherein the initialization configuration parameters include the initialization sequence and / or thread model of the initialization component.
[0109] In this step, when it is determined that the target application is not started for the first time, the initialization configuration parameters of the initialization component are obtained from the local cache, and step S707 is continued.
[0110] S707: Create a target thread corresponding to the initialization component according to the initialization configuration parameters through the initialization management class.
[0111] Exemplarily, referring to the example of step S204, a corresponding number of target threads may be created according to the length of the array where the threads in the initialization configuration parameter are located.
[0112] S708. According to the initialization order, in the target thread, the application instance object calls the initialization method to initialize the initialization component.
[0113] Exemplarily, referring to the example of step S204, each task is assigned to a corresponding target thread, and the application instance object calls the initialization method in accordance with the initialization order to initialize the initialization component.
[0114] S709: When the target application is in the startup state, the thread model of the local cache is updated through the initialization management class according to the thread model of the initialization component and the initialization time consumed when the target application is started.
[0115] Exemplarily, after the initialization component is initialized, the initialization result data can be analyzed to continuously optimize the initialization configuration parameters of the local cache. Specifically, the initialization result data is obtained through the initialization management class. If the component initialization time of the initialization component is initialized at startup, the initialization result data includes the thread model and initialization time of the initialization component when the target application is currently started. The thread model of the local cache is updated according to the initialization result data through the initialization management class. It can be understood that the initialization configuration parameters obtained from the configuration center through the initialization management class are the optimal historical initialization configuration parameters of the current terminal, which may not be in line with the actual operating conditions now and in the future. Through local learning after each startup of the target application, the initialization configuration parameters of the local cache can be continuously optimized, so that the optimal initialization configuration parameters that best meet the current status of the terminal can be obtained. For example, for the four initialization components A, B, C and D, when the target application is currently started, A and B are initialized through sub-thread 1, and C and D are initialized through sub-thread 2. After completing the initialization of A, B, C and D, the initialization result data is analyzed and it is found that in the current terminal environment, the initialization time of A is 700ms, the initialization time of B is 100ms, the initialization time of C is 100ms, and the initialization time of D is 500ms. After local learning optimization, when the target application is started next time, A will be run separately in sub-thread 1, and B, C and D will be run in sub-thread 2, so as to achieve the purpose of continuous optimization according to the real-time operation of the user terminal.
[0116] S710: Send the terminal model of the terminal where the target application is located and the initialization time of the initialization component to the configuration center through the initialization management class, so that the configuration center updates the initialization configuration parameters of the initialization component.
[0117] In this step, after the initialization of the initialization component is completed, the terminal model of the terminal where the target application is located and the initialization time of the initialization component can be sent to the configuration center through the initialization management class, so that the configuration center can optimize and update the initialization configuration parameters corresponding to the initialization component for the next batch of new user requests. For example, for the initialization component whose initialization time is initialized at startup, the configuration center obtains the initialization time of the initialization component on the terminal of the terminal model according to the terminal model and version of the terminal; then, according to the terminal model of the terminal, the optimal number of threads is obtained; finally, the initialization configuration parameters of the initialization component are obtained by combining the custom component priority and component dependency of the initialization component.
[0118] It should be noted that the embodiment of the present application does not limit the order in which steps S709 and S710 are executed.
[0119] The component initialization method provided by the embodiment of the present application integrates the component initialization plug-in in the target application, and uniformly manages the initialization of the initialization component of the target application through the initialization management class generated by the component initialization plug-in, wherein, if the target application is started for the first time, the initialization configuration parameters of the initialization component are obtained from the configuration center through the annotation parameters in the initialization management class and the target class file; if the target application is not started for the first time, the initialization configuration parameters of the initialization component are obtained from the local cache through the annotation parameters in the initialization management class and the target class file; the target thread corresponding to the initialization component is created according to the initialization configuration parameters through the initialization management class, and in the target thread, the application instance object calls the initialization method according to the initialization order to initialize the initialization component, and after the initialization of the initialization component is completed, the initialization configuration parameters are continuously optimized according to the initialization result data, which can effectively improve the initialization efficiency of the initialization component of the target application. In addition, since the integration method of the component initialization plug-in is simple and convenient, and the code intrusion to the target application is extremely low, it can significantly reduce the cost of the application party to access and maintain the component, and achieve the effect of "opening the application in seconds" with "zero cost", thereby improving the user experience.
[0120] Based on the above embodiments, in actual applications, the component initialization method provided in the embodiments of the present application can be applied to the initialization of components such as application publishing, offline package publishing, hot update publishing, push and User Behavior Strategy (UBS) in the mobile development platform (MDP) component market.
[0121] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.
[0122] Figure 8 A schematic diagram of the structure of a component initialization device provided in an embodiment of the present application is shown in FIG. Figure 8 As shown, the component initialization device 800 of the embodiment of the present application includes: a first acquisition module 801, a creation module 802, a second acquisition module 803 and a processing module 804. Among them:
[0123] The first acquisition module 801 is used to acquire the class name and initialization method of the initialization class of the initialization component through the initialization management class.
[0124] The creation module 802 is used to create an instance object corresponding to the class name by initializing the management class and the reflection mechanism.
[0125] The second acquisition module 803 is used to acquire the initialization configuration parameters of the initialization component through the annotation parameters in the initialization management class and the target class file.
[0126] The processing module 804 is used to initialize the initialization component by initializing the management class and initializing the configuration parameters and calling the initialization method by the application instance object.
[0127] In some embodiments, if the target application is started for the first time, the initialization configuration parameters are the first initialization configuration parameters obtained from the configuration center through the initialization management class; if the target application is not started for the first time, the initialization configuration parameters are the second initialization configuration parameters obtained from the local cache through the initialization management class; the annotation parameters include the component priority and component initialization time of the initialization component, and the component initialization time includes when the target application is in the startup state and when the target application is in the idle state.
[0128] Optionally, when the target application is in a startup state, the first initialization configuration parameter includes an initialization order and a thread model of the initialization components; wherein the initialization order is determined based on component dependencies and component priorities of the initialization components; the thread model is determined based on the optimal number of threads and / or the historical average initialization time of the initialization components, and the optimal number of threads is determined based on relevant information of the terminal where the target application is located, and the relevant information includes the terminal model of the terminal and the current running status of the terminal's operating system; when the target application is in an idle state, the first initialization configuration parameter includes the initialization order of the initialization components.
[0129] Optionally, the initialization order is determined based on component dependencies and component priorities of the initialization components, including: constructing a directed acyclic graph based on component dependencies; obtaining a topological sorting corresponding to the directed acyclic graph based on a breadth-first search (BFS) algorithm; and determining the initialization order from the topological sorting based on the component priorities.
[0130] In some embodiments, the second acquisition module 803 can determine the second initialization configuration parameters in the following manner: when the target application is in the startup state, the initialization order and thread model of the initialization component are obtained from the local cache through the initialization management class, and the thread model is determined based on the thread model and initialization time of the initialization component when the target application was started last time; when the target application is in the idle state, the initialization order of the initialization component is obtained from the local cache through the initialization management class.
[0131] Optionally, the processing module 804 can also be used to: after initializing the initialization component, when the target application is in the startup state, update the locally cached thread model according to the thread model and initialization time of the initialization component when starting the target application through the initialization management class.
[0132] Optionally, the processing module 804 can also be used to: after initializing the initialization component, send the terminal model of the terminal where the target application is located and the initialization time of the initialization component to the configuration center through the initialization management class, so that the configuration center updates the initialization configuration parameters of the initialization component.
[0133] In some embodiments, the processing module 804 may be specifically used to: create a target thread for initializing components according to initialization configuration parameters; and in the target thread, the application instance object calls an initialization method according to the initialization sequence to initialize the initialization components.
[0134] The device of the embodiment of the present application can be used to execute the technical solution of any of the above-mentioned method embodiments, and its implementation principle and technical effect are similar, which will not be repeated here.
[0135] Fig. 9 This is a schematic diagram of the structure of an electronic device provided by an embodiment of the present application. Fig. 9 As shown, the electronic device 900 may include: at least one processor 901 and a memory 902 .
[0136] The memory 902 is used to store programs. Specifically, the programs may include program codes, and the program codes include computer-executable instructions.
[0137] The memory 902 may include a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0138] The processor 901 is used to execute the computer-executable instructions stored in the memory 902 to implement the component initialization method described in the aforementioned method embodiment. Among them, the processor 901 may be a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application. Specifically, when implementing the component initialization method described in the aforementioned method embodiment, the electronic device may be, for example, an electronic device with processing functions such as a terminal.
[0139] Optionally, the electronic device 900 may further include a communication interface 903. In a specific implementation, if the communication interface 903, the memory 902 and the processor 901 are implemented independently, the communication interface 903, the memory 902 and the processor 901 may be interconnected through a bus and communicate with each other. The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc., but it does not mean that there is only one bus or one type of bus.
[0140] Optionally, in a specific implementation, if the communication interface 903, the memory 902 and the processor 901 are integrated on a chip, the communication interface 903, the memory 902 and the processor 901 can communicate through an internal interface.
[0141] The present application also provides a computer-readable storage medium, in which computer program instructions are stored. When a processor executes the computer program instructions, the above-mentioned component initialization method is implemented.
[0142] The present application also provides a computer program product, including a computer program, which implements the above component initialization method when executed by a processor.
[0143] The computer-readable storage medium mentioned above can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special-purpose computer.
[0144] An exemplary readable storage medium is coupled to the processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in a dedicated integrated circuit. Of course, the processor and the readable storage medium can also exist in the component initialization device as discrete components.
[0145] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.
[0146] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A component initialization method, characterized in that: include: Obtain the class name and initialization method of the initialization class of the initialization component through the initialization management class; Create an instance object corresponding to the class name through the initialization management class and reflection mechanism; Obtaining initialization configuration parameters of the initialization component through annotation parameters in the initialization management class and target class files; The initialization method is called by applying the instance object through the initialization management class and the initialization configuration parameters to initialize the initialization component.
2. The component initialization method according to claim 1, characterized in that: If the target application is started for the first time, the initialization configuration parameter is the first initialization configuration parameter obtained from the configuration center through the initialization management class; if the target application is not started for the first time, the initialization configuration parameter is the second initialization configuration parameter obtained from the local cache through the initialization management class; the annotation parameter includes the component priority and component initialization time of the initialization component, and the component initialization time includes when the target application is in the startup state and when the target application is in the idle state.
3. The component initialization method according to claim 2, characterized in that: When the target application is in a startup state, the first initialization configuration parameter includes an initialization order and a thread model of the initialization component; wherein the initialization order is determined according to component dependencies and component priorities of the initialization component; the thread model is determined according to an optimal number of threads and / or a historical average initialization time consumption of the initialization component, and the optimal number of threads is determined according to relevant information of a terminal where the target application is located, and the relevant information includes a terminal model of the terminal and a current running state of an operating system of the terminal; When the target application is in an idle state, the first initialization configuration parameter includes an initialization order of the initialization components.
4. The component initialization method according to claim 3, characterized in that: The initialization order is determined according to the component dependency relationship of the initialization components and the component priority, including: Constructing a directed acyclic graph according to the component dependencies; Based on the breadth-first search BFS algorithm, obtaining the topological sorting corresponding to the directed acyclic graph; The initialization order is determined from the topological sorting according to the component priorities.
5. The component initialization method according to claim 3, characterized in that: The second initialization configuration parameter is determined in the following manner: When the target application is in the startup state, the initialization order and thread model of the initialization component are obtained from the local cache through the initialization management class, and the thread model is determined based on the thread model and initialization time of the initialization component when the target application was started last time; When the target application is in an idle state, the initialization sequence of the initialization components is obtained from the local cache through the initialization management class.
6. The component initialization method according to claim 5, characterized in that: After initializing the initialization component, the method further includes: When the target application is in the startup state, the thread model of the local cache is updated through the initialization management class according to the thread model of the initialization component and the initialization time consumed when the target application is started.
7. The component initialization method according to any one of claims 1 to 6, characterized in that: After initializing the initialization component, the method further includes: The terminal model of the terminal where the target application is located and the initialization time of the initialization component are sent to the configuration center through the initialization management class, so that the configuration center updates the initialization configuration parameters of the initialization component.
8. The component initialization method according to any one of claims 1 to 6, characterized in that: The initialization component is initialized by calling the initialization method using the instance object through the initialization management class and the initialization configuration parameters, including: According to the initialization configuration parameters, create a target thread of the initialization component; According to the initialization order, in the target thread, the instance object is applied to call the initialization method to initialize the initialization component.
9. A component initialization device, characterized in that: include: A first acquisition module is used to acquire the class name and initialization method of the initialization class of the initialization component through the initialization management class; A creation module, used to create an instance object corresponding to the class name through the initialization management class and reflection mechanism; A second acquisition module is used to acquire the initialization configuration parameters of the initialization component through the annotation parameters in the initialization management class and the target class file; The processing module is used to call the initialization method by applying the instance object through the initialization management class and the initialization configuration parameters to initialize the initialization component.
10. An electronic device, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the component initialization method according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed, the component initialization method according to any one of claims 1 to 8 is implemented.
12. A computer program product, comprising a computer program, characterized in that When the computer program is executed, the component initialization method according to any one of claims 1 to 8 is implemented.
