A data processing method and device based on Spring boot framework

Through Spring boot's starter mechanism and query annotations, the compatibility problem caused by frequent data source switching in data visualization is solved, the isolation and efficient conversion of data sources are achieved, and data processing efficiency is improved.

CN113641700BActive Publication Date: 2025-02-21BEIJING WODONG TIANJUN INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111003667.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-30
Publication Date
2025-02-21
Estimated Expiration
2041-08-30

AI Technical Summary

Technical Problem

During the data visualization process, when using manual spelling code or template generation code to convert data from multiple data sources, frequent switching of data sources may result in incompatible or inconsistent data, which may lead to data display errors.

Method used

Configure different types of data sources through Spring boot's starter mechanism, simplify data source configuration, and generate query statements that are adapted to different data source types through query annotations, thereby realizing data source isolation and data conversion.

Benefits of technology

It improves the reuse rate of code, reduces the workload of manually spelling code, avoids data source conflicts, and improves the conversion efficiency from persistence layer data to report data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113641700B_ABST
    Figure CN113641700B_ABST
Patent Text Reader

Abstract

The present invention discloses a data processing method and device based on Spring boot framework, and relates to the field of computer technology. A specific implementation of the method includes: obtaining a data query request; the data query request indicates the data identifier and data source information in the database to be queried; the data source information in the database to be queried is configured according to the starter mechanism in the Spring boot framework; according to the data query request, a query statement is generated; according to the query statement, the target data corresponding to the data identifier is obtained from the data source corresponding to the data source information. This implementation simplifies the process of configuring the data source, realizes the isolation of different data sources, and thus avoids the problem of data source conflict.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a data processing method and device based on a Spring boot framework. Background Art

[0002] The visualization of data is of great significance for the analysis and adjustment of business.

[0003] Currently, the process of converting persistence layer data into report data is mainly achieved by manually writing codes or using templates to generate codes.

[0004] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art:

[0005] In the data visualization process, when manually spelling codes or template-generated codes are used to transform data from multiple data sources, data sources need to be switched frequently, which may cause data incompatibility or inconsistency, resulting in errors in the visualization of data. Summary of the invention

[0006] In view of this, an embodiment of the present invention provides a data processing method and device based on the Spring boot framework, which can configure different types of data sources through the starter mechanism of Spring boot, simplify the process of configuring data sources, and realize the isolation of different data sources, thereby avoiding the problem of data source conflicts.

[0007] Furthermore, by generating query statements corresponding to different data source types through query annotations, and querying data from multiple data sources according to different query statements, the code reuse rate can be improved, the workload of spelling code can be reduced, and the target data obtained by the query can be quickly converted into data in report format through conversion annotations, thereby improving the conversion efficiency from persistence layer data to report data.

[0008] To achieve the above object, according to a first aspect of an embodiment of the present invention, a data processing method based on a Spring boot framework is provided, comprising:

[0009] Obtain a data query request; the data query request indicates the data identifier and data source information in the database to be queried; the data source information in the database to be queried is configured according to the starter mechanism in the Spring boot framework;

[0010] Generate a query statement according to the data query request;

[0011] According to the query statement, target data corresponding to the data identifier is acquired from the data source corresponding to the data source information.

[0012] Optionally, the method further comprises:

[0013] According to the format required for data visualization, the target data is transformed using a transformation annotation interpreter.

[0014] Optionally, the transforming the target data using a transformation annotation interpreter according to a format required for data visualization includes:

[0015] According to the conversion annotation interpreter, the target data is supplemented so that the supplemented target data is continuous;

[0016] Based on the supplemented target data, the target data is combined into report data in Json format.

[0017] Optionally, the method further comprises:

[0018] Generate a configuration file according to the data source type and data source address information included in the data source information in the database to be queried;

[0019] The configuration file is loaded through starter, links corresponding to one or more data sources in the database to be queried are generated, and the links are placed in the Spring container.

[0020] Optionally, generating a query statement according to the data query request includes:

