Java component generation method and device
A Java component and component technology, applied in the field of Java component generation, can solve problems such as component version incompatibility, non-standard framework construction, software delivery impact, etc., to save technology selection and component selection time, and improve application development efficiency. Effect
Pending Publication Date: 2021-04-30
BOE TECH GRP CO LTD
0 Cites 0 Cited by
AI-Extracted Technical Summary
Problems solved by technology
For the current Internet industry systems, the scale is relatively large. Due to the relatively active Java open source ecosystem and the large number of components and tools, developers will encounter non-standard framework construction, non-standard use of components, and large number of components when dev...
Method used
Service module mainly defines the structure of service layer, depends on specification etc., comprises: entity package comprises basic test question definition, has defined the general information such as time, revising people, and developer can define expansion business attribute based on this; mapper package comprises database The basic operation encapsulates the behavior of the database; the service package def...
Abstract
The invention discloses a Java component generation method and device, relates to the technical field of computers, and mainly aims to realize quick construction of an enterprise-level development framework by constructing a standard Java component and improve research and development efficiency. According to the main technical scheme, the method comprises the steps of obtaining a preset development module according to a generation instruction of a target component, wherein the preset development module at least comprises a universal module, a service module, a front-end controller module and a calling relationship among the modules; loading the preset development module in a local Java development environment to obtain a to-be-executed module; receiving component information of a target component, and adding the component information into the to-be-executed module; and generating a target component by executing the to-be-executed module. The invention is used for generating the standard Java component used for building the enterprise-level development framework.
Application Domain
Programming languages/paradigms
Technology Topic
Development environmentSoftware engineering +2
Image
Examples
- Experimental program(1)
Example Embodiment
[0048] Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present invention are shown in the drawings, it should be understood that the invention may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided for more thorough understanding of the present invention and to fully convey the scope of the present invention to those skilled in the art.
[0049] The embodiment of the present invention provides a method for generating a Java component, and its specific execution steps are as follows: figure 1 shown, including:
[0050] 101. Obtain a preset development module according to a generation instruction of a target component.
[0051]In this embodiment, the default development module is a component template created correspondingly for different types of Java enterprise development components. The component template is preset with required common functional components according to the development requirements of Java enterprise applications. and the general setup parameters of the component. The default development module is a compiled component template. The functional modules that must be included in the default development module include: general module, service module, front-end controller module and the calling relationship between each module. The module is set with general development tools and related parameters; the service module is mainly used to define the structure of the service layer, dependency specifications, etc.; the front-end controller module is used to define the structure and specifications of the interface provided by the application, and is implemented as a terminal and a web segment , mobile terminal, etc. provide service interfaces; the call relationship between modules includes the relationship between different functional modules or tools, and the relationship between each functional module and external files, such as external database scripts, resource files, etc.
[0052] In practical applications, developers can actively select the required preset development modules according to the projects they develop, that is, call the required preset development modules by generating instructions. To this end, the developer can input the identification information of the required preset development modules in the development interface to trigger the generation instruction of the target component; and when the developer does not know which preset development modules exist, the development interface will also A corresponding display interface can be provided for displaying the currently existing preset development modules for developers to choose, and the generation instruction of the target component is triggered according to the developer's choice.
[0053] 102. Load the preset development module in the local Java development environment to obtain the module to be executed.
[0054] Since there is more than one preset development module, there may be multiple versions of the same function of the preset development module. Therefore, after the developer determines the preset development module, he also needs to create Download the default development module, that is, install the default development module in the local Java development environment, so as to adapt the development module, and make sure that the current Java development environment can apply the default development module of this version Group.
[0055] 103. Receive component information of the target component, and add the component information to the module to be executed.
[0056] After it is determined that the local Java development environment can load the preset development module, it means that the developer can quickly generate the target component locally through the module to be executed. At this time, the developer needs to input the component information of the target component according to the specific development content, such as the project name, storage location, and version information of the component. The component information is the relevant parameter value of the specific parameter in the target component.
[0057] The specific method of adding component information to the module to be executed includes, but is not limited to, that the developer uniformly inputs relevant parameters and corresponding parameter values, and the program automatically identifies the specific parameters, and adds the corresponding parameter value to the module to be executed In , if the parameter value of a necessary parameter is not added, the developer is prompted to add the relevant parameter value; or the necessary parameters are displayed one by one, and the developer is prompted to fill in the parameter value corresponding to the parameter.
[0058] 104. Generate a target component by executing the module to be executed.
[0059] After setting the necessary parameters, the developer can run the module to be executed through the preset command to generate the target component. The triggering of the preset instruction can be achieved by inputting a specific instruction, or through a virtual button in the interactive interface, and the specific method is not specifically limited in this embodiment.
[0060] Further, to execute the module to be executed, or trigger the preset instruction, the premise is that the setting of the necessary parameters is completed, and the set parameter values are correct. If there are necessary parameters that have not been set, or the parameter values of the necessary parameters are not If it is correct, the developer will be prompted that the input is incorrect. At this time, the module to be executed or the preset command cannot be triggered.
[0061] Based on the above figure 1 It can be seen that the Java component generation method proposed in the embodiment of the present invention is that when developing the target component in the Java development environment, the general module, service module, and front-end control defined in the preset development module can be used. The development tools used to generate the target components required by standard development component specifications such as the component module to realize the templated component development process. By loading the preset development module in the developer's local Java development environment, the module to be executed is generated, and the target component is generated together with the module to be executed according to the relevant component information of the input target component, so that the construction of the component is standardized . Developers can use the standardized target components to quickly build the system framework of enterprise-level applications, avoiding the problems of communication between systems and component incompatibility caused by non-standard components in application development. Moreover, since the standard development tools have been set in the target component, it can help developers save time in technology selection and component selection, and only need to apply the target component to realize specific business coding, which greatly improves the efficiency of application development.
[0062] Further, in the above figure 1 On the basis of the embodiment, the preferred embodiment of the present invention will describe in detail the construction of the preset development module and the generation process of the target component. The specific steps are as follows: figure 2 shown, including:
[0063] 201. Create a preset development module.
[0064] Default development modules need to be pre-created and compiled. For Java enterprise application development, the preset development module constructed in this embodiment includes at least three main functional modules: a common module javaee-common, a service module javaee-service, and a front-end controller module javaee-web.
[0065] Among them, the general module mainly includes: the base package contains the basic message protocol definition, the paging request basic configuration, the bean conversion instance definition, the return protocol definition, etc., and these definitions standardize the interface basis; the constant package contains the basic return code definition and status definition; The utils package contains tool classes defined in development such as mapping tools, time tools, random tools, and return result tools.
[0066] The service module mainly defines the structure of the service layer, dependency specifications, etc., including: the entity package contains the definition of basic test questions, and defines general information such as time and modification person. Developers can expand business attributes based on this definition; the mapper package contains the basic operations of the database , which encapsulates the behavior of the database; the service package defines the core business interface and its implementation; the generator package defines the program for generating basic code from the database. Running this program directly can automatically generate basic codes such as entity classes, mapping classes, and service classes , the code can be run directly, and developers can also modify it based on this, which can greatly save the development time of developers.
[0067] The front-end controller module mainly defines the structure and specifications of the external interface provided by the system. This module provides service interfaces for terminals, web terminals, mobile terminals, etc. Specifically include: the Config package includes basic authentication of the business, access rights and other security management; the controller package includes specific interface provision and exposure methods; the handler package provides unified exception handling and data conversion tools; AppLauncher provides startup classes, which can be based on this program Start all services.
[0068] In addition, in the default development module, you can also set: pom file; resources directory; Dockerfile, docker-compose; README.md file, etc. specific:
[0069] The pom file defines the version of the system, the version of the dependent library, including springboot, springcloud, javaservlet, compilation plug-in, database driver, template rendering engine, serializer and other versions and dependencies between versions.
[0070] The resources directory defines the basic information of the application, the log generation method and location, etc.
[0071] Dockerfile and docker-compose define cloud-native containerized deployment methods. Developers do not need to care about containerization and deployment, and the system can automatically manage containerization.
[0072] The README.md file defines the description and usage of the system.
[0073] The default development module corresponding to Java enterprise application development is universal and can be applied to most enterprise application development scenarios. In this embodiment, the default development module is also developed by developers based on the general module , service module, front-end controller module, etc. to further set the target component generation mode, define its related descriptors and project name definition methods, etc., so as to complete the construction of the preset development module. Wherein, the generation mode of the target component is used to determine content parameters such as the framework, components, and corresponding versions that the target component depends on in the application system.
[0074] After the developer completes the creation of the preset development module locally, it can be installed and used in the local Java development environment. Specifically, the default development module can be installed in the local Java development environment according to the install command in order to continue to generate Target component, develop the corresponding project.
[0075] 202. Publish the preset development module to the preset database.
[0076] For Java enterprise applications, the development often requires the cooperation of multiple developers. In order to make the target components generated by all developers more standardized, it is necessary to share the preset development module with all developers so that the generated components Has good compatibility. For this reason, in this embodiment, the preset development module created locally by the developer needs to be released to the preset database. In practical applications, the preset development module can be installed in the preset database by executing the deploy command. Wherein, the preset database is a database that all developers can access to obtain preset development modules.
[0077] 203. Determine the identification information of the preset development module according to the generating instruction.
[0078] The identification information in this step at least includes the module name and version number of the preset development module. The identification information can be obtained by parsing the generation instruction, or can be determined according to the content input by the developer.
[0079] It should be noted that there is no necessary logical relationship between this step and the above steps 201 and 202. The above two steps are the process of making and releasing the preset development module by the developer, which is the preparation stage for generating the target component. Starting from this step, for the target component generation phase, all developers generate target components based on the preset development modules created in the above two steps.
[0080] 204. Search locally according to the identification information whether there is a preset development module.
[0081] This step is for a developer who needs to generate the target component. If he has applied the preset development module before, or if the developer is the creator of the preset development module, he can directly call the preset development module locally. A preset development module, and if the developer is using the preset development module for the first time, that is, the preset development module cannot be found locally, perform step 205 to search from the preset database.
[0082] 205. Search for a preset development module from the preset database according to the identification information.
[0083] Since each preset development module is created, it will be released to the preset database. Therefore, when a new developer joins the project and needs to generate target components, he can access the preset database to find the corresponding Preset development modules for generating standardized target components.
[0084]206. Load the preset development module in the local Java development environment to obtain the module to be executed.
[0085] 207. Receive component information of the target component, and add the component information to the module to be executed.
[0086] 208. Generate a target component by executing the module to be executed.
[0087] The content of above steps 206-208 is the same as above figure 1 The contents of steps 102-104 in the embodiment are the same, and will not be repeated here.
[0088] Further, as to the above Figure 1-4 For the realization of the method embodiment shown, the embodiment of the present invention provides a Java component generation device, which is used to realize the rapid construction of an enterprise-level development framework by constructing a standardized Java component, and improve the efficiency of research and development. The embodiment of the device corresponds to the foregoing method embodiment. For the convenience of reading, this embodiment does not repeat the details of the foregoing method embodiment one by one, but it should be clear that the device in this embodiment can correspond to the implementation of the foregoing method. Everything in the example. Specific as image 3 As shown, the device includes:
[0089] The obtaining unit 31 is used to obtain a preset development module according to the generation instruction of the target component, and the preset development module includes at least a general module, a service module, a front-end controller module and the calling relationship between the modules;
[0090] The loading unit 32 is used to load the preset development module obtained by the acquisition unit 31 under the local Java development environment to obtain the module to be executed;
[0091] Adding unit 33, configured to receive component information of the target component, and add the component information to the module to be executed obtained by the loading unit 32;
[0092] The generating unit 34 is configured to generate a target component from the module to be executed obtained by executing the adding unit 33 .
[0093] Further, such as Figure 4 As shown, the acquisition unit 31 includes:
[0094] A determination module 311, configured to determine identification information of a preset development module according to the generation instruction, the identification information at least including a module name and a version number;
[0095] A search module 312, configured to search locally whether the preset development module exists according to the identification information obtained by the determination module 311; if not, search for the preset development module from the preset database according to the identification information .
[0096] Further, such as Figure 4 As shown, the device also includes:
[0097] Creation unit 35 is used to create the preset development module, base package, constant package, utils package are set in the general module, entity package, mapper package, service package, generator package are set in the service module, Set Config package, controller package, handler package in described front controller module;
[0098] The publishing unit 36 is configured to publish the preset development module constructed by the creating unit 35 into the preset database.
[0099] Further, such as Figure 4 As shown, the creation unit 35 includes:
[0100] The setting module 351 is used to set the target component generation mode based on the general module, service module and front-end controller module, and build a preset development module, and the generation mode is used to determine the framework that the target component depends on in the application system , components and corresponding versions;
[0101] The creation module 352 is used to install the preset development module in the local Java development environment according to the install command.
[0102] Further, the creation module 352 is also used to install the preset development module in the preset database according to the deploy command.
[0103] Further, an embodiment of the present invention also provides a processor, the processor is used to run a program, wherein, when the program is running, the above-mentioned Figure 1-2 The generation method of the Java component described in .
[0104] Furthermore, an embodiment of the present invention also provides a storage medium, the storage medium is used to store a computer program, wherein, when the computer program is running, the device where the storage medium is located is controlled to execute the above-mentioned Figure 1-2 The generation method of the Java component described in .
[0105] In the foregoing embodiments, the descriptions of each embodiment have their own emphases, and for parts not described in detail in a certain embodiment, reference may be made to relevant descriptions of other embodiments.
[0106] It can be understood that related features in the above methods and devices can refer to each other. In addition, "first", "second" and so on in the above embodiments are used to distinguish each embodiment, and do not represent the advantages and disadvantages of each embodiment.
[0107] Those skilled in the art can clearly understand that for the convenience and brevity of the description, the specific working process of the above-described system, device and unit can refer to the corresponding process in the foregoing method embodiment, which will not be repeated here.
[0108] The algorithms and displays presented herein are not inherently related to any particular computer, virtual system, or other device. Various generic systems can also be used with the teachings based on this. The structure required to construct such a system is apparent from the above description. Furthermore, the present invention is not specific to any particular programming language. It should be understood that various programming languages can be used to implement the content of the present invention described herein, and the above description of specific languages is for disclosing the best mode of the present invention.
[0109] In addition, memory may include non-permanent storage on computer-readable media, in the form of random access memory (RAM) and/or nonvolatile memory, such as read-only memory (ROM) or flash RAM, including at least one memory chip.
[0110] Those skilled in the art should understand that the embodiments of the present application may be provided as methods, systems, or computer program products. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
[0111] The present application is described with reference to flowcharts and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present application. It should be understood that each procedure and/or block in the flowchart and/or block diagram, and a combination of procedures and/or blocks in the flowchart and/or block diagram can be realized by computer program instructions. These computer program instructions may be provided to a general purpose computer, special purpose computer, embedded processor, or processor of other programmable data processing equipment to produce a machine such that the instructions executed by the processor of the computer or other programmable data processing equipment produce a in real process Figure 1 process or multiple processes and/or boxes Figure 1 means for the function specified in one or more boxes.
[0112] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to operate in a specific manner, such that the instructions stored in the computer-readable memory produce an article of manufacture comprising instruction means, the instructions The device is implemented in the process Figure 1 process or multiple processes and/or boxes Figure 1 function specified in one or more boxes.
[0113] These computer program instructions can also be loaded onto a computer or other programmable data processing device, causing a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, thereby instructions are provided for implementing the flow in Figure 1 process or multiple processes and/or boxes Figure 1 steps of the function specified in the box or boxes.
[0114] In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
[0115] Memory may include non-permanent storage in computer readable media, in the form of random access memory (RAM) and/or nonvolatile memory such as read only memory (ROM) or flash RAM. The memory is an example of a computer readable medium.
[0116] Computer-readable media, including both permanent and non-permanent, removable and non-removable media, can be implemented by any method or technology for storage of information. Information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory (ROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Flash memory or other memory technology, Compact Disc Read-Only Memory (CD-ROM), Digital Versatile Disc (DVD) or other optical storage, Magnetic tape cartridge, tape magnetic disk storage or other magnetic storage device or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media excludes transitory computer-readable media, such as modulated data signals and carrier waves.
[0117] It should also be noted that the term "comprises", "comprises" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article, or apparatus comprising a set of elements includes not only those elements, but also includes Other elements not expressly listed, or elements inherent in the process, method, commodity, or apparatus are also included. Without further limitations, an element defined by the phrase "comprising a ..." does not preclude the presence of additional identical elements in the process, method, article, or apparatus that includes the element.
[0118] Those skilled in the art should understand that the embodiments of the present application may be provided as methods, systems or computer program products. Accordingly, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
[0119] The above are only examples of the present application, and are not intended to limit the present application. For those skilled in the art, various modifications and changes may occur in this application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included within the scope of the claims of the present application.
PUM


Description & Claims & Application Information
We can also present the details of the Description, Claims and Application information to help users get a comprehensive understanding of the technical details of the patent, such as background art, summary of invention, brief description of drawings, description of embodiments, and other original content. On the other hand, users can also determine the specific scope of protection of the technology through the list of claims; as well as understand the changes in the life cycle of the technology with the presentation of the patent timeline. Login to view more.