WO2021114902A1 - 程序初始化方法、程序初始化装置、终端设备及存储介质 - Google Patents

程序初始化方法、程序初始化装置、终端设备及存储介质 Download PDF

Info

Publication number
WO2021114902A1
WO2021114902A1 PCT/CN2020/123756 CN2020123756W WO2021114902A1 WO 2021114902 A1 WO2021114902 A1 WO 2021114902A1 CN 2020123756 W CN2020123756 W CN 2020123756W WO 2021114902 A1 WO2021114902 A1 WO 2021114902A1
Authority
WO
WIPO (PCT)
Prior art keywords
parameter
target
value
program
target parameter
Prior art date
Application number
PCT/CN2020/123756
Other languages
English (en)
French (fr)
Inventor
赖云辉
Original Assignee
平安科技(深圳)有限公司
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 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2021114902A1 publication Critical patent/WO2021114902A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • 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
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files

Definitions

  • This application relates to the field of R&D management technology, and in particular to a program initialization method, program initialization device, terminal equipment, and computer storage medium.
  • Program initialization refers to the process of assigning initial values to initialization parameters (such as data objects or variables, etc.) in the program before the program runs.
  • initial parameter value is usually written directly into the corresponding parameter position in the program.
  • One of the objectives of the embodiments of the present application is to provide a program initialization method, program initialization device, terminal equipment, and computer storage medium, which can effectively implement flexible configuration of program initialization parameters.
  • an embodiment of the present application provides a program initialization method, including:
  • the first target parameter is an initialization parameter with a preset identifier
  • the target program is initialized according to the parameter value of the second target parameter.
  • an embodiment of the present application provides a program initialization device, including:
  • An acquiring unit configured to acquire a first target parameter in the target program, where the first target parameter is an initialization parameter with a preset identifier;
  • the searching unit is configured to search for the second target parameter corresponding to the first target parameter from the configuration table of the preset database
  • the initialization unit is configured to initialize the target program according to the parameter value of the first target parameter and the parameter value of the second target parameter.
  • an embodiment of the present application provides a terminal device, including a memory, a processor, and a computer program stored in the memory and running on the processor.
  • a terminal device including a memory, a processor, and a computer program stored in the memory and running on the processor.
  • the processor executes the computer program, To achieve the following steps:
  • the first target parameter is an initialization parameter with a preset identifier
  • the target program is initialized according to the parameter value of the second target parameter.
  • an embodiment of the present application provides a computer-readable storage medium
  • an embodiment of the present application provides a computer-readable storage medium
  • the computer-readable storage medium stores a computer program
  • the computer program is processed The following steps are implemented when the device is executed:
  • the first target parameter is an initialization parameter with a preset identifier
  • the target program is initialized according to the parameter value of the second target parameter.
  • the embodiment of the application obtains the first target parameter in the target program, that is, the initialization parameter with the preset identifier, and then searches the configuration table of the preset database for the second target parameter corresponding to the first target parameter, and finally according to the second target
  • the parameter value of the parameter initializes the target program. Since the parameter value of the second target parameter in the preset database can be flexibly modified, therefore, in the process of initializing the target program according to the parameter value of the second target parameter, the parameter of the second target parameter in the preset database can be modified. Value to flexibly configure the initialization parameters. Through the above method, the flexible configuration of program initialization parameters is effectively realized.
  • FIG. 1 is a schematic diagram of a program initialization system provided by an embodiment of the present application
  • FIG. 2 is a schematic flowchart of a parameter configuration method provided by an embodiment of the present application.
  • FIG. 3 is a schematic flowchart of a program initialization method provided by an embodiment of the present application.
  • Fig. 4 is a structural block diagram of a program initialization device provided by an embodiment of the present application.
  • FIG. 5 is a schematic structural diagram of a terminal device provided by an embodiment of the present application.
  • the term “if” can be construed as “when” or “once” or “in response to determination” or “in response to detecting ".
  • the program initialization system includes a processor 101 and a storage medium 102 storing a preset database.
  • the processor 101 is used to initialize and run the target program.
  • the storage medium 102 is a device or device including a storage space, such as a U disk, a mobile hard disk random access memory or a read-only memory, etc., and the preset database is stored in the storage space of the storage medium.
  • the processor and the storage medium 102 are communicatively connected, so that the processor can obtain the information in the preset database from the storage medium.
  • the preset database can also be stored in the internal storage space of the processor.
  • the interactive process of the program initialization method includes:
  • the processor obtains the preset identifier input by the user, and adds the preset identifier to the initialization parameters that need to be configured in the target program to obtain the first target parameter; then the first target parameter is added to the configuration of the preset database Table.
  • the user modifies the parameter value of the second target parameter in the configuration table of the preset database, and sends a parameter modification instruction to the processor after modification; the processor obtains the parameter modification after receiving the parameter modification instruction
  • the parameter information in the instruction (the parameter information includes the parameter name and the parameter modification value), the third target parameter corresponding to the parameter name is searched in the configuration table of the preset database, and the parameter value of the third target parameter is replaced with the parameter Modify the value.
  • the user sends an initialization instruction to the processor; after the processor receives the initialization instruction, it obtains the first target parameter in the target program (the first target parameter is the initialization parameter with a preset identifier), and the The second target parameter corresponding to the first target parameter is searched in the configuration table of the database; then the target program is initialized according to the parameter value of the second target parameter.
  • the processor receives the initialization instruction, it obtains the first target parameter in the target program (the first target parameter is the initialization parameter with a preset identifier), and the The second target parameter corresponding to the first target parameter is searched in the configuration table of the database; then the target program is initialized according to the parameter value of the second target parameter.
  • the user can modify the parameters in the preset database, and then initialize the target program according to the modified parameters in the preset database to achieve program initialization Flexible configuration of parameters.
  • the process of parameter configuration is usually carried out in the program development stage. After the program development is completed, before running the program, the program initialization process is carried out.
  • the process of parameter configuration and the process of program initialization may be executed by different processors, or may be executed by the same processor successively.
  • the process of parameter configuration is first introduced below.
  • FIG. 2 is a schematic flowchart of a parameter configuration method provided by an embodiment of the present application.
  • the method may include the following steps:
  • S201 Obtain initialization parameters in the target program, and obtain parameters to be configured in the initialization parameters.
  • the target program is the development object, that is, the application program in the development process.
  • a set of applications may serve different users.
  • the administrative platform is an application system for administrative management, which can be used to manage the administrative affairs of different companies, that is, serve different company users.
  • the general program framework is fixed, but some configurable parameters may be set. In this way, by modifying the parameters, the application can be adapted to different users.
  • Initialization parameters refer to parameters that need to be assigned initial values during program initialization, such as data objects or variables in the program.
  • "name” is a public static variable
  • "PA002” is the initial value to be assigned to "name"
  • the variable "name” is assigned the initial value "PA002”.
  • "name" is an initialization parameter.
  • the parameter value of this type of parameter is usually fixed.
  • the initial value assigned to the program framework parameter is a fixed value (ie Each time it is initialized, the initial value is the same); some parameters are used to initialize for different users.
  • the parameter value of this type of parameter can usually be changed and can be configured.
  • the initial value assigned to this type of parameter is not a fixed value (that is, the initial value may be different from before each time it is initialized).
  • the parameter to be configured in the initialization parameter refers to a parameter that is configurable in the initialization parameter.
  • the preset logo can be preset according to actual needs, and is usually defined during the program development process.
  • the preset identifier is equivalent to a mark, which can be used to distinguish which parameters are to be configured and which parameters are not to be configured (that is, non-to-be-configured parameters).
  • the preset identifier can be a pre-defined symbol added before or after the name of the parameter to be configured. Exemplarily, assuming that the preset identifier is "#", then after adding the preset identifier to the parameter "name" to be configured, the marked parameter is "#name”.
  • the preset identification can also be embodied by changing the format of the name of the parameter to be configured. Exemplarily, it is assumed that the name of the parameter to be configured is in uppercase letters, and the name of the non-to-be-configured parameter is in lowercase letters. For example, in the two parameters "NAME" and "time”, "NAME" is a parameter to be configured, and "time” is a parameter not to be configured. It should be noted that the expression form of the preset identifier may also be in other situations, as long as it can be used to distinguish between parameters to be configured and parameters not to be configured, and the expression form is not specifically limited.
  • the preset logo In the process of adding the preset logo, you can only add the preset logo to the configuration parameter. For example: assuming that the parameter "name” is a parameter to be configured, the parameter “time” is a parameter that is not to be configured, and the preset identifier is "#”, then only the preset identifier is added for "name", that is, "#name” instead of the parameter to be configured. The configuration parameter is still "time”.
  • the preset identifier in the embodiment of this application refers to the identifier of the parameter to be configured.
  • a preset mark can be added to the parameter "name", such as adding @myconstantconfig to the parameter name, that is, the parameter to be configured after adding the preset mark As "name@myconstantconfig”. If a parameter is not a parameter to be configured, you can add @ignoreattr to this parameter, such as adding @ignoreattr to the non-to-be-configured parameter "time” to get "time@ignoreattr". In this way, it is possible to distinguish which parameters are to be configured and which parameters are not to be configured through different marks. It should be noted that the foregoing is only an example of the preset logo, and does not specifically limit the content or form of the preset logo.
  • the configuration table of the preset database is used to store the names of all the parameters to be configured in the target program and their respective parameter values. In other words, during the initialization of the target program, which parameters need to be assigned initial values, then these parameters and their respective initial values will be stored in the configuration table of the preset database. In essence, the parameters and parameter values in the configuration table of the preset database correspond one-to-one with the parameters and parameter values in the target program.
  • the preset identifier is added to each of the parameters to be configured to obtain the first target parameter, it is also possible to: combine the first target parameter and the first target parameter The parameter value is uploaded to the blockchain.
  • the parameter configuration solution may be executed by one processor, or may be executed by multiple processors.
  • multiple processors perform parameter configuration tasks together, it is easy to find task conflicts.
  • each processor participating in the parameter configuration task uploads the configured first target parameter and its parameter value to the blockchain, which can ensure its security, fairness and transparency.
  • Each processor involved in the execution of parameter tasks, or other user equipment that wishes to query parameters can download the first target parameter and its parameter value from the blockchain, so as to verify whether the parameter value of the first target parameter has been tampered with.
  • the blockchain referred to in this example is a new application mode of computer technology such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm.
  • Blockchain essentially a decentralized database, is a series of data blocks associated with cryptographic methods. Each data block contains a batch of network transaction information for verification. The validity of the information (anti-counterfeiting) and the generation of the next block.
  • the blockchain can include the underlying platform of the blockchain, the platform product service layer, and the application service layer.
  • FIG. 3 is a schematic flowchart of the program initialization method provided by the embodiment of this application.
  • the method may include the following steps:
  • S301 Acquire a first target parameter in the target program, where the first target parameter is an initialization parameter with a preset identifier.
  • the initialization parameter with a preset identifier indicates that the parameter is a configurable parameter.
  • S302 Search for a second target parameter corresponding to the first target parameter from a configuration table of a preset database.
  • the first target parameter is stored in the target program
  • the second target parameter is stored in the configuration table of the preset database.
  • the parameters in the configuration table of the preset database have a one-to-one correspondence with the parameters in the target program, that is, the first target parameter and the second target parameter have a one-to-one correspondence.
  • the first target parameter and the second target parameter represent the same parameter.
  • the second target parameter corresponding to the first target parameter may mean that the name of the first target parameter is the same as the name of the second target parameter. For example, if the first target parameter is "name”, the parameter named "name" is searched in the configuration table of the preset database as the second target parameter.
  • the first target parameter and its corresponding second target parameter or the data format of the name may be different.
  • the first target The second target parameter corresponding to the parameter means that the first target parameter and the second target parameter represent the same variable.
  • the language of the target program is java and the database language is SQL
  • the first target parameter and the second target parameter both represent user numbers, but the name of the first target parameter is java language, and the name of the second target parameter is SQL language.
  • both the first target parameter and the second target parameter represent user numbers, but the parameter name of the first target parameter is "name", and the parameter name of the second target parameter is "ID".
  • S303 may specifically include the following steps:
  • S3031 Obtain the parameter value of the first target parameter, and compare the parameter value of the first target parameter with the parameter value of the second target parameter.
  • the parameter value of the first target parameter is stored in the target program, and the parameter value of the second target parameter is stored in the database.
  • the parameter value of the first target parameter is obtained, and the parameter value of the first target parameter is obtained from the target program.
  • the parameter value of the first target parameter is the same as the parameter value of the second target parameter, indicating that the parameter value of the first target parameter has not been modified, so the target program can still be initialized according to the original parameter value.
  • the parameter value of the first target parameter is different from the parameter value of the second target parameter, indicating that the parameter value of the first target parameter is modified, and then the target program needs to be initialized according to the modified parameter value.
  • the manner of using the parameter value of the second target parameter to update the parameter value of the first target parameter may include:
  • the parameter value of the second target parameter is generated into a bytecode file in a preset format, wherein the preset format is the same as the format of the parameter value of the first target parameter;
  • the code file is loaded to the position of the first target parameter in the target program.
  • CGLIB Code Generation Library
  • ASM A Small and fast bytecode processing framework
  • scripting languages such as Groovy and BeanShell also use ASM to generate java bytecodes, so they can also be used to generate bytecode files from the parameter values of the second target parameter.
  • the class loader is a part of the runtime environment and is responsible for dynamically loading the classes in the code into the memory space of the virtual machine.
  • the Java class loader is responsible for dynamically loading Java classes into the memory space of the Java virtual machine. After the bytecode file is loaded into the target program through the class loader, the target program can run the bytecode file.
  • the user can modify the parameters in the configuration table of the preset database at any time. Specifically, it can include the following steps:
  • the parameter information in the parameter modification instruction is acquired, where the parameter information includes the parameter name and the parameter modification value; and the parameter information is searched in the configuration table of the preset database.
  • the third target parameter corresponding to the name, and the parameter value of the third target parameter is replaced with the parameter modified value.
  • the user can modify the parameters in the preset database first, and then send a parameter modification instruction to the processor after the modification. It may also be that after the user modifies the parameters in the preset database, the server corresponding to the preset database feeds back the parameter modification instruction to the processor.
  • the update period can be preset, and the processor can detect whether the parameters in the configuration table of the preset database need to be updated according to the preset update period.
  • the specific detection process may be: the processor obtains the first target parameter in the target program, and obtains the second target parameter corresponding to each first target parameter in the configuration table of the preset database; and compares the parameter value of the first target parameter with The parameter value of the second target parameter is compared; if the parameter value of the first target parameter is different from the parameter value of the second target parameter, the parameter value of the second target parameter is used to compare the parameter value of the first target parameter Update (the update method can be described in S4033).
  • the embodiment of the application obtains the first target parameter in the target program, that is, the initialization parameter with a preset identifier, and then searches the configuration table of the preset database for the second target parameter corresponding to the first target parameter, and finally according to the second target
  • the parameter value of the parameter initializes the target program. Since the parameter value of the second target parameter in the preset database can be flexibly modified, in the process of initializing the target program according to the parameter value of the second target parameter, the parameter of the second target parameter in the preset database can be modified. Value to flexibly configure the initialization parameters. Through the above method, the flexible configuration of program initialization parameters is effectively realized.
  • FIG. 4 is a structural block diagram of a program initialization apparatus provided in an embodiment of the present application. For ease of description, only the parts related to the embodiment of the present application are shown.
  • the device 4 includes:
  • the acquiring unit 41 is configured to acquire a first target parameter in the target program, where the first target parameter is an initialization parameter with a preset identifier.
  • the searching unit 42 is configured to search for the second target parameter corresponding to the first target parameter from the configuration table of the preset database.
  • the initialization unit 43 is configured to initialize the target program according to the parameter value of the first target parameter and the parameter value of the second target parameter.
  • the device 4 further includes:
  • the scanning unit 44 is configured to obtain the initialization parameters in the target program and obtain the parameters to be configured in the initialization parameters before obtaining the initialization parameters with a preset identifier in the target program, wherein the parameters to be configured are It is a configurable parameter in the initialization parameters.
  • the identification unit 45 is configured to add the preset identification to each of the parameters to be configured to obtain the first target parameter
  • the adding unit 46 is configured to add the first target parameter to the configuration table of the preset database.
  • the device 4 further includes:
  • the monitoring unit is configured to obtain parameter information in the parameter modification instruction when the parameter modification instruction is monitored, where the parameter information includes the parameter name and the parameter modification value.
  • the replacement unit is configured to search for a third target parameter corresponding to the parameter name in the configuration table of the preset database, and replace the parameter value of the third target parameter with the parameter modification value.
  • the initialization unit 43 includes:
  • the comparison module is used to obtain the parameter value of the first target parameter, and compare the parameter value of the first target parameter with the parameter value of the second target parameter.
  • the first initialization module is configured to initialize the target program according to the parameter value of the first target parameter if the parameter value of the first target parameter is the same as the parameter value of the second target parameter.
  • the initialization unit 43 includes:
  • the comparison module is also used to obtain the parameter value of the first target parameter, and compare the parameter value of the first target parameter with the parameter value of the second target parameter.
  • the second initialization module is configured to use the parameter value of the second target parameter to compare the parameter value of the first target parameter if the parameter value of the first target parameter is different from the parameter value of the second target parameter. Update, and initialize the target program according to the updated parameter value of the first target parameter.
  • the second initialization module is also used to:
  • the bytecode file is loaded to the position of the first target parameter in the target program through a class loader.
  • the device 4 further includes:
  • the uploading unit is configured to upload the first target parameter and the parameter value of the first target parameter to each of the parameters to be configured by adding the preset identifier to obtain the first target parameter.
  • the blockchain In the blockchain.
  • program initialization device shown in FIG. 4 can be a software unit, a hardware unit, or a combination of software and hardware built into an existing terminal device, or it can be integrated into the terminal device as an independent pendant, or Exist as an independent terminal device.
  • Fig. 5 is a schematic structural diagram of a terminal device provided by an embodiment of the present application.
  • the terminal device 5 of this embodiment includes: at least one processor 50 (only one is shown in FIG.
  • the computer program 52 running on the processor 50 implements the steps in any of the foregoing program initialization method embodiments when the processor 50 executes the computer program 52.
  • the terminal device may be a computing device such as a desktop computer, a notebook, a palmtop computer, and a cloud server.
  • the terminal device may include, but is not limited to, a processor and a memory.
  • FIG. 5 is only an example of the terminal device 5, and does not constitute a limitation on the terminal device 5. It may include more or less components than those shown in the figure, or a combination of certain components, or different components. , For example, can also include input and output devices, network access devices, and so on.
  • the so-called processor 50 may be a central processing unit (Central Processing Unit, CPU).
  • the processor 50 may also be other general-purpose processors, digital signal processors (Digital Signal Processors, DSPs), and application-specific integrated circuits (Application Specific Integrated Circuits). Specific Integrated Circuit, ASIC), ready-made programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc.
  • the general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like.
  • the memory 51 may be an internal storage unit of the terminal device 5 in some embodiments, such as a hard disk or a memory of the terminal device 5. In other embodiments, the memory 51 may also be an external storage device of the terminal device 5, such as a plug-in hard disk equipped on the terminal device 5, a smart memory card (Smart Media Card, SMC), and a secure digital (Secure Digital, SD) card, flash memory card (Flash Card) and so on. Further, the memory 51 may also include both an internal storage unit of the terminal device 5 and an external storage device.
  • the memory 51 is used to store an operating system, an application program, a boot loader (Boot Loader), data, and other programs, such as the program code of the computer program. The memory 51 can also be used to temporarily store data that has been output or will be output.
  • the embodiments of the present application also provide a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in each of the foregoing method embodiments can be realized.
  • the computer-readable storage medium may be non-volatile or volatile.
  • the embodiments of the present application provide a computer program product.
  • the terminal device can realize the steps in the foregoing method embodiments when the terminal device is executed.
  • the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium.
  • the computer program can be stored in a computer-readable storage medium.
  • the computer program can be stored in a computer-readable storage medium.
  • the steps of the foregoing method embodiments can be implemented.
  • the computer program includes computer program code, and the computer program code may be in the form of source code, object code, executable file, or some intermediate forms.
  • the computer-readable medium may at least include: any entity or device capable of carrying the computer program code to the device/terminal device, recording medium, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signals, telecommunications signals, and software distribution media.
  • ROM read-only memory
  • RAM random access memory
  • electrical carrier signals telecommunications signals
  • software distribution media For example, U disk, mobile hard disk, floppy disk or CD-ROM, etc.
  • computer-readable media cannot be electrical carrier signals and telecommunication signals.
  • the disclosed device/terminal device and method may be implemented in other ways.
  • the device/terminal device embodiments described above are only illustrative.
  • the division of the modules or units is only a logical function division, and there may be other divisions in actual implementation, such as multiple units.
  • components can be combined or integrated into another system, or some features can be omitted or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.