[0021] By calling an interface configured with a query annotation, the query annotation and parameters corresponding to the interface are obtained; the parameters include a standard SQL statement corresponding to the data identifier;

[0022] According to the data source type contained in the data source information in the database to be queried, the standard SQL statement is converted into a query statement corresponding to the data source type through a query annotation interpreter.

[0023] Optionally, the acquiring the query annotation and parameters corresponding to the interface by calling the interface configured with the query annotation includes:

[0024] By calling the interface, obtaining the proxy class corresponding to the interface returned by the Spring container;

[0025] The query annotation and the parameters are obtained by calling the invoke method of the proxy class.

[0026] Optionally, acquiring target data corresponding to the data identifier from a data source corresponding to the data source information according to the query statement includes:

[0027] By calling the connection class of the Spring container, the query statement is sent to the corresponding data source through the link in the Spring container;

[0028] The target data is acquired from the data source according to the query statement.

[0029] According to a second aspect of an embodiment of the present invention, a data processing device based on a Spring boot framework is provided, comprising: a request acquisition module, a generation module and a data acquisition module; wherein,

[0030] The request acquisition module is used to obtain a data query request; the data query request indicates the data identifier and data source information in the database to be queried; the data source information in the database to be queried is configured according to the starter mechanism in the Springboot framework;

[0031] The generating module is used to generate a query statement according to the data query request;

[0032] The data acquisition module is used to acquire target data corresponding to the data identifier from the data source corresponding to the data source information according to the query statement.

[0033] According to a third aspect of an embodiment of the present invention, there is provided an electronic device, including:

[0034] one or more processors;

[0035] a storage device for storing one or more programs,

[0036] When the one or more programs are executed by the one or more processors, the one or more processors implement any method described in the data processing method based on the Spring boot framework provided in the first aspect above.

[0037] According to a fourth aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, any method described in the data processing method based on the Spring boot framework provided in the first aspect above is implemented.

[0038] An embodiment of the above invention has the following advantages or beneficial effects: different types of data sources can be configured through the starter mechanism of Spring boot, which simplifies the process of configuring data sources and realizes the isolation of different data sources, thereby avoiding the problem of data source conflicts.

[0039] Furthermore, by generating query statements corresponding to different data source types through query annotations, and querying data from multiple data sources according to different query statements, the code reuse rate can be improved, the workload of spelling code can be reduced, and the target data obtained by the query can be quickly converted into data in report format through conversion annotations, thereby improving the conversion efficiency from persistence layer data to report data.

[0040] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0042] Figure 1 It is a flow chart of a data processing method based on Spring boot framework provided by an embodiment of the present invention;

[0043] Figure 2 It is a schematic diagram of a process of data query and conversion provided by an embodiment of the present invention;

[0044] Figure 3 It is a schematic diagram of the configuration process of a custom starter based on Spring Boot provided by an embodiment of the present invention;

[0045] Figure 4 It is a schematic diagram of a process of performing data query through query annotation provided by an embodiment of the present invention;

[0046] Figure 5 It is a structural diagram of a data processing device based on the Spring boot framework provided by an embodiment of the present invention;

[0047] Figure 6 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;

[0048] Figure 7 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0049] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0050] It should be pointed out that the embodiments of the present invention and the technical features therein may be combined with each other without conflict.

[0051] like Figure 1 As shown, an embodiment of the present invention provides a data processing method based on the Spring boot framework, which may include the following steps S101 to S103:

[0052] Step S101: obtaining a data query request; the data query request indicates the data identifier and data source information in the database to be queried; the data source information in the database to be queried is configured according to the starter mechanism in the Spring boot framework.

[0053] In the process of data visualization, the data in the persistence layer needs to be queried before transformation. The data in the persistence layer is usually stored in different data sources. From the data query request, the data identifier and data source information to be queried can be determined.

