A query method and system for statically analyzing the impact of changes in the spring framework
By constructing java syntax tree, spring relationship tree and mybatis relationship tree, we can quickly and comprehensively query the impact scope of code changes, solve the problem of inaccurate impact assessment after software code changes, and achieve a more stable and reliable test plan.
Patent Information
- Application Number
- CN202411125980.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-16
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2044-08-16
AI Technical Summary
After software code changes are made, developers have difficulty accurately assessing the scope of their impact on other parts of the software, leading to inaccurate testing and improper planning.
By constructing the Java syntax tree, spring relationship tree and mybatis relationship tree, we can quickly and comprehensively query the impact scope of code changes, determine the affected method nodes and calling relationships, and form a change impact structure.
Improved accuracy in evaluating test scenarios and computer analysis rates of affected areas, ensuring effective test plans are developed.
Smart Images

Figure CN118643125B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a query method and system for statically analyzing a change impact surface in a spring framework. Background Art
[0002] As modern software technology develops towards large-scale and complex development, accompanied by the high-paced business iteration requirements, the current software functions are constantly increasing and the complexity is increasing, and the amount of software code is constantly increasing. In order to upgrade software services and fix vulnerabilities, in many scenarios, R&D personnel need to change the existing code. However, as the software itself becomes more and more complex, and many codes also hide the relationship between calls and calls, R&D personnel cannot be sure whether the changed content will affect other parts of the software after modifying the code. In order to accurately evaluate the test scenario, testers need to determine the scope of impact after the code is changed, so as to formulate an effective test plan based on the scope of impact. Summary of the invention
[0003] The purpose of the present invention is to provide a query method and system for statically analyzing the impact of changes in a spring framework. The query method can quickly and comprehensively query the impact range of the changed content through the corresponding java syntax tree, spring relationship tree and mybatis relationship tree, thereby ensuring the accuracy of the evaluation test scenario, thereby formulating an effective test plan.
[0004] In order to solve the above technical problems, the present invention adopts the following solutions:
[0005] A query method for statically analyzing the impact of changes in a spring framework, characterized in that the method specifically includes the following steps:
[0006] S0: Obtain the Java syntax tree, Spring relationship tree and MyBatis relationship tree corresponding to the current query item; the Java syntax tree is a tree structure composed of several method nodes, and the Spring relationship tree is a tree structure composed of several method nodes to be called;
[0007] S1: Get the name of the currently changed table corresponding to the current item to be queried, and query the current change method name and current change category name corresponding to the currently changed table name in the mybatis relationship tree according to the currently changed table name;
[0008] S2: recursively query the Java syntax tree according to the relationship between the current changed method name and the current changed category name and the method node, and query several currently affected method nodes;
[0009] S3: extracting a method block from the currently affected method node, and determining whether the method block contains a calling method name, and if so, recording the currently affected method node as the current calling method node;
[0010] S4: query the spring relationship tree according to the relationship between the current calling method node and the method node to be called, and query the method node to be called associated with the current calling method node;
[0011] S5: forming a corresponding change impact structure according to a number of currently affected method nodes and a to-be-called method node associated with the currently called method node.
[0012] Furthermore, in S0, the specific process of obtaining the Java syntax tree, spring relationship tree and mybatis relationship tree corresponding to the current query item is:
[0013] Parse the code, spring framework configuration, and mybatis framework configuration in the current project to be queried respectively, and then get the corresponding java code, spring framework configuration, and mybatis framework configuration;
[0014] Then, generate the corresponding Java syntax tree according to the Java code; generate the corresponding Spring relationship tree according to the Java code and the Spring framework configuration; generate the corresponding Mybatis relationship tree according to the Java code and the Mybatis framework configuration.
[0015] Further, in S4, the current calling method node includes a first category name and a calling method name, the to-be-called method node includes a second category name, and the calling method name contained in the method block in the to-be-called method node associated with the current calling method node is consistent with the second category name.
[0016] Further, the mybatis relationship tree is a tree structure composed of several associated method nodes, and an associated method node includes a third category name, a third method name and a corresponding table name; then in S1, the specific process of querying the current change method name and the current change category name corresponding to the current changed table name in the mybatis relationship tree according to the current changed table name is:
[0017] The table name of the current change is matched with the table name in the associated method node for consistency. If the two are consistent, that is, the table name in the associated method node is the table name of the current change, then the corresponding third method name and third category name in the associated method node are respectively used as the current change method name and current change category name corresponding to the table name of the current change.
[0018] Further, the method node is a method node including a method block, a first category name and a first method name, or a method node including a first category name and a first method name, the method block includes a calling method name and a calling category name, and the method node including a method block, a first category name and a first method name indicates that the method node needs to rely on the method corresponding to the calling method name and the calling category name in the method block to be implemented.
[0019] Furthermore, in S2, the specific process of the recursive query is as follows:
[0020] SA1: Get the first class name and the first method name corresponding to the method node;
[0021] SA2: Match the current change method name and the current change category name with the corresponding first method name and first category name in the method node respectively. If the two are consistent, that is, the first method name and the first category name in the method node are the current change method name and the current change category name respectively, then the method node is taken as the first change node, and then go to step SA3;
[0022] SA3: Update the current change method name and the current change category name with the first method name and the first category name in the first change node, and go to step SA4;
[0023] SA4: Match the current change method name and the current change category name with the corresponding calling method name and calling category name in the method nodes other than the first change node. If the two are consistent, that is, the calling method name and calling category name in the method node are the current change method name and the current change category name, respectively, then take the method node as the current change node, and then go to step SA5;
[0024] SA5: Update the current changed method name and the current changed category name with the first method name and the first category name in the current changed node, and go to step SA4 until the recursive query ends.
[0025] Furthermore, the first method name is used to indicate that the method node executes the method corresponding to the first method name, and the calling method name is used to indicate that the method node relies on the method configuration associated with the calling method name to execute the method corresponding to the first method name.
[0026] Furthermore, in S5, the specific process of forming a corresponding change impact structure according to a number of currently affected method nodes and the method nodes to be called associated with the currently called method node is as follows:
[0027] A result tree consisting of several currently affected method nodes and to-be-called method nodes associated with the currently called method node is generated according to the change queue, and the corresponding to-be-called method nodes in the result tree are associated with the currently called method node to form a change impact structure.
[0028] A query system for statically analyzing the impact of changes in the Spring framework, including:
[0029] Configuration module: used to obtain the Java syntax tree, Spring relationship tree and Mybatis relationship tree corresponding to the current query item; the Java syntax tree is a tree structure composed of several method nodes, and the Spring relationship tree is a tree structure composed of several method nodes to be called;
[0030] Method change information acquisition module: used to obtain the table name of the current change corresponding to the current item to be queried, and query the current change method name and current change category name corresponding to the current change table name in the mybatis relationship tree according to the current change table name;
[0031] Recursive query module based on Java syntax tree: used to perform recursive query in Java syntax tree according to the relationship between the current changed method name and the current changed category name and method node, and query several currently affected method nodes;
[0032] Method node judgment module: used to extract the method block of the currently affected method node and judge whether the method block contains the calling method name. If so, the currently affected method node is recorded as the current calling method node;
[0033] Method query module based on mybatis relationship tree: used to query in the spring relationship tree according to the relationship between the current calling method node and the method node to be called, and query the method node to be called associated with the current calling method node;
[0034] Change impact structure generation module: used to form a corresponding change impact structure according to a number of currently affected method nodes and a to-be-called method node associated with a currently called method node.
[0035] Beneficial effects of the present invention:
[0036] The present invention provides a query method and system for statically analyzing the impact of changes in a spring framework, which mainly uses the association between a java syntax tree, a spring relationship tree and a mybatis relationship tree to quickly and comprehensively query the impact range caused by the changed content. The existing technical means generally rely on the experience of developers to evaluate the impact or can only analyze the impact of java code changes, but cannot analyze the impact of mybatis and spring framework configuration changes. The present invention provides a fast and comprehensive query method for the calling relationship generated between mybatis and spring framework configurations and java codes, which solves the unreliability of relying on the experience of developers to judge the impact. At the same time, it improves the impact of mybatis and spring framework configuration changes. The fast and comprehensive query method makes the analysis of the impact of changes more comprehensive, more stable and more reliable, so as to ensure the accuracy of evaluating test scenarios, thereby making it possible to formulate effective test plans. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 The present invention is a flowchart of a query method for statically analyzing the change impact surface in a spring framework in Example 1 of the present invention.
[0038] Figure 2 This is a query diagram after the tester changes the table in Example 1 of the present invention.
[0039] Figure 3 This is a schematic diagram of the query method after the tester changes the method in Example 1 of the present invention. DETAILED DESCRIPTION
[0040] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. The following description of at least one exemplary embodiment is actually only illustrative and is by no means intended to limit the present invention and its application or use. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0041] The relative arrangement of components and steps, the numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present invention unless specifically stated otherwise.
[0042] At the same time, it should be understood that for the convenience of description, the sizes of the various parts shown in the drawings are not drawn according to the actual proportional relationship.
[0043] Additionally, descriptions of well-known structures, functions, and configurations may be omitted for clarity and conciseness.One of ordinary skill in the art will recognize that various changes and modifications may be made to the examples described herein without departing from the spirit and scope of the present disclosure.
[0044] Technologies, methods, and apparatus known to ordinary technicians in the relevant field may not be discussed in detail, but where appropriate, such technologies, methods, and apparatus should be considered part of the authorization specification.
[0045] In all examples shown and discussed herein, any specific values should be interpreted as merely exemplary and not as limiting. Therefore, other examples of the exemplary embodiments may have different values.
[0046] The present invention will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments:
[0047] Example 1
[0048] like Figure 1 As shown, a query method for statically analyzing the change impact surface in the spring framework is characterized in that the method specifically includes the following steps:
[0049] S0: Obtain the Java syntax tree, Spring relationship tree and MyBatis relationship tree corresponding to the current query item; the Java syntax tree is a tree structure composed of several method nodes, and the Spring relationship tree is a tree structure composed of several method nodes to be called;
[0050] S1: Get the name of the currently changed table corresponding to the current item to be queried, and query the current change method name and current change category name corresponding to the currently changed table name in the mybatis relationship tree according to the currently changed table name;
[0051] S2: recursively query the Java syntax tree according to the relationship between the current changed method name and the current changed category name and the method node, and query several currently affected method nodes;
[0052] S3: extracting a method block from the currently affected method node, and determining whether the method block contains a calling method name, and if so, recording the currently affected method node as the current calling method node;
[0053] S4: query the spring relationship tree according to the relationship between the current calling method node and the method node to be called, and query the method node to be called associated with the current calling method node;
[0054] S5: forming a corresponding change impact structure according to a number of currently affected method nodes and a to-be-called method node associated with the currently called method node.
[0055] Preferably, in S0, the specific process of obtaining the Java syntax tree, the Spring relationship tree, and the MyBatis relationship tree corresponding to the current query item is:
[0056] Parse the code, spring framework configuration, and mybatis framework configuration in the current project to be queried respectively, and then get the corresponding java code, spring framework configuration, and mybatis framework configuration;
[0057] Then, generate the corresponding Java syntax tree according to the Java code; generate the corresponding Spring relationship tree according to the Java code and the Spring framework configuration; generate the corresponding Mybatis relationship tree according to the Java code and the Mybatis framework configuration.
[0058] Preferably, in S4, the currently calling method node includes a first category name and a calling method name, the to-be-called method node includes a second category name, and the calling method name contained in the method block in the to-be-called method node associated with the currently calling method node is consistent with the second category name.
[0059] Preferably, the mybatis relationship tree is a tree structure composed of several associated method nodes, and an associated method node includes a third category name, a third method name and a corresponding table name; then in S1, the specific process of querying the current change method name and the current change category name corresponding to the current changed table name in the mybatis relationship tree according to the currently changed table name is:
[0060] The table name of the current change is matched with the table name in the associated method node for consistency. If the two are consistent, that is, the table name in the associated method node is the table name of the current change, then the corresponding third method name and third category name in the associated method node are respectively used as the current change method name and current change category name corresponding to the table name of the current change.
[0061] Preferably, the method node is a method node including a method block, a first category name and a first method name, or a method node including a first category name and a first method name, the method block includes a calling method name and a calling category name, and the method node including a method block, a first category name and a first method name indicates that the method node needs to rely on the method corresponding to the calling method name and the calling category name in the method block to be implemented.
[0062] Preferably, in S2, the specific process of the recursive query is as follows:
[0063] SA1: Get the first class name and the first method name corresponding to the method node;
[0064] SA2: Match the current change method name and the current change category name with the corresponding first method name and first category name in the method node respectively. If the two are consistent, that is, the first method name and the first category name in the method node are the current change method name and the current change category name respectively, then the method node is taken as the first change node, and then go to step SA3;
[0065] SA3: Update the current change method name and the current change category name with the first method name and the first category name in the first change node, and go to step SA4;
[0066] SA4: Match the current change method name and the current change category name with the corresponding calling method name and calling category name in the method nodes other than the first change node. If the two are consistent, that is, the calling method name and calling category name in the method node are the current change method name and the current change category name, respectively, then take the method node as the current change node, and then go to step SA5;
[0067] SA5: Update the current changed method name and the current changed category name with the first method name and the first category name in the current changed node, and go to step SA4 until the recursive query ends.
[0068] Preferably, the first method name is used to indicate that the method node executes the method corresponding to the first method name, and the calling method name is used to indicate that the method node relies on the method configuration associated with the calling method name to execute the method corresponding to the first method name.
[0069] Preferably, in S5, the specific process of forming a corresponding change impact structure according to a number of currently affected method nodes and the to-be-called method nodes associated with the currently called method node is:
[0070] A result tree consisting of several currently affected method nodes and to-be-called method nodes associated with the currently called method node is generated according to the change queue, and the corresponding to-be-called method nodes in the result tree are associated with the currently called method node to form a change impact structure.
[0071] Based on the above principles, the present invention is further described:
[0072] In order to solve the problem that testers cannot quickly and comprehensively analyze the impact scope of changes after changing the code, the present invention provides a query method for statically analyzing the impact surface of changes in a spring framework. The query method uses a java syntax tree, a spring relationship tree, and a mybatis relationship tree corresponding to the current item to be queried to determine the affected scope. The accuracy of the obtained affected scope can be guaranteed by performing a comprehensive query on the java syntax tree, the spring relationship tree, and the mybatis relationship tree. In addition, there is a calling relationship between the java syntax tree, the spring relationship tree, and the mybatis relationship tree. The affected scope can also be quickly determined through the calling relationship between the three, which not only ensures the accuracy of the evaluation test scenario, but also improves the computer's analysis rate of the affected scope, thereby formulating an effective test plan.
[0073] In this embodiment, when a query method for statically analyzing the impact of changes in a spring framework provided by the present invention is used to comprehensively query the changed code in a project, first, it is necessary to obtain the java syntax tree, spring relationship tree, and mybatis relationship tree corresponding to the current project to be queried, and there is a calling relationship between the java syntax tree, spring relationship tree, and mybatis relationship tree corresponding to a project, and the correlation between the three is represented by the calling relationship, thereby facilitating testers to quickly analyze the impact of the changed code.
[0074] Specifically, the code in the current project to be queried is parsed, and the Java code in the current project to be queried is parsed to represent a process in which a user queries login information data:
[0075] Step 1: Request the list method of SysLoginInforController;
[0076] Step 2: In the list method, the selectAllLoginInforList method of SysLoginInforService is called;
[0077] Step 3: In the selectAllLoginInforList method, the selectlist method of SysLoginInforMapper is called to query all data;
[0078] The Java code is composed of the login information query entry class, the login information query business class and the database query data, as shown below:
[0079] 1. Query login information entry class
[0080] public class SysLoginInforController{
[0081] private SysLoginInforService SysLoginInforService;
[0082] public List list(){
[0083] return SysLoginInforServic.selelctAllLoginInforList();
[0084] }
[0085] };
[0086] 2. Query login information business class
[0087] public class SysLoginInforService{
[0088] @Autowired
[0089] private SysLoginInforMapper sysLoginInforMapper;
[0090] public List selelctAllLoginInforList(){
[0091] return SysLoginInforMapper.sellctList();
[0092] }
[0093] };
[0094] 3. Query database data
[0095] Public interface SysLoginInforMapper{
[0096] List selectList();
[0097] };
[0098] In addition, the spring framework configuration in the current project to be queried is parsed to obtain the spring framework configuration in the current project to be queried, as shown below:
[0099] Business class spring configuration:
[0100] <bean id="”sysLoginInforService”" class="”SysLoginInforService”">< / bean>
[0101] Business documents:
[0102] public class SysLoginInforService{
[0103] @Autowired
[0104] private SysLoginInforMapper sysLoginInforMapper;
[0105] public List selelctAllLoginInforList(){
[0106] return SysLoginInforMapper.sellctList();
[0107] }
[0108] };
[0109] In addition, the mybatis framework configuration in the current project to be queried is parsed to obtain the mybatis framework configuration in the current project to be queried, as shown below:
[0110] <?xml version=”1.0” encoding=”UTF-8”?>
[0111] <mapper namespace="”" syslogininformapper”>
[0112] <select id="”selectList”resultType=”" syslogininfor”>
[0113] Selece*from sys_logininfor
[0114] < / select>
[0115] < / mapper>
[0116] SysLoginInforMapper class file: (corresponding to namespace)
[0117] Public interface SysLoginInforMapper{
[0118] List <syslogininfor>selectList();
[0119] };
[0120] Then, the corresponding Java syntax tree is generated according to the above Java code. The Java syntax tree consists of three method nodes, as shown below:
[0121] SysLoginInforController(class) / / class;
[0122] sysLoginInforService(Field:SysLoginInforService) / / Field sysLoginInforService, type SysLoginInforService;
[0123] SysLoginInforService;
[0124] list(sysLoginInfor)(Method:List) / / Method list, return type List;
[0125] sysLoginInfor(Paramater:SysLoginInfor) / / Method parameter sysLoginInfor, type SysLoginInfor;
[0126] selelctAllLoginInforList(sysLoginInfor) (Method:List) / / Call within the method;
[0127] (to: sysLoginInforService) / / represents the selectAllLoginInforList method of sysLoginInforService;
[0128] sysLoginInfor(Paramater:SysLoginInfor) / / Method parameter sysLoginInfor, type SysLoginInfor;
[0129] SysLoginInforService (class) / / class;
[0130] sysLoginInforMapper(Field:SysLoginInforMapper) / / Field sysLoginInforMapper, type SysLoginInforMapper;
[0131] SysLoginInforMapper;
[0132] selelctAllLoginInforList(sysLoginInfor) (Method:List) / / Method selelctAllLoginInforList, return type List;
[0133] sysLoginInfor(Paramater:SysLoginInfor) / / Method parameter sysLoginInfor, type SysLoginInfor;
[0134] selectList()(Method:List) / / Call the selectList method of sysLoginInforMapper in the method;
[0135] (to: sysLoginInforMapper) / / represents the selectList method of sysLoginInforMapper;
[0136] SysLoginInforMapper(class) / / class;
[0137] selectList()(Method:List);
[0138] Then, the corresponding spring relationship tree is generated according to the java code and spring framework configuration. The spring relationship tree consists of a method node to be called, as shown below:
[0139] SysLoginInforService(class) / / class
[0140] (springld: sysLoginInforService) / / Represents the springid of the class, the relationship tree between spring and the class;
[0141] Then, the corresponding mybatis relationship tree is generated according to the java code and mybatis framework configuration. The mybatis relationship tree consists of an associated method node, as shown below:
[0142] SysLoginInforMapper(namespace associated class)
[0143] selectList()(Method:List)
[0144] (to table:sys_loginfor) / / Associated table;
[0145] In summary, it can be seen that there is a calling relationship among the java syntax tree, the spring relationship tree and the mybatis relationship tree. Based on the calling relationship, a comprehensive query can be performed on the java syntax tree, the spring relationship tree and the mybatis relationship tree, and the computer's analysis speed of the affected range can be improved.
[0146] After obtaining the above Java syntax tree, spring relationship tree and mybatis relationship tree, the tester can enter the current changed table name Table:sys_loginfor; query the mybatis relationship tree according to the current changed table name Table:sys_loginfor, and obtain the current changed method name selectList and the current changed category name SysLoginInforMapper, such as Figure 2 As shown;
[0147] Since, two types of method nodes can be included in the Java syntax tree, the method node is a method node including a method block, a first category alias and a first method name, or a method node including a first category alias and a first method name. The method node including a method block, a first category alias and a first method name indicates that the method node needs to rely on other method configurations to be implemented, and the method node including the first category alias and the first method name indicates that the method node relies on its own method configuration to be implemented.
[0148] Specifically, when recursive query is performed in the Java syntax tree according to the current change method name selectList and the current change category name SysLoginInforMapper, in the first recursion, it can be found that the first method name of the third method node on the Java syntax tree is selectList and the first category name is SysLoginInforMapper, then the third method node is the first change node;
[0149] Then, recursively query the remaining method nodes, and match the current change method name selectList and the current change category name SysLoginInforMapper with the corresponding calling method name and first category name in the remaining two method nodes respectively. It can be found that the calling method name of the second method node on the Java syntax tree is selectList and the calling category name is SysLoginInforMapper, and the second method node is taken as the second change node and added to the change queue;
[0150] Next, update the current change method name and the current change category name, that is, use the first method name selectAllLoginInforList and the first category name SysLoginInforService of the second method node as the current change method name and the current change category name respectively, and then perform recursive query to find that the calling method name of the Java syntax tree is selectAllLoginInforList and the calling category name is SysLoginInforService, then use the third method node as the third change node. In the above, the first change node, the second change node and the third change node are all currently affected method nodes.
[0151] By recursively querying the Java syntax tree, not only can the affected method nodes be quickly queried, but the Java syntax tree can also be fully queried to avoid omissions and inaccurate testing. Then, based on the currently affected method nodes, the spring relationship tree is queried to query the calling method nodes associated with the method nodes, thus achieving a comprehensive query of the affected scope.
[0152] In another embodiment, when the tester changes the method, the current changed method name and the current changed category name can be directly obtained, and then a comprehensive query is performed in the Java syntax tree and the Spring relationship tree according to the current changed method name and the current changed category name to obtain a result tree, such as Figure 3 As shown, by recursively querying the Java syntax tree, not only can the affected method nodes be quickly queried, but the Java syntax tree can also be queried comprehensively to avoid omissions and inaccurate testing.
[0153] Example 2
[0154] A query system for statically analyzing the impact of changes in the Spring framework, including:
[0155] Configuration module: used to obtain the Java syntax tree, Spring relationship tree and Mybatis relationship tree corresponding to the current query item; the Java syntax tree is a tree structure composed of several method nodes, and the Spring relationship tree is a tree structure composed of several method nodes to be called;
[0156] Method change information acquisition module: used to obtain the table name of the current change corresponding to the current item to be queried, and query the current change method name and current change category name corresponding to the current change table name in the mybatis relationship tree according to the current change table name;
[0157] Recursive query module based on Java syntax tree: used to perform recursive query in Java syntax tree according to the relationship between the current changed method name and the current changed category name and method node, and query several currently affected method nodes;
[0158] Method node judgment module: used to extract the method block of the currently affected method node and judge whether the method block contains the calling method name. If so, the currently affected method node is recorded as the current calling method node;
[0159] Method query module based on mybatis relationship tree: used to query in the spring relationship tree according to the relationship between the current calling method node and the method node to be called, and query the method node to be called associated with the current calling method node;
[0160] Change impact structure generation module: used to form a corresponding change impact structure according to a number of currently affected method nodes and a to-be-called method node associated with a currently called method node.
[0161] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. According to the technical essence of the present invention, within the spirit and principles of the present invention, any simple modification, equivalent replacement and improvement made to the above embodiment still falls within the protection scope of the technical solution of the present invention.< / syslogininfor>
Claims
1. A query method for statically analyzing the impact of changes in the spring framework, characterized in that: The method specifically comprises the following steps: S0: Obtain the Java syntax tree, Spring relationship tree and MyBatis relationship tree corresponding to the current query item; the Java syntax tree is a tree structure composed of several method nodes, and the Spring relationship tree is a tree structure composed of several method nodes to be called; S1: Get the name of the currently changed table corresponding to the current item to be queried, and query the current change method name and current change category name corresponding to the currently changed table name in the mybatis relationship tree according to the currently changed table name; S2: recursively query the Java syntax tree according to the relationship between the current changed method name and the current changed category name and the method node, and query several currently affected method nodes; S3: extracting a method block from the currently affected method node, and determining whether the method block contains a calling method name, and if so, recording the currently affected method node as the current calling method node; S4: query the spring relationship tree according to the relationship between the current calling method node and the method node to be called, and query the method node to be called associated with the current calling method node; S5: forming a corresponding change impact structure according to a number of currently affected method nodes and a to-be-called method node associated with the currently called method node.
2. According to a static analysis method for querying the impact surface of changes in the spring framework according to claim 1, it is characterized in that: In S0, the specific process of obtaining the Java syntax tree, spring relationship tree, and mybatis relationship tree corresponding to the current query item is as follows: Parse the code, spring framework configuration, and mybatis framework configuration in the current project to be queried respectively, and then get the corresponding java code, spring framework configuration, and mybatis framework configuration; Then, generate the corresponding Java syntax tree according to the Java code; generate the corresponding Spring relationship tree according to the Java code and Spring framework configuration; Generate the corresponding mybatis relationship tree according to the java code and mybatis framework configuration.
3. According to a static analysis method for querying the impact surface of changes in the spring framework according to claim 1, it is characterized in that: In S4, the current calling method node includes a first category name and a calling method name, the to-be-called method node includes a second category name, and the calling method name contained in the method block in the to-be-called method node associated with the current calling method node is consistent with the second category name.
4. According to a static analysis method for querying the impact surface of changes in the spring framework according to claim 1, it is characterized in that: The mybatis relationship tree is a tree structure composed of several associated method nodes, and an associated method node includes a third category name, a third method name and a corresponding table name; then in S1, the specific process of querying the current change method name and the current change category name corresponding to the current changed table name in the mybatis relationship tree according to the current changed table name is: The table name of the current change is matched with the table name in the associated method node for consistency. If the two are consistent, that is, the table name in the associated method node is the table name of the current change, then the corresponding third method name and third category name in the associated method node are respectively used as the current change method name and current change category name corresponding to the table name of the current change.
5. According to a static analysis method for querying the impact surface of changes in the spring framework according to claim 1, it is characterized in that: The method node is a method node including a method block, a first category name and a first method name, or a method node including a first category name and a first method name. The method block includes a calling method name and a calling category name. The method node including a method block, a first category name and a first method name indicates that the method node needs to rely on the method corresponding to the calling method name and the calling category name in the method block to be implemented.
6. According to claim 5, a query method for statically analyzing the change impact surface in the spring framework is characterized in that: In S2, the specific process of the recursive query is as follows: SA1: Get the first class name and the first method name corresponding to the method node; SA2: Match the current change method name and the current change category name with the corresponding first method name and first category name in the method node respectively. If the two are consistent, that is, the first method name and the first category name in the method node are the current change method name and the current change category name respectively, then the method node is taken as the first change node, and then go to step SA3; SA3: Update the current change method name and the current change category name with the first method name and the first category name in the first change node, and go to step SA4; SA4: Match the current change method name and the current change category name with the corresponding calling method name and calling category name in the method nodes other than the first change node. If the two are consistent, that is, the calling method name and calling category name in the method node are the current change method name and the current change category name, respectively, then take the method node as the current change node, and then go to step SA5; SA5: Update the current changed method name and the current changed category name with the first method name and the first category name in the current changed node, and go to step SA4 until the recursive query ends.
7. According to claim 6, a query method for statically analyzing the change impact surface in the spring framework is characterized in that: The first method name is used to indicate that the method node executes the method corresponding to the first method name, and the calling method name is used to indicate that the method node relies on the method configuration associated with the calling method name to execute the method corresponding to the first method name.
8. According to claim 6, a query method for statically analyzing the change impact surface in the spring framework is characterized in that: In S5, the specific process of forming a corresponding change impact structure according to a number of currently affected method nodes and the method nodes to be called associated with the currently called method node is as follows: A result tree consisting of several currently affected method nodes and to-be-called method nodes associated with the currently called method node is generated according to the change queue, and the corresponding to-be-called method nodes in the result tree are associated with the currently called method node to form a change impact structure.
9. A query system for statically analyzing the impact of changes in the spring framework, characterized in that: include: Configuration module: used to obtain the Java syntax tree, Spring relationship tree and Mybatis relationship tree corresponding to the current query item; the Java syntax tree is a tree structure composed of several method nodes, and the Spring relationship tree is a tree structure composed of several method nodes to be called; Method change information acquisition module: used to obtain the table name of the current change corresponding to the current item to be queried, and query the current change method name and current change category name corresponding to the current change table name in the mybatis relationship tree according to the current change table name; Recursive query module based on Java syntax tree: used to perform recursive query in Java syntax tree according to the relationship between the current changed method name and the current changed category name and method node, and query several currently affected method nodes; Method node judgment module: used to extract the method block of the currently affected method node and judge whether the method block contains the calling method name. If so, the currently affected method node is recorded as the current calling method node; Method query module based on mybatis relationship tree: used to query in the spring relationship tree according to the relationship between the current calling method node and the method node to be called, and query the method node to be called associated with the current calling method node; Change impact structure generation module: used to form a corresponding change impact structure according to a number of currently affected method nodes and a to-be-called method node associated with a currently called method node.