Landscapes

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

Abstract

一种程序初始化方法、程序初始化装置、终端设备及计算机存储介质,应用于软件开发技术领域,包括:获取目标程序中的第一目标参数,其中,所述第一目标参数为带有预设标识的初始化参数(S301);从预设数据库的配置表中查找所述第一目标参数对应的第二目标参数(S302);根据所述第二目标参数的参数值对所述目标程序进行初始化(S303)。通过上述方法,有效实现了程序初始化参数的灵活配置。

Description

程序初始化方法、程序初始化装置、终端设备及存储介质
本申请要求于2020年06月05日提交中国专利局、申请号为202010503277.1、发明名称为“程序初始化方法、程序初始化装置、终端设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及研发管理技术领域,尤其涉及一种程序初始化方法、程序初始化装置、终端设备及计算机存储介质。
背景技术
程序初始化是指,在程序运行之前为程序中的初始化参数(如数据对象或变量等)赋初值的过程。现有技术中,通常是将初始参数值直接写入程序中相应的参数位置。
在实际应用中,发明人意识到程序的初始参数值经常需要被修改。在这种情况下,现有技术中就需要对程序中各个初始化参数的参数值一一进行修改,再重新发布新版本的程序。因此,现有的程序初始化过程,无法灵活地配置参数,导致程序的实用性较差。
技术问题
本申请实施例的目的之一在于:提供了一种程序初始化方法、程序初始化装置、终端设备及计算机存储介质,可以有效实现程序初始化参数的灵活配置。
技术解决方案
为解决上述技术问题,本申请实施例采用的技术方案是:
第一方面,本申请实施例提供了一种程序初始化方法,包括:
获取目标程序中的第一目标参数,其中,所述第一目标参数为带有预设标识的初始化参数;
从预设数据库的配置表中查找所述第一目标参数对应的第二目标参数;
根据所述第二目标参数的参数值对所述目标程序进行初始化。
第二方面,本申请实施例提供了一种程序初始化装置,包括:
获取单元,用于获取目标程序中的第一目标参数,其中,所述第一目标参数为带有预设标识的初始化参数;
查找单元,用于从预设数据库的配置表中查找所述第一目标参数对应的第二目标参数;
初始化单元,用于根据所述第一目标参数的参数值和所述第二目标参数的参数值对所述目标程序进行初始化。
第三方面,本申请实施例提供了一种终端设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现如下步骤:
获取目标程序中的第一目标参数,其中,所述第一目标参数为带有预设标识的初始化参数;
从预设数据库的配置表中查找所述第一目标参数对应的第二目标参数;
根据所述第二目标参数的参数值对所述目标程序进行初始化。
第四方面,本申请实施例提供了一种计算机可读存储介质,本申请实施例提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现如下步骤:
获取目标程序中的第一目标参数,其中,所述第一目标参数为带有预设标识的初始化参数;
从预设数据库的配置表中查找所述第一目标参数对应的第二目标参数;
根据所述第二目标参数的参数值对所述目标程序进行初始化。
有益效果
本申请实施例获取目标程序中的第一目标参数,即带有预设标识的初始化参数,然后从预设数据库的配置表中查找第一目标参数对应的第二目标参数,最后根据第二目标参数的参数值对目标程序进行初始化。由于预设数据库中的第二目标参数的参数值可以灵活修改,因此,根据第二目标参数的参数值对目标程序进行初始化的过程中,可以通过修改预设数据库中的第二目标参数的参数值来灵活配置初始化参数。通过上述方法,有效实现了程序初始化参数的灵活配置。
附图说明
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1是本申请一实施例提供的程序初始化***的示意图;
图2是本申请一实施例提供的参数配置方法的流程示意图;
图3是本申请一实施例提供的程序初始化方法的流程示意图;
图4是本申请一实施例提供的程序初始化装置的结构框图;
图5是本申请一实施例提供的终端设备的结构示意图。
本发明的实施方式
以下描述中,为了说明而不是为了限定,提出了诸如特定***结构、技术之类的具体细节,以便透彻理解本申请实施例。然而,本领域的技术人员应当清楚,在没有这些具体细节的其它实施例中也可以实现本申请。在其它情况中,省略对众所周知的***、装置、电路以及方法的详细说明,以免不必要的细节妨碍本申请的描述。
应当理解,当在本申请说明书和所附权利要求书中使用时,术语“包括”指示所描述特征、整体、步骤、操作、元素和/或组件的存在,但并不排除一个或多个其它特征、整体、步骤、操作、元素、组件和/或其集合的存在或添加。
如在本申请说明书和所附权利要求书中所使用的那样,术语“若”可以依据上下文被解释为“当...时”或“一旦”或“响应于确定”或“响应于检测到”。
另外,在本申请说明书和所附权利要求书的描述中,术语“第一”、“第二”、“第三”等仅用于区分描述,而不能理解为指示或暗示相对重要性。
在本申请说明书中描述的参考“一个实施例”或“一些实施例”等意味着在本申请的一个或多个实施例中包括结合该实施例描述的特定特征、结构或特点。由此,在本说明书中的不同之处出现的语句“在一个实施例中”、“在一些实施例中”、“在其他一些实施例中”、“在另外一些实施例中”等不是必然都参考相同的实施例,而是意味着“一个或多个但不是所有的实施例”,除非是以其他方式另外特别强调。
参见图1,为本申请实施例提供的程序初始化***的示意图。如图1所示,作为示例而非限定,程序初始化***包括处理器101和存储有预设数据库的存储介质102。其中,处理器101用于初始化并运行目标程序。存储介质102为包括存储空间的装置或器件,如U盘、移动硬盘随机存储器或只读存储器等,预设数据库存储于存储介质的存储空间中。处理器和存储介质102通信连接,以使处理器可以从存储介质中获取预设数据库中的信息。当然,在实际应用中,预设数据库也可以存储于处理器内部的存储空间中。
在一个应用场景中,程序初始化方法的交互流程包括:
在程序开发过程中,处理器获取用户输入的预设标识,并为目标程序中需要配置的初始化参数添加预设标识,得到第一目标参数;然后将第一目标参数添加到预设数据库的配置表中。
在参数需要修改时,用户对预设数据库的配置表中的第二目标参数的参数值进行修改,并在修改后向处理器发送参数修改指令;处理器接收到参数修改指令后,获取参数修改指令中的参数信息(参数信息包括参数名称和参数修改值),在预设数据库的所述配置表中查找与参数名称对应的第三目标参数,并将第三目标参数的参数值替换为参数修改值。
在程序初始化阶段,用户向处理器发送初始化指令;处理器接收到初始化指令后,获取目标程序中的第一目标参数(第一目标参数为带有预设标识的初始化参数),并从预设数据库的配置表中查找第一目标参数对应的第二目标参数;然后根据所述第二目标参数的参数值对所述目标程序进行初始化。
虽然无法对开发完成的目标程序中的初始化参数进行更改,但是用户可以对预设数据库中的参数进行修改,然后根据预设数据库中修改后的参数对目标程序进行初始化的过程,以实现程序初始化参数的灵活配置。
在实际应用中,参数配置的过程通常在程序开发阶段进行。在程序开发完成后,运行程序之前,进行程序初始化过程。参数配置的过程与程序初始化的过程可以由不同的处理器执行,也可以由同一个处理器先后执行。下面先介绍参数配置的过程。
参见图2,是本申请一实施例提供的参数配置方法的流程示意图,作为示例而非限定,所述方法可以包括以下步骤:
S201,获取所述目标程序中的初始化参数,并获取所述初始化参数中的待配置参数。
目标程序为开发对象,即开发过程中的应用程序。现有技术中,一套应用程序可能服务于不同的用户。例如:行政平台是一种用于行政管理的应用***,可以用于管理不同公司的行政事务,即服务于不同的公司用户。在实际中,如果为每个用户开发一套应用程序,开发工作量非常大,几乎是不可能实现的。因此,通常在应用程序开发过程中,大体的程序框架是固定不变的,但可能会设置一些可配置的参数,这样,通过对参数进行修改,就可以使应用程序适用于不同的用户。
初始化参数是指,在程序初始化的过程中,需要被赋初值的参数,如程序中的数据对象或变量等。示例性的:在程序初始化过程中,有一个步骤为public static String name=“PA002”。该程序初始化步骤中,“name”是一个公共静态变量,“PA002”是要赋给“name”的初值,即为变量“name”赋初值为“PA002”。其中,“name”就是一个初始化参数。
程序中通常有多个初始化参数。这些初始化参数中一种类型的参数是用于初始化程序框架的,这种类型参数的参数值通常是固定的,换言之,在程序初始化过程中,为程序框架参数赋的初值为固定值(即每次初始化时,初值都相同);还有一部分参数是用于针对不同的用户进行初始化的,这种类型参数的参数值通常是可以改变的,即可配置的,换言之,在程序初始化过程中,为这种类型的参数赋的初值不是固定值(即每次初始化时,初值都可能与之前不同)。在本申请实施例中,初始化参数中的待配置参数是指初始化参数中可配置的参数。
S202,分别为每个所述待配置参数添加所述预设标识,得到所述第一目标参数。
预设标识可以根据实际需要预先设定,通常是在程序开发过程中定义好的。预设标识相当于一种标记,可以用于区分哪些参数是待配置参数,哪些参数不属于待配置参数(即非待配置参数)。
预设标识可以是在待配置参数的名称的前面或后面添加预先定义的符号。示例性的,假设预设标识为“#”,那么为待配置参数“name”添加预设标识后,带有标记的参数为“#name”。预设标识也可以是通过改变待配置参数的名称的格式来体现。示例性的,假设待配置参数的名称为大写字母,而非待配置参数的名称为小写字母。如两个参数“NAME”和“time”中,“NAME”为待配置参数,“time”为非待配置参数。需要说明的是,预设标识的表现形式也可以是其他情形,只要能够用于区分待配置参数和非待配置参数即可,并不对表现形式做具体限定。
在添加预设标识的过程中,可以只对待配置参数添加预设标识。例如:假设参数“name”为待配置参数,参数“time”为非待配置参数,预设标识为“#”,那么只为“name”添加预设标识,即“#name”,而非待配置参数仍为“time”。
在添加预设标识的过程中,也可以对所有的初始化参数都添加标识,但是需要为待配置参数和非待配置参数设置不同的标识,这种情况下,本申请实施例中的预设标识是指待配置参数的标识。示例性的,参数“name”用于表示用户的编码,例如: public static String name=“PA001”表示用户A的编码为PA001,public static String name=“PA002”表示用户B的编码为PA002。由于用户的编码是可以更改的,所以参数“name”属于待配置参数,那么可以为参数“name”添加预设标记,如在参数name上添加@myconstantconfig,即添加预设标识后的待配置参数为“name@myconstantconfig”。如果某个参数不属于待配置参数,可以在这个参数上添加@ignoreattr,如在非待配置参数“time”上添加@ignoreattr后得到“time@ignoreattr”。这样,通过不同的标记就可以区分哪些参数是待配置参数,哪些参数不属于待配置参数。需要说明的是,上述只是对预设标识的示例,并不对预设标识的内容或形式做具体限定。
S203,将所述第一目标参数添加到所述预设数据库的所述配置表中。
预设数据库的配置表用于存储目标程序中所有的待配置参数的名称及其各自对应的参数值。换言之,目标程序初始化过程中,需要对哪些参数赋初值,那么这些参数及其各自对应的初值就会存储于预设数据库的配置表中。实质上,预设数据库的配置表中的参数及其参数值,与目标程序中的参数及其参数值是一一对应的。
通常,程序开发完成后,不方便对程序进行修改;如若修改,则需要重新发布新版本的程序,相当于二次开发的过程,这将增加开发人员的工作量;而且在应用过程中,还需要重新加载、安装新发版本的程序,这将会降低用户的体验度。但由于数据库中的数据便于修改,因此,通过上述方法,将目标程序中所有的待配置参数的名称及其各自对应的参数值存储于预设数据库中,当需要对某个待配置参数的参数值进行修改时,只需修改预设数据库的配置表中存储的该待配置参数的参数值即可,而无需对目标程序进行修改,减少了开发人员的工作量,同时提高了用户的体验度。
在一个实施例中,在分别为每个所述待配置参数添加所述预设标识,得到所述第一目标参数之后,还可以:将所述第一目标参数及所述第一目标参数的参数值上传至区块链中。
在本申请实施例中,参数配置的方案可以由一台处理器执行,也可以由多台处理器共同执行。当多台处理器共同执行参数配置任务时,容易发现任务冲突的情况。那么参与执行参数配置任务的每台处理器将配置好的第一目标参数及其参数值上传至区块链,可保证其安全性和公正透明性。每台参与执行参数任务的处理器,或者其他希望查询参数的用户设备,都可以从区块链中下载得第一目标参数及其参数值,以便查证第一目标参数的参数值是否被篡改。本示例所指区块链是分布式数据存储、点对点传输、共识机制、加密算法等计算机技术的新型应用模式。区块链(Blockchain),本质上是一个去中心化的数据库,是一串使用密码学方法相关联产生的数据块,每一个数据块中包含了一批次网络交易的信息,用于验证其信息的有效性(防伪)和生成下一个区块。区块链可以包括区块链底层平台、平台产品服务层以及应用服务层等。
在参数配置之后,运行程序之前,进行程序初始化过程。具体如下所述。
参见图3,为本申请实施例提供的程序初始化方法的流程示意图,作为示例而非限定,所述方法可以包括以下步骤:
S301,获取目标程序中的第一目标参数,其中,所述第一目标参数为带有预设标识的初始化参数。
如步骤S202中所述,带有预设标识的初始化参数,表示该参数为可配置的参数。
S302,从预设数据库的配置表中查找所述第一目标参数对应的第二目标参数。
这里的“第一”和“第二”仅用于区分目标参数,而不用于计数。
第一目标参数存储于目标程序中,第二目标参数存储于预设数据库的配置表中。如步骤S203中所述,预设数据库的配置表中的参数与目标程序中的参数是一一对应的,即第一目标参数与第二目标参数是一一对应的。
第一目标参数和第二目标参数表示同一个参数。第一目标参数对应的第二目标参数,可以是指,第一目标参数的名称与第二目标参数的名称相同。例如:第一目标参数为“name”,那么在预设数据库的配置表中查找名称为“name”的参数为第二目标参数。
但是,由于目标程序的语言和预设数据库的语言可能不同等原因,导致第一目标参数及其对应的第二目标参数的名称或名称的数据格式等可能不同,这种情况下,第一目标参数对应的第二目标参数是指,第一目标参数和第二目标参数表示同一变量。例如,假设目标程序的语言为java,数据库语言为SQL,第一目标参数和第二目标参数均表示用户编号,但是第一目标参数的名称为java语言,第二目标参数的名称为SQL语言。再例如,第一目标参数和第二目标参数均表示用户编号,但是第一目标参数的参数名称为“name”,而第二目标参数的参数名称为“ID”。
S303,根据所述第二目标参数的参数值对所述目标程序进行初始化。
在一个实施例中,S303具体可以包括以下步骤:
S3031,获取所述第一目标参数的参数值,并将所述第一目标参数的参数值与所述第二目标参数的参数值进行比对。
第一目标参数的参数值存储于目标程序中,第二目标参数的参数值存储于数据库中。获取第一目标参数的参数值为,从目标程序中获取第一目标参数的参数值。
S3032,若所述第一目标参数的参数值与所述第二目标参数的参数值相同,则根据所述第一目标参数的参数值对所述目标程序进行初始化。
第一目标参数的参数值与第二目标参数的参数值相同,说明没有对第一目标参数的参数值进行修改,所以仍然根据原有的参数值对目标程序进行初始化即可。
S3033,若所述第一目标参数的参数值与所述第二目标参数的参数值不同,则利用所述第二目标参数的参数值对所述第一目标参数的参数值进行更新,并根据更新后的所述第一目标参数的参数值对所述目标程序进行初始化。
第一目标参数的参数值与第二目标参数的参数值不同,说明对第一目标参数的参数值进行了修改,那么就需要按照修改后的参数值对目标程序进行初始化。
可选的,利用所述第二目标参数的参数值对所述第一目标参数的参数值进行更新的方式,可以包括:
将所述第二目标参数的参数值生成预设格式的字节码文件,其中,所述预设格式与所述第一目标参数的参数值的格式相同;通过类加载器将所述字节码文件加载至所述目标程序中所述第一目标参数的位置。
示例性的,可以利用代码生成类库 (CGLIB,Code Generation Library)工具,将第二目标参数的参数值生成字节码文件。CGLIB是一个强大的,高性能,高质量的Code生成类库,它可以在运行期扩展Java类、并实现Java接口。CGLIB的原理是通过使用一个小而快的字节码处理框架ASM,来转换字节码并生成新的类。
当然,除了CGLIB包,脚本语言例如Groovy和BeanShell,也是使用ASM来生成java的字节码,因此也可以用于将第二目标参数的参数值生成字节码文件。
类加载器是运行环境的一部分,负责动态加载代码中的类到虚拟机的内存空间中。例如,Java类加载器负责动态加载Java类到Java虚拟机的内存空间中。通过类加载器将字节码文件加载至目标程序中之后,目标程序就可以运行该字节码文件。
在一个实施例中,用户可以随时对预设数据库的配置表中的参数进行修改。具体的,可以包括以下步骤:
当监测到参数修改指令时,获取所述参数修改指令中的参数信息,其中,所述参数信息包括参数名称和参数修改值;在所述预设数据库的所述配置表中查找与所述参数名称对应的第三目标参数,并将所述第三目标参数的参数值替换为所述参数修改值。
用户可以先对预设数据库中的参数进行修改,在修改之后,再向处理器发送参数修改指令。也可以是在用户对预设数据库中的参数进行修改之后,由预设数据库对应的服务器向处理器反馈参数修改指令。
当然,实际应用中,可以预先设置更新周期,处理器可以按照预设的更新周期检测预设数据库的配置表中的参数是否需要进行更新。
具体的检测过程可以是:处理器获取目标程序中的第一目标参数,并获取预设数据库的配置表中每个第一目标参数对应的第二目标参数;将第一目标参数的参数值与第二目标参数的参数值进行比对;若第一目标参数的参数值与第二目标参数的参数值不同,则利用所述第二目标参数的参数值对所述第一目标参数的参数值进行更新(更新方法可以参加S4033中的描述)。
本申请实施例获取目标程序中的第一目标参数,即带有预设标识的初始化参数,然后从预设数据库的配置表中查找第一目标参数对应的第二目标参数,最后根据第二目标参数的参数值对目标程序进行初始化。由于预设数据库中的第二目标参数的参数值可以灵活修改,因此,根据第二目标参数的参数值对目标程序进行初始化的过程中,可以通过修改预设数据库中的第二目标参数的参数值来灵活配置初始化参数。通过上述方法,有效实现了程序初始化参数的灵活配置。
应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。
对应于上文实施例所述的程序初始化方法,图4是本申请一实施例提供的程序初始化装置的结构框图,为了便于说明,仅示出了与本申请实施例相关的部分。
参照图4,该装置4包括:
获取单元41,用于获取目标程序中的第一目标参数,其中,所述第一目标参数为带有预设标识的初始化参数。
查找单元42,用于从预设数据库的配置表中查找所述第一目标参数对应的第二目标参数。
初始化单元43,用于根据所述第一目标参数的参数值和所述第二目标参数的参数值对所述目标程序进行初始化。
可选的,装置4还包括:
扫描单元44,用于在获取目标程序中带有预设标识的初始化参数之前,获取所述目标程序中的初始化参数,并获取所述初始化参数中的待配置参数,其中,所述待配置参数为所述初始化参数中可配置的参数。
标识单元45,用于分别为每个所述待配置参数添加所述预设标识,得到所述第一目标参数;
添加单元46,用于将所述第一目标参数添加到所述预设数据库的所述配置表中。
可选的,装置4还包括:
监测单元,用于当监测到参数修改指令时,获取所述参数修改指令中的参数信息,其中,所述参数信息包括参数名称和参数修改值。
替换单元,用于在所述预设数据库的所述配置表中查找与所述参数名称对应的第三目标参数,并将所述第三目标参数的参数值替换为所述参数修改值。
可选的,初始化单元43包括:
比对模块,用于获取所述第一目标参数的参数值,并将所述第一目标参数的参数值与所述第二目标参数的参数值进行比对。
第一初始化模块,用于若所述第一目标参数的参数值与所述第二目标参数的参数值相同,则根据所述第一目标参数的参数值对所述目标程序进行初始化。
可选的,初始化单元43包括:
比对模块,还用于获取所述第一目标参数的参数值,并将所述第一目标参数的参数值与所述第二目标参数的参数值进行比对。
第二初始化模块,用于若所述第一目标参数的参数值与所述第二目标参数的参数值不同,则利用所述第二目标参数的参数值对所述第一目标参数的参数值进行更新,并根据更新后的所述第一目标参数的参数值对所述目标程序进行初始化。
可选的,第二初始化模块还用于:
将所述第二目标参数的参数值生成预设格式的字节码文件,其中,所述预设格式与所述第一目标参数的参数值的格式相同;
通过类加载器将所述字节码文件加载至所述目标程序中所述第一目标参数的位置。
可选的,装置4还包括:
上传单元,用于在分别为每个所述待配置参数添加所述预设标识,得到所述第一目标参数之后,将所述第一目标参数及所述第一目标参数的参数值上传至区块链中。
需要说明的是,上述装置/单元之间的信息交互、执行过程等内容,由于与本申请方法实施例基于同一构思,其具体功能及带来的技术效果,具体可参见方法实施例部分,此处不再赘述。
另外,图4所示的程序初始化装置可以是内置于现有的终端设备内的软件单元、硬件单元、或软硬结合的单元,也可以作为独立的挂件集成到所述终端设备中,还可以作为独立的终端设备存在。
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将所述装置的内部结构划分成不同的功能单元或模块,以完成以上描述的全部或者部分功能。实施例中的各功能单元、模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中,上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。另外,各功能单元、模块的具体名称也只是为了便于相互区分,并不用于限制本申请的保护范围。上述***中单元、模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
图5是本申请一实施例提供的终端设备的结构示意图。如图5所示,该实施例的终端设备5包括:至少一个处理器50(图5中仅示出一个)处理器、存储器51以及存储在所述存储器51中并可在所述至少一个处理器50上运行的计算机程序52,所述处理器50执行所述计算机程序52时实现上述任意各个程序初始化方法实施例中的步骤。
所述终端设备可以是桌上型计算机、笔记本、掌上电脑及云端服务器等计算设备。该终端设备可包括,但不仅限于,处理器、存储器。本领域技术人员可以理解,图5仅仅是终端设备5的举例,并不构成对终端设备5的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如还可以包括输入输出设备、网络接入设备等。
所称处理器50可以是中央处理单元(Central Processing Unit,CPU),该处理器50还可以是其他通用处理器、数字信号处理器 (Digital Signal Processor,DSP)、专用集成电路 (Application Specific Integrated Circuit,ASIC)、现成可编程门阵列 (Field-Programmable Gate Array,FPGA) 或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。
所述存储器51在一些实施例中可以是所述终端设备5的内部存储单元,例如终端设备5的硬盘或内存。所述存储器51在另一些实施例中也可以是所述终端设备5的外部存储设备,例如所述终端设备5上配备的插接式硬盘,智能存储卡(Smart Media Card, SMC),安全数字(Secure Digital, SD)卡,闪存卡(Flash Card)等。进一步地,所述存储器51还可以既包括所述终端设备5的内部存储单元也包括外部存储设备。所述存储器51用于存储操作***、应用程序、引导装载程序(Boot Loader)、数据以及其他程序等,例如所述计算机程序的程序代码等。所述存储器51还可以用于暂时地存储已经输出或者将要输出的数据。
本申请实施例还提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现可实现上述各个方法实施例中的步骤。所述计算机可读存储介质可以是非易失性,也可以是易失性。
本申请实施例提供了一种计算机程序产品,当计算机程序产品在终端设备上运行时,使得终端设备执行时实现可实现上述各个方法实施例中的步骤。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实现上述实施例方法中的全部或部分流程,可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。其中,所述计算机程序包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读介质至少可以包括:能够将计算机程序代码携带到装置/终端设备的任何实体或装置、记录介质、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、电载波信号、电信信号以及软件分发介质。例如U盘、移动硬盘、磁碟或者光盘等。在某些司法管辖区,根据立法和专利实践,计算机可读介质不可以是电载波信号和电信信号。
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述或记载的部分,可以参见其它实施例的相关描述。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
在本申请所提供的实施例中,应该理解到,所揭露的装置/终端设备和方法,可以通过其它的方式实现。例如,以上所描述的装置/终端设备实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个***,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通讯连接可以是通过一些接口,装置或单元的间接耦合或通讯连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
以上所述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。