[0054] It is understandable that the data source information indicated in the data query request provides specific access information about the data source, that is, through the data source information, the data source in the corresponding database can be connected and accessed to perform data queries. In the process of data visualization, the query statement of the database and the access address of the data source, the data source type, the access user and access password of the data source can be directly written in the code. This simple way of integrating data sources is more efficient for one or a few data sources. However, when there are many data sources, it is easy to make mistakes when integrating a large amount of data source information in the code, and there will be more repetitive codes, which is somewhat invasive to the system.

[0055] Therefore, in one embodiment of the present invention, the starter mechanism in the Spring boot-based framework is preferably used to configure the data source in the database. The specific method is as follows: a configuration file is generated according to the data source type and data source address information contained in the data source information in the database to be queried; the configuration file is loaded through the starter to generate links corresponding to one or more data sources in the database to be queried, and the links are placed in the Spring container.

[0056] There may be many data sources in the database to be queried, and these data sources are usually relational databases, but the specific types of databases may be different, such as SQL Server, Oracle, DB2, MySQL, etc. And each data source has its address information, that is, the access information of the data source, including the URL address of the data source, the user and password information when accessing the data source, etc.

[0057] In one possible implementation of the present invention, a starter can be customized according to the principle of the Spring boot framework. According to the configuration specification of the starter, the type of data source and the address information of the data source are generated as the starter configuration file. After the configuration file is loaded by the starter, different data source links are generated for different data sources, and the generated links are placed in the Spring container. In one embodiment of the present invention, the process of automatically configuring the data source through the customized starter can be as follows: Figure 3 As shown in steps S301 to 304.

[0058] It is understandable that when querying data, through the data source links configured by the starter, query statements can be easily sent to different data sources through these links to obtain target data, so that different data sources are independent of each other, thereby isolating the data sources.

[0059] Step S102: Generate a query statement according to the data query request.

[0060] It is understandable that after a data query request is obtained, different query statements need to be determined according to different data source types so as to use these query statements to query data in the corresponding data source.

[0061] For different database types, their SQL query statements are not exactly the same. For example, the database query statements of Mysql and SQLServer are similar, but there are also many differences. Therefore, in order to shield the specific details of the underlying query statements, extract the general query process, and reduce the amount of code duplication, in one embodiment of the present invention, it is preferred to use the annotation mechanism to achieve it, and the method is as follows: by calling an interface configured with query annotations, the query annotations and parameters corresponding to the interface are obtained; the parameters include the standard SQL statement corresponding to the data identifier; according to the data source type included in the data source information in the database to be queried, the standard SQL statement is converted into a query statement corresponding to the data source type through the query annotation interpreter.

[0062] Before querying, you can pre-define a query annotation, create a new interface, and configure the query annotation on the interface, or configure the query annotation on an existing interface in the system. When configuring a query annotation on an interface, you can add a standard SQL statement to the query annotation parameter, which is organized for the data identifier to be queried.

[0063] For example, the current data query request indicates that all data with message_type messageA needs to be queried from a data table, where the data identifier is messageA and the data table is stripe_log_table. The standard SQL statement can be: Select*From Stripe_log_table where message_type='messageA'. If the newly created interface is Test() and the query annotation is @SelectSql(), then this standard SQL statement can be used as a parameter of the query annotation @SelectSql, and the query annotation with the added parameters can be added before the interface, as shown below:

[0064] @SelectSql("Select*From Stripe_log_table where message_type='messageA'")Test().

[0065] Of course, the query annotation can also contain other parameters, such as determining the data identifier to be queried by passing parameters in the standard SQL query statement. For example, the value of message_type can be determined by the variable $messageType, which can be passed to the query annotation by calling the Test() interface. For example, it can be written as follows:

[0066] @SelectSql("Select*From Stripe_log_table where message_type='$messageType'")Test(@SqlParam("messageType")String messageType). @SqlParam("messageType") is the annotation for passing parameters to @SelectSql.

[0067] Before calling the interface, you can also configure the Java package where the query annotation is located in the starter configuration, so that when the starter starts, it will automatically scan the interface in the Java package and generate a dynamic proxy class for the interface configured with the query annotation. The configuration process can be as follows Figure 3 As shown in steps S305 to S308.

[0068] When calling the interface, one possible implementation of the present invention is: by calling the interface, the proxy class corresponding to the interface returned by the Spring container is obtained; by calling the invoke method of the proxy class, the query annotation and the parameters are obtained.

[0069] For example, when calling the Test() interface, the Spring container returns the dynamic proxy class P corresponding to the Test() interface generated based on the starter configuration. By calling the invoke() method in the dynamic proxy class P, the query annotation @SelectSql configured on the Test() interface and the parameters in the query annotation, that is, the standard SQL statement, are obtained.

[0070] After obtaining the standard SQL statement, one possible implementation of the present invention is: according to the data source type contained in the data source information in the database to be queried, the standard SQL statement is converted into a query statement corresponding to the data source type through a query annotation interpreter.

[0071] The query annotation interpreter can convert the standard SQL statements contained in the query annotation parameters into native query statements corresponding to the data source type according to the different data source types configured in the starter. For example, for a MySQL data source, it is converted into a query statement that conforms to the MySQL query syntax, and for a SQLServer data source, it is converted into a query statement that conforms to the SQLServer query syntax.

[0072] It is understandable that by extracting the common query process into the query annotation and generating corresponding query statements for different data source types through the query annotation interpreter, the amount of repetitive code can be reduced. Moreover, the query annotation interpreter can be compatible with different types of commonly used data sources. When a new data query request is added, the query annotation interpreter can make fewer changes to adapt to different data source types, saving the time of modifying the code due to different data sources.

[0073] Step S103: acquiring target data corresponding to the data identifier from a data source corresponding to the data source information according to the query statement.

[0074] After the query language corresponding to the data source type is generated by the query annotation interpreter, the query statement can be sent to the data source for query to obtain the target data. In one embodiment of the present invention, the following method can be adopted: by calling the connection class in the Spring container, the query statement is sent to the corresponding data source through the link in the Spring container; and the target data is obtained from the data source according to the query statement.

[0075] The connection class in the Spring container is loaded into the Spring container when the data source is configured through the starter. By calling this connection class, the query statements corresponding to the generated different types of data sources can be sent to different types of data sources. For example, the Mysql query statement is sent to the Mysql data source in the database, and the SQLServer query statement is sent to the SQLServer data source in the database. In this way, the target data can be queried from different data sources through these query statements.

[0076] After obtaining the target data, the target data can be stored in memory so that it can be provided to the transformation annotation later.

[0077] It is understandable that through query annotations and query annotation interpreters, when a new data query request is added, the standard SQL statement in the existing query annotation can be modified into a standard SQL query statement for the newly added data identifier, or a new query annotation can be added and the standard SQL statement corresponding to the newly added data identifier can be written in the parameters, thereby completing the purpose of querying the new target data. This can greatly save the time of rewriting code and improve the efficiency of data visualization.

[0078] After obtaining the target data from multiple data sources, the target data needs to be converted into the format required for data visualization, that is, converted into report data, so that specific report graphics can be generated based on the report data, such as line charts, bar charts, pie charts, etc.

[0079] When transforming the target data, an embodiment of the present invention preferably uses an annotation mechanism to transform the data, which can be done in the following manner: according to the format required for data visualization, the target data is transformed using a transformation annotation interpreter.

[0080] Among them, the conversion annotation interpreter can convert the data obtained by the conversion annotation to obtain report data. The conversion annotation interpreter has a universal data processing flow, is compatible with a variety of report data formats, and is suitable for data conversion of most common data sources. It is understandable that when adding a request for data visualization, the conversion annotation interpreter can convert the data into the required report data format without making too many changes, saving a lot of time for manual spelling of codes, achieving the purpose of quickly responding to and converting report data, thereby improving the conversion efficiency of report data.