Claims (20)

  1. 一种程序初始化方法,其中,所述方法包括:
    获取目标程序中的第一目标参数,其中,所述第一目标参数为带有预设标识的初始化参数;
    从预设数据库的配置表中查找所述第一目标参数对应的第二目标参数;
    根据所述第二目标参数的参数值对所述目标程序进行初始化。
  2. 如权利要求1所述的程序初始化方法,其中,在获取目标程序中带有预设标识的初始化参数之前,所述方法还包括:
    获取所述目标程序中的初始化参数,并获取所述初始化参数中的待配置参数,其中,所述待配置参数为所述初始化参数中可配置的参数;
    分别为每个所述待配置参数添加所述预设标识,得到所述第一目标参数;
    将所述第一目标参数添加到所述预设数据库的所述配置表中。
  3. 如权利要求1所述的程序初始化方法,其中,所述方法还包括:
    当监测到参数修改指令时,获取所述参数修改指令中的参数信息,其中,所述参数信息包括参数名称和参数修改值;
    在所述预设数据库的所述配置表中查找与所述参数名称对应的第三目标参数,并将所述第三目标参数的参数值替换为所述参数修改值。
  4. 如权利要求1至3任一项所述的程序初始化方法,其中,所述根据所述第二目标参数的参数值对所述目标程序进行初始化,包括:
    获取所述第一目标参数的参数值,并将所述第一目标参数的参数值与所述第二目标参数的参数值进行比对;
    若所述第一目标参数的参数值与所述第二目标参数的参数值相同,则根据所述第一目标参数的参数值对所述目标程序进行初始化。
  5. 如权利要求1至3任一项所述的程序初始化方法,其中,所述根据所述第二目标参数的参数值对所述目标程序进行初始化,包括:
    获取所述第一目标参数的参数值,并将所述第一目标参数的参数值与所述第二目标参数的参数值进行比对;
    若所述第一目标参数的参数值与所述第二目标参数的参数值不同,则利用所述第二目标参数的参数值对所述第一目标参数的参数值进行更新,并根据更新后的所述第一目标参数的参数值对所述目标程序进行初始化。
  6. 如权利要求5所述的程序初始化方法,其中,所述利用所述第二目标参数的参数值对所述第一目标参数的参数值进行更新,包括:
    将所述第二目标参数的参数值生成预设格式的字节码文件,其中,所述预设格式与所述第一目标参数的参数值的格式相同;
    通过类加载器将所述字节码文件加载至所述目标程序中所述第一目标参数的位置。
  7. 如权利要求2所述的程序初始化方法,其中,在分别为每个所述待配置参数添加所述预设标识,得到所述第一目标参数之后,还包括:
    将所述第一目标参数及所述第一目标参数的参数值上传至区块链中。
  8. 一种程序初始化装置,其中,所述装置包括:
    获取单元,用于获取目标程序中的第一目标参数,其中,所述第一目标参数为带有预设标识的初始化参数;
    查找单元,用于从预设数据库的配置表中查找所述第一目标参数对应的第二目标参数;
    初始化单元,用于根据所述第一目标参数的参数值和所述第二目标参数的参数值对所述目标程序进行初始化。
  9. 一种终端设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,其中,所述处理器执行所述计算机程序时实现如下步骤:
    获取目标程序中的第一目标参数,其中,所述第一目标参数为带有预设标识的初始化参数;
    从预设数据库的配置表中查找所述第一目标参数对应的第二目标参数;
    根据所述第二目标参数的参数值对所述目标程序进行初始化。
  10. 如权利要求9所述的终端设备,其中,在获取目标程序中带有预设标识的初始化参数之前,所述处理器执行所述计算机程序时实现如下步骤:
    获取所述目标程序中的初始化参数,并获取所述初始化参数中的待配置参数,其中,所述待配置参数为所述初始化参数中可配置的参数;
    分别为每个所述待配置参数添加所述预设标识,得到所述第一目标参数;
    将所述第一目标参数添加到所述预设数据库的所述配置表中。
  11. 如权利要求9所述的终端设备,其中,所述处理器执行所述计算机程序时实现如下步骤:
    当监测到参数修改指令时,获取所述参数修改指令中的参数信息,其中,所述参数信息包括参数名称和参数修改值;
    在所述预设数据库的所述配置表中查找与所述参数名称对应的第三目标参数,并将所述第三目标参数的参数值替换为所述参数修改值。
  12. 如权利要求9至11任一项所述的终端设备,其中,所述根据所述第二目标参数的参数值对所述目标程序进行初始化,包括:
    获取所述第一目标参数的参数值,并将所述第一目标参数的参数值与所述第二目标参数的参数值进行比对;
    若所述第一目标参数的参数值与所述第二目标参数的参数值相同,则根据所述第一目标参数的参数值对所述目标程序进行初始化。
  13. 如权利要求9至11任一项所述的终端设备,其中,所述根据所述第二目标参数的参数值对所述目标程序进行初始化,包括:
    获取所述第一目标参数的参数值,并将所述第一目标参数的参数值与所述第二目标参数的参数值进行比对;
    若所述第一目标参数的参数值与所述第二目标参数的参数值不同,则利用所述第二目标参数的参数值对所述第一目标参数的参数值进行更新,并根据更新后的所述第一目标参数的参数值对所述目标程序进行初始化。
  14. 如权利要求13所述的终端设备,其中,所述利用所述第二目标参数的参数值对所述第一目标参数的参数值进行更新,包括:
    将所述第二目标参数的参数值生成预设格式的字节码文件,其中,所述预设格式与所述第一目标参数的参数值的格式相同;
    通过类加载器将所述字节码文件加载至所述目标程序中所述第一目标参数的位置。
  15. 如权利要求10所述的终端设备,其中,在分别为每个所述待配置参数添加所述预设标识,得到所述第一目标参数之后,还包括:
    将所述第一目标参数及所述第一目标参数的参数值上传至区块链中。
  16. 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其中,所述计算机程序被处理器执行时实现如步骤:
    获取目标程序中的第一目标参数,其中,所述第一目标参数为带有预设标识的初始化参数;
    从预设数据库的配置表中查找所述第一目标参数对应的第二目标参数;
    根据所述第二目标参数的参数值对所述目标程序进行初始化。
  17. 如权利要求16所述的计算机可读存储介质,其中,在获取目标程序中带有预设标识的初始化参数之前,所述计算机程序被处理器执行时实现如步骤:
    获取所述目标程序中的初始化参数,并获取所述初始化参数中的待配置参数,其中,所述待配置参数为所述初始化参数中可配置的参数;
    分别为每个所述待配置参数添加所述预设标识,得到所述第一目标参数;
    将所述第一目标参数添加到所述预设数据库的所述配置表中。
  18. 如权利要求16所述的计算机可读存储介质,其中,所述计算机程序被处理器执行时实现如步骤:
    当监测到参数修改指令时,获取所述参数修改指令中的参数信息,其中,所述参数信息包括参数名称和参数修改值;
    在所述预设数据库的所述配置表中查找与所述参数名称对应的第三目标参数,并将所述第三目标参数的参数值替换为所述参数修改值。
  19. 如权利要求16至18任一项所述的计算机可读存储介质,其中,所述根据所述第二目标参数的参数值对所述目标程序进行初始化,包括:
    获取所述第一目标参数的参数值,并将所述第一目标参数的参数值与所述第二目标参数的参数值进行比对;
    若所述第一目标参数的参数值与所述第二目标参数的参数值相同,则根据所述第一目标参数的参数值对所述目标程序进行初始化。
  20. 如权利要求16至18任一项所述的计算机可读存储介质,其中,所述根据所述第二目标参数的参数值对所述目标程序进行初始化,包括:
    获取所述第一目标参数的参数值,并将所述第一目标参数的参数值与所述第二目标参数的参数值进行比对;
    若所述第一目标参数的参数值与所述第二目标参数的参数值不同,则利用所述第二目标参数的参数值对所述第一目标参数的参数值进行更新,并根据更新后的所述第一目标参数的参数值对所述目标程序进行初始化。