[0081] The specific method of using the conversion annotation interpreter to convert the target data can be provided as in one embodiment of the present invention, including: according to the conversion annotation interpreter, supplementing the target data so that the supplemented target data is continuous; based on the supplemented target data, combining the target data into report data in Json format.

[0082] After the target data is stored in the memory, the transformation annotation uses the reflection mechanism to read the data from the target data stored in the memory, and then the transformation annotation interpreter puts the data into the corresponding collection to facilitate the transformation. For example, the data read by the transformation annotation @X is put into the collection x, the data read by the transformation annotation @Y is put into the collection y, and the data read by the transformation annotation @Data is put into the collection z. In this way, the data collection can be corresponded according to the coordinate axis of the generated line chart. For example, the data of the X coordinate axis is in the x collection, the data of the Y coordinate axis is in the y collection, and the specific data of the points corresponding to the XY coordinate axis is in the collection z.

[0083] In set z, the key of the data is X'-Y', and the values ​​of X' and Y' in the key may already be in both sets x and y, or one of them may be in the existing set x or y, or neither of them may be in sets x and y. That is to say, combined with the data in set z, there are four possible situations: for data Z1 in set z, its corresponding key is (X'1-Y'1), X'1 in the key is in set x, and Y'1 is in set y; for data Z2, its corresponding key is (X'2-Y'2), X'2 in the key is in set x, and Y'2 is not in set y; for data Z3, its corresponding key is (X'3-Y'3), X'3 in the key is not in set x, and Y'3 is in set y; for data Z4, its corresponding key is (X'4-Y'4), X'4 in the key is not in set x, and Y'4 is not in set y.

[0084] Then, in order to make the data of the X and Y coordinate axes correspond one-to-one with the data in the z set, the X' value in the key of the z set data that is not in the set x can be added to the corresponding x set; the Y' value in the key of the z set data that is not in the set y can be added to the corresponding y set.

[0085] For continuous coordinate axis data, you can also supplement the missing continuous values ​​in the coordinate set to make the coordinate axis data continuous. For example, if the Y axis is the time axis and the data in the current set y is July 1, July 3, and July 5, you can supplement the data that is not in the set, such as July 2 and July 4, to make the time data of the coordinate axis Y continuous.

[0086] According to the supplemented data sets x, y, and z, the data in the sets are combined into report data in Json format for use in generating visual report graphics.

[0087] According to an embodiment of the present invention, a data processing method based on the Spring boot framework is provided, which can configure different types of data sources through the starter mechanism of Spring boot, simplifies the process of configuring data sources, and realizes the isolation of different data sources, thereby avoiding the problem of data source conflicts.

[0088] Furthermore, by generating query statements corresponding to different data source types through query annotations, and querying data from multiple data sources according to different query statements, the code reuse rate can be improved, the workload of spelling code can be reduced, and the target data obtained by the query can be quickly converted into data in report format through conversion annotations, thereby improving the conversion efficiency from persistence layer data to report data.

[0089] Figure 2 This is a flow chart of data query and conversion provided by an embodiment of the present invention. The specific steps are as follows:

[0090] Step S201: Obtain query annotations.

[0091] Get the query annotation and parameters by calling the interface configured with the query annotation.

[0092] Step S202: Generate a query statement by querying the annotation interpreter.

[0093] The query annotation interpreter converts the standard SQL statement contained in the query annotation into a query statement corresponding to the data source type.

[0094] Step S203: Send the query statement to the data source.

[0095] The query statements are sent to different types of data sources through the links in the Spring container configured by the starter.

[0096] Step S204: Obtain target data from the data source through a query statement.

[0097] After obtaining the target data, the target data is stored in the memory.

[0098] Step S205: Read the target data through the conversion annotation.

[0099] The reflection mechanism is used to obtain the data corresponding to the transformation annotation from the target data in the memory through the transformation annotation.

[0100] Step S206: Generate report data by converting the annotation interpreter.

[0101] The data obtained by the conversion annotation is supplemented by the conversion annotation interpreter, and the data is combined into report data in Json format. The generated report data can be sent to the interface for generating report graphics to generate charts.

[0102] like Figure 3 As shown, an embodiment of the present invention provides a flow chart of a custom starter configuration data source and a dynamic proxy configuration interface in a data processing method based on a Spring boot framework.

[0103] The specific steps of configuring the data source may be S301 to S304:

[0104] Step S301: Write the data source information into the configuration file corresponding to the custom bean.

[0105] The data source information includes the type of data source, the URL address of the data source, and the user and password information of the data source.

[0106] Step S302: Determine whether the conditions for creating a bean are met.

[0107] Step S303: Load the custom bean.

[0108] Step S304: Load the corresponding configuration file, generate different links according to the data source type, and put them into the Spring container.

[0109] Load the configuration file of the data source corresponding to the bean, generate different data source links according to the different data source types, and put these links into the Spring container.

[0110] The specific steps of configuring the dynamic proxy of the interface may be S305 to S308:

[0111] Step S305: configure the Java package where the query annotation is located.

[0112] There can be multiple query annotations, and the path of the package where the query annotations are located is written into the starter configuration file.

[0113] Step S306: Import the query annotation scanner.

[0114] Step S307: Scan the interface according to the Java package where the annotation is located.

[0115] The scanner in step S306 is used to scan the interfaces in the Java package to obtain interfaces configured with query annotations.

[0116] Step S308: Generate a dynamic proxy class corresponding to the interface, and put the dynamic proxy class into beanDefinition.

[0117] After configuring the query annotation interface dynamic proxy class, the subsequent process of Spring can instantiate the bean according to beanDefinition, and then return the corresponding dynamic proxy class through the instantiated bean in the Spring container during the interface call process, use the method in the dynamic proxy class to obtain the standard SQL statement in the query annotation parameter, and generate query statements corresponding to different data source types through the query annotation interpreter to query data from different data sources. The specific process can be as follows: Figure 4 shown.

[0118] Figure 4 This is a flow chart of data query in a data processing method based on the Spring boot framework provided by an embodiment of the present invention. The specific steps may be as follows:

[0119] Step S401: During runtime, call the interface configured with the query annotation.

[0120] Step S402: The Spring container returns a dynamic proxy class.

[0121] The Spring container returns the dynamic proxy class corresponding to the interface configured by the starter.

[0122] Step S403: calling the invoke method in the dynamic proxy class.

[0123] Step S404: Obtain query annotations and parameters.

[0124] Through the invoke method and reflection mechanism, you can obtain the query annotations and parameters on the interface.

[0125] Step S405: Generate different query statements according to the query annotation interpreter.

[0126] The standard SQL statements contained in the query annotation parameters are converted into native query statements corresponding to different data source types.

[0127] Step S406: Call the connection class in the Spring container.

[0128] The connection class in the Spring container is loaded into the Spring container when the starter configures the data source. Through the connection class, these native query statements can be sent to different data sources through the links in the Spring container, thereby querying the target data from different data sources.

[0129] Step S407: Get the query result and return it.

[0130] Get the target data queried from different data sources and return the result to the invoke method of the proxy class, so that the target data is returned and stored in the memory.

[0131] like Figure 5 As shown, the embodiment of the present invention provides a data processing device 500 based on the Spring boot framework, including: a request acquisition module 501, a generation module 502 and a data acquisition module 503; wherein,

[0132] The request acquisition module 501 is used to acquire a data query request; the data query request indicates the data identifier and data source information in the database to be queried; the data source information in the database to be queried is configured according to the starter mechanism in the Springboot framework;

[0133] The generating module 502 is used to generate a query statement according to the data query request;

[0134] The data acquisition module 503 is used to acquire target data corresponding to the data identifier from the data source corresponding to the data source information according to the query statement.