PCT/CN2020/123756 2020-06-05 2020-10-26 程序初始化方法、程序初始化装置、终端设备及存储介质 WO2021114902A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010503277.1 2020-06-05
CN202010503277.1A CN111694586A (zh) 2020-06-05 2020-06-05 程序初始化方法、程序初始化装置、终端设备及存储介质

Publications (1)

Publication Number Publication Date
WO2021114902A1 true WO2021114902A1 (zh) 2021-06-17

Family

ID=72479438

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/123756 WO2021114902A1 (zh) 2020-06-05 2020-10-26 程序初始化方法、程序初始化装置、终端设备及存储介质

Country Status (2)

Country Link
CN (1) CN111694586A (zh)
WO (1) WO2021114902A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111694586A (zh) * 2020-06-05 2020-09-22 平安科技(深圳)有限公司 程序初始化方法、程序初始化装置、终端设备及存储介质
CN116701501B (zh) * 2022-11-21 2024-04-12 荣耀终端有限公司 相机标定数据的加载方法、装置及终端设备

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1290897A (zh) * 1999-06-30 2001-04-11 国际商业机器公司 可动态调节而且可配置的废料收集程序用的方法和***
CN104022894A (zh) * 2014-05-12 2014-09-03 东软熙康健康科技有限公司 集中管理应用配置参数的方法、配置应用参数的方法
CN105630562A (zh) * 2016-01-07 2016-06-01 东莞钜威新能源有限公司 一种电池管理***初始化的方法和装置
CN107508846A (zh) * 2016-06-14 2017-12-22 北京京东尚科信息技术有限公司 应用客户端的更新方法和***及终端设备
CN111694586A (zh) * 2020-06-05 2020-09-22 平安科技(深圳)有限公司 程序初始化方法、程序初始化装置、终端设备及存储介质

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5913218A (en) * 1995-11-06 1999-06-15 Sun Microsystems, Inc System and method for retrieving and updating configuration parameter values for application programs in a computer network
CN103064919B (zh) * 2012-12-20 2017-02-15 北京思特奇信息技术股份有限公司 一种业务***中配置参数的保存方法及装置
CN108268289B (zh) * 2016-12-30 2022-01-28 阿里巴巴集团控股有限公司 web应用的参数配置方法、装置及***
CN110955455A (zh) * 2018-09-26 2020-04-03 Oppo(重庆)智能科技有限公司 终端初始化配置方法、装置、电子设备及存储介质
CN111124523A (zh) * 2018-10-15 2020-05-08 百度在线网络技术(北京)有限公司 用于初始化应用的方法和装置
CN111104133A (zh) * 2018-10-25 2020-05-05 深圳市茁壮网络股份有限公司 一种配置参数的更新***、方法及存储介质
CN109766123B (zh) * 2018-12-24 2022-06-10 奇安信科技集团股份有限公司 应用程序封装方法及装置
CN110502272A (zh) * 2019-08-16 2019-11-26 济南浪潮数据技术有限公司 一种参数配置方法、装置、存储介质及计算机设备

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1290897A (zh) * 1999-06-30 2001-04-11 国际商业机器公司 可动态调节而且可配置的废料收集程序用的方法和***
CN104022894A (zh) * 2014-05-12 2014-09-03 东软熙康健康科技有限公司 集中管理应用配置参数的方法、配置应用参数的方法
CN105630562A (zh) * 2016-01-07 2016-06-01 东莞钜威新能源有限公司 一种电池管理***初始化的方法和装置
CN107508846A (zh) * 2016-06-14 2017-12-22 北京京东尚科信息技术有限公司 应用客户端的更新方法和***及终端设备
CN111694586A (zh) * 2020-06-05 2020-09-22 平安科技(深圳)有限公司 程序初始化方法、程序初始化装置、终端设备及存储介质