[0135] In one embodiment of the present invention, the request acquisition module 501 is used to generate a configuration file based on the data source type and data source address information contained in the data source information in the database to be queried; load the configuration file through the starter, generate links corresponding to one or more data sources in the database to be queried, and place the links in the Spring container.

[0136] In one embodiment of the present invention, the generation module 502 is used to obtain the query annotation and parameters corresponding to the interface by calling the interface configured with the query annotation; the parameters include the standard SQL statement corresponding to the data identifier; according to the data source type included in the data source information in the database to be queried, the standard SQL statement is converted into a query statement corresponding to the data source type through the query annotation interpreter.

[0137] In one embodiment of the present invention, the generation module 502 is used to obtain the proxy class corresponding to the interface returned by the Spring container by calling the interface; and obtain the query annotation and the parameters by calling the invoke method of the proxy class.

[0138] In one embodiment of the present invention, the data acquisition module 503 is used to send the query statement to the corresponding data source through the link in the Spring container by calling the connection class in the Spring container; and acquire the target data from the data source according to the query statement.

[0139] In one embodiment of the present invention, the data acquisition module 503 is used to transform the target data using a transformation annotation interpreter according to a format required for data visualization.

[0140] In one embodiment of the present invention, the data acquisition module 503 is used to supplement the target data according to the conversion annotation interpreter so that the supplemented target data is continuous; based on the supplemented target data, the target data is combined into report data in Json format.

[0141] According to an embodiment of the present invention, a data processing device based on the Spring boot framework is provided, which can configure different types of data sources through the starter mechanism of Spring boot, simplifies the process of configuring data sources, and realizes the isolation of different data sources, thereby avoiding the problem of data source conflicts.

[0142] Furthermore, by generating query statements corresponding to different data source types through query annotations, and querying data from multiple data sources according to different query statements, the code reuse rate can be improved, the workload of spelling code can be reduced, and the target data obtained by the query can be quickly converted into data in report format through conversion annotations, thereby improving the conversion efficiency from persistence layer data to report data.

[0143] Figure 6 An exemplary system architecture 600 of a data processing method and device based on a Spring boot framework to which an embodiment of the present invention can be applied is provided.

[0144] like Figure 6 As shown in FIG. 6 , the system architecture 600 may include terminal devices 601, 602, 603, a network 604, and a server 605. The network 604 is used to provide a medium for communication links between the terminal devices 601, 602, 603 and the server 605. The network 604 may include various connection types, such as wired, wireless communication links, or optical fiber cables.

[0145] Users can use terminal devices 601, 602, 603 to interact with server 605 through network 604 to receive or send messages, etc.

[0146] The terminal devices 601 , 602 , and 603 may be various electronic devices having a display screen and supporting information browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.

[0147] The server 605 may be a server that provides various services, such as a background management server that provides support for data query requests made by users using the terminal devices 601, 602, and 603. The background management server may analyze and process the received data such as the data query request, and feed back the processing results to the terminal device.

[0148] It should be noted that the data processing method based on the Spring boot framework provided in the embodiment of the present invention is generally executed by the server 605 , and accordingly, the data processing device based on the Spring boot framework is generally arranged in the server 605 .

[0149] It should be understood that Figure 6 The number of terminal devices, networks and servers shown is only for illustration purposes. Any number of terminal devices, networks and servers may be provided as required.

[0150] Reference below Figure 7 , which shows a schematic diagram of the structure of a computer system 700 of a terminal device suitable for implementing an embodiment of the present invention. Figure 7 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0151] like Figure 7 As shown in FIG. 7 , the computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage part 708 into a random access memory (RAM) 703. Various programs and data required for the operation of the system 700 are also stored in the RAM 703. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0152] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive Z10 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed, so that a computer program read therefrom is installed into the storage section 708 as needed.

[0153] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 709, and / or installed from the removable medium 711. When the computer program is executed by the central processing unit (CPU) 701, the above-mentioned functions defined in the system of the present invention are executed.

[0154] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0155] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0156] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be set in a processor, for example, it may be described as: a processor includes an acquisition module, a generation module, and a determination module. The names of these modules do not constitute a limitation on the modules themselves in some cases, for example, the acquisition module may also be described as a "module for acquiring requests".

[0157] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: obtaining a data query request; the data query request indicates the data identifier and data source information in the database to be queried; the data source information in the database to be queried is configured according to the starter mechanism in the Spring boot framework; according to the data query request, a query statement is generated; according to the query statement, the target data corresponding to the data identifier is obtained from the data source corresponding to the data source information.

[0158] According to the technical solution of the embodiment of the present invention, different types of data sources can be configured through the starter mechanism of Spring boot, which simplifies the process of configuring data sources and realizes the isolation of different data sources, thereby avoiding the problem of data source conflicts.

[0159] Furthermore, by generating query statements corresponding to different data source types through query annotations, and querying data from multiple data sources according to different query statements, the code reuse rate can be improved, the workload of spelling code can be reduced, and the target data obtained by the query can be quickly converted into data in report format through conversion annotations, thereby improving the conversion efficiency from persistence layer data to report data.

[0160] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A data processing method based on Spring boot framework, characterized in that: include: Obtaining a data query request; the data query request indicates the data identifier and data source information in the database to be queried; The data source information in the database to be queried is configured according to the starter mechanism in the Spring boot framework; By calling an interface configured with a query annotation, the query annotation and parameters corresponding to the interface are obtained; the parameters include a standard SQL statement corresponding to the data identifier; According to the data source type contained in the data source information in the database to be queried, the standard SQL statement is converted into a query statement corresponding to the data source type through a query annotation interpreter; According to the query statement, target data corresponding to the data identifier is acquired from a data source corresponding to the data source information.

2. The method according to claim 1, characterized in that Also includes: According to the format required for data visualization, the target data is transformed using a transformation annotation interpreter.

3. The method according to claim 2, characterized in that The step of transforming the target data using a transformation annotation interpreter according to a format required for data visualization includes: According to the conversion annotation interpreter, the target data is supplemented so that the supplemented target data is continuous; Based on the supplemented target data, the target data is combined into report data in Json format.

4. The method according to claim 1, characterized in that: Also includes: Generate a configuration file according to the data source type and data source address information included in the data source information in the database to be queried; The configuration file is loaded through starter, links corresponding to one or more data sources in the database to be queried are generated, and the links are placed in the Spring container.

5. The method according to claim 1, characterized in that The step of acquiring the query annotation and parameters corresponding to the interface by calling the interface configured with the query annotation includes: By calling the interface, obtaining the proxy class corresponding to the interface returned by the Spring container; The query annotation and the parameters are obtained by calling the invoke method of the proxy class.

6. The method according to claim 4, characterized in that The acquiring, according to the query statement, target data corresponding to the data identifier from a data source corresponding to the data source information comprises: By calling the connection class in the Spring container, the query statement is sent to the corresponding data source through the link in the Spring container; The target data is acquired from the data source according to the query statement.

7. A data processing device based on Spring boot framework, characterized in that: include: Request acquisition module, generation module and data acquisition module; wherein, The request acquisition module is used to acquire a data query request; the data query request indicates the data identifier and data source information in the database to be queried; the data source information in the database to be queried is configured according to the starter mechanism in the Spring boot framework; The generating module is used to generate a query statement according to the data query request; The data acquisition module is used to acquire target data corresponding to the data identifier from the data source corresponding to the data source information according to the query statement; The generation module is also used for: By calling an interface configured with a query annotation, the query annotation and parameters corresponding to the interface are obtained; the parameters include a standard SQL statement corresponding to the data identifier; According to the data source type contained in the data source information in the database to be queried, the standard SQL statement is converted into a query statement corresponding to the data source type through a query annotation interpreter.

8. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6.

9. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Dynamic api visualization generation method based on spring boot framework

    CN112685032A

  • Data query method and device, electronic equipment and machine readable storage medium

    CN113094387A