Also Published As

Publication number Publication date
CN111694586A (zh) 2020-09-22

Similar Documents

Publication Publication Date Title
US10310824B2 (en) Distributed ledger platform for computing applications
US7386609B2 (en) Method, system, and program for managing devices in a network
US7971182B1 (en) Application environment specifications for provisioning application specific runtime environments using undefined symbols
US9460306B1 (en) System and method for controlling access of machine code to operating system resources
US10929149B2 (en) Method and system for updating firmware
CN111736922B (zh) 插件调用方法、装置、电子设备及存储介质
US10268628B2 (en) Method for extracting BIOS attributes for BIOS management and system therefor
AU2004200639A1 (en) Integrating design, deployment, and management phases for systems
US8489547B2 (en) System and method for transforming configuration data items in a configuration management database
US10394756B2 (en) System and method for customizing archive of a device driver generator tool for a user
CN108595187A (zh) 安卓安装包集成软件开发工具包的法、装置及存储介质
WO2021114902A1 (zh) 程序初始化方法、程序初始化装置、终端设备及存储介质
WO2021174836A1 (zh) 差分包生成方法方法、装置、计算机设备及存储介质
US20180144062A1 (en) Computer device and method for facilitating user to manage containers
US20020174082A1 (en) Reusable parts for assembled software systems
US20060123016A1 (en) Metadata driven method and apparatus to configure heterogenous distributed systems
JP2021516379A (ja) ライセンス検証装置
US9367686B1 (en) System and method for antivirus checking of native images of software assemblies
WO2002027486A1 (en) Methods and apparatus for generating unique identifiers for software components
US20080301654A1 (en) Program processing apparatus, program processing method and computer readable information recording medium
CN113971019A (zh) 数据类型创建方法、装置、服务器及介质
TWI682296B (zh) 映像檔打包方法及映像檔打包系統
CA3099814C (en) Distributed ledger platform for computing applications
CN111857883A (zh) 页面数据校验方法、装置、电子设备及存储介质
US8825651B1 (en) Determining a group of related products on a computing device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20900212

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20900212

Country of ref document: EP

Kind code of ref document: A1