WO2023098241A1 - Request processing method and apparatus - Google Patents

Request processing method and apparatus Download PDF

Info

Publication number
WO2023098241A1
WO2023098241A1 PCT/CN2022/120218 CN2022120218W WO2023098241A1 WO 2023098241 A1 WO2023098241 A1 WO 2023098241A1 CN 2022120218 W CN2022120218 W CN 2022120218W WO 2023098241 A1 WO2023098241 A1 WO 2023098241A1
Authority
WO
WIPO (PCT)
Prior art keywords
interface
implementation
implementation class
class
beandefinition
Prior art date
Application number
PCT/CN2022/120218
Other languages
French (fr)
Chinese (zh)
Inventor
陈劲豪
Original Assignee
深圳前海微众银行股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳前海微众银行股份有限公司 filed Critical 深圳前海微众银行股份有限公司
Publication of WO2023098241A1 publication Critical patent/WO2023098241A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45579I/O management, e.g. providing access to device drivers or storage

Definitions

  • the present application provides a request processing method and device, which are used to simplify the complexity of interface development and maintenance, and to be as transparent as possible to the controller when processing the request.
  • the call of the implementation object is routed, without writing a factory class for each interface; and, by replacing the service interface injected by the controller with a dynamic proxy object, the realization To be as transparent as possible to the interface caller.
  • Step 202 if it is determined that the injection into the interface is a dynamic proxy object, then determine the first implementation class of the interface from the preset routing relationship through the routing parameters in the service request and the interface information of the interface;
  • the dynamic proxy object is obtained by the Spring container based on the instantiation of the factory object FactoryBean in the modeling object BeanDefinition;
  • the preset routing relationship is provided with routing parameters+interface information and the mapping relationship of the implementation class;
  • the package scanning in step 302 can be implemented by inheriting and extending the ClassPathBeanDefinitionScanner class, which will scan the BeanDefinition in the ClassPath through the configured package path.
  • the metadata of the class will be provided in the BeanDefinition. Since the metadata contains detailed parameters such as the interface properties and annotation information of the Bean implementation class, the branch judgment of steps 303, 304, 306 and 308 can be completed according to the metadata during the package scanning process.
  • an interface corresponds to at least two implementation classes.
  • interface C2 corresponds to two implementation classes A1 and A2
  • interface C4 corresponds to three implementation classes A2, A3, and A4.
  • the controller can directly call the implementation class corresponding to the implemented Bean to process the service request.

Abstract

The present invention relates to the field of Fintech. Disclosed are a request processing method and apparatus. The method comprises: for a received service request, determining an interface which corresponds to the service request; if it is determined that a dynamic proxy object is injected into the interface, determining a first implementation class of the interface from a preset routing relationship by means of a routing parameter in the service request and interface information of the interface; and processing the service request by means of an instance of the first implementation class. A routing relationship is described by using annotation technology, and on the basis of a dynamic proxy, the calling of an implementation object is routed without the need for compiling a factory class for each interface; and a service interface injected into a controller is replaced with a dynamic proxy object, such that an interface caller is as transparent as possible.

Description

一种请求处理方法及装置A request processing method and device
相关申请的交叉引用Cross References to Related Applications
本申请要求在2021年12月03日提交中国专利局、申请号为202111461675.2、申请名称为“一种请求处理方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application with application number 202111461675.2 and application title "A Method and Device for Request Processing" filed with the China Patent Office on December 03, 2021, the entire contents of which are hereby incorporated by reference in this application .
技术领域technical field
本申请实施例涉及金融科技(Fintech)领域,尤其涉及一种请求处理方法及装置。The embodiments of the present application relate to the field of financial technology (Fintech), and in particular, to a request processing method and device.
背景技术Background technique
随着计算机技术的发展,越来越多的技术(例如:云计算、大数据或区块链)应用在金融领域,传统金融业正在逐步向金融科技转变。例如,银行可基于服务端为客户端提供服务的系统架构,构建相关的金融产品并部署于服务端上,从而用户通过自己日常携带的终端就可以便捷地对一些金融类的业务进行办理,提升了用户体验。With the development of computer technology, more and more technologies (such as cloud computing, big data or blockchain) are applied in the financial field, and the traditional financial industry is gradually transforming into financial technology. For example, based on the system architecture in which the server provides services to clients, banks can build relevant financial products and deploy them on the server, so that users can conveniently handle some financial services through their daily terminals, improving user experience.
其中,服务端在接收到用户请求后,可根据用户请求中的路由参数,执行接口的对应实现方法,以对用户请求进行处理。例如,目前在对用户请求进行处理时,可通过工厂设计模式实现。具体的,工厂设计模式可根据前端传入的路由参数,返回同个接口的不同实现类的实例,进而达到执行对应方法的效果。如图1所示,为现有技术提供的一种工厂设计模式的开发流程图。基于图1可知,在接口开发过程中,若采用工厂设计模式,则需要为每一个接口编写工厂类,显然使得开发与维护工作变得繁琐;此外,在所开发的接口被调用的过程中,则需要首先手动地从请求中获取路由参数,随后显式地获取实例,显然成本较高。Wherein, after receiving the user request, the server can execute the corresponding implementation method of the interface according to the routing parameters in the user request, so as to process the user request. For example, at present, when processing user requests, it can be realized through the factory design pattern. Specifically, the factory design pattern can return instances of different implementation classes of the same interface according to the routing parameters passed in by the front end, so as to achieve the effect of executing the corresponding method. As shown in Figure 1, it is a flow chart of the development of a factory design pattern provided by the prior art. Based on Figure 1, it can be seen that in the process of interface development, if the factory design pattern is used, it is necessary to write a factory class for each interface, which obviously makes the development and maintenance work cumbersome; in addition, when the developed interface is called, You need to manually obtain the routing parameters from the request first, and then obtain the instance explicitly, which obviously costs a lot.
发明内容Contents of the invention
本申请提供一种请求处理方法及装置,用以简化接口开发与维护的繁琐程度,以及在对请求进行处理时尽可能对控制器做到透明。The present application provides a request processing method and device, which are used to simplify the complexity of interface development and maintenance, and to be as transparent as possible to the controller when processing the request.
第一方面,本申请实施例提供一种请求处理方法,适用于Spring开源框架;该方法包括:针对接收的业务请求,确定所述业务请求对应的接口;若确定所述接口中注入的是动态代理对象,则通过所述业务请求中的路由参数和所述接口的接口信息,从预设路由关系中确定所述接口的第一实现类;其中,动态代理对象是Spring容器基于建模对象BeanDefinition中的工厂对象FactoryBean实例化得到的;所述预设路由关系设置有路由参数+接口信息与实现类的映射关系;通过所述第一实现类的实例对所述业务请求进行处理。In the first aspect, the embodiment of the present application provides a request processing method, which is applicable to the Spring open source framework; the method includes: for the received service request, determining the interface corresponding to the service request; if it is determined that the injection in the interface is dynamic Proxy object, then through the routing parameters in the business request and the interface information of the interface, determine the first implementation class of the interface from the preset routing relationship; wherein, the dynamic proxy object is the Spring container based on the modeling object BeanDefinition obtained by instantiating the factory object FactoryBean in ; the preset routing relationship is set with a mapping relationship between routing parameters+interface information and implementation class; the service request is processed through the instance of the first implementation class.
上述方案中,通过使用注解技术描述路由关系,基于动态代理,对实现对象的调用进行路由,无需为每一个接口编写一个工厂类;以及,通过替换控制器注入的服务接口为动态代理对象,实现了对接口调用者的尽可能透明。In the above solution, by using annotation technology to describe the routing relationship, based on dynamic proxy, the call of the implementation object is routed, without writing a factory class for each interface; and, by replacing the service interface injected by the controller with a dynamic proxy object, the realization To be as transparent as possible to the interface caller.
在一种可能实现的方法中,所述动态代理对象是Spring容器基于建模对象BeanDefinition中的工厂对象FactoryBean实例化得到的,包括:针对任一接口,若所述接口设置有接口注解,则将所述接口的BeanDefinition指示的对象Bean的实现类修改为FactoryBean,并向所述FactoryBean传入所述接口的接口信息;所述FactoryBean用于实例化所述Bean得到所述接口的动态代理对象。In a possible implementation method, the dynamic proxy object is obtained by the Spring container based on the instantiation of the factory object FactoryBean in the modeling object BeanDefinition, including: for any interface, if the interface is provided with an interface annotation, the The implementation class of the object Bean indicated by the BeanDefinition of the interface is changed to FactoryBean, and the interface information of the interface is transferred to the FactoryBean; the FactoryBean is used to instantiate the Bean to obtain the dynamic proxy object of the interface.
上述方案中,通过将设置有接口注解的接口的BeanDefinition指示的对象Bean的实现类修改为FactoryBean,并向FactoryBean中传入该接口的接口信息,从而在Spring容器实例化Bean的时候,就可以使用FactoryBean来实例化Bean,从而得到该接口的动态代理对象。基于动态代理对象对业务请求进行处理,就可以对控制器做到尽可能透明。In the above solution, by modifying the implementation class of the object Bean indicated by the BeanDefinition of the interface with interface annotations to FactoryBean, and passing the interface information of the interface to FactoryBean, when the Spring container instantiates the bean, it can be used FactoryBean to instantiate the bean to obtain the dynamic proxy object of the interface. By processing business requests based on dynamic proxy objects, the controller can be as transparent as possible.
在一种可能实现的方法中,所述FactoryBean用于实例化所述Bean得到所述接口的动态代理对象,包括:设置所述BeanDefinition中的Primary参数的启用状态;Spring容器在实例化所述Bean时,基于所述Primary参数的启用状态,通过所述FactoryBean实例化所述Bean得到所述接口的动态代理对象。In a possible implementation method, the FactoryBean is used to instantiate the Bean to obtain the dynamic proxy object of the interface, including: setting the enabled state of the Primary parameter in the BeanDefinition; the Spring container is instantiating the Bean , based on the enabled state of the Primary parameter, instantiate the Bean through the FactoryBean to obtain the dynamic proxy object of the interface.
上述方案中,在Spring容器实例化Bean之前,通过将BeanDefinition中的Primary参数设置为启用状态,则在实例化Bean时,Spring容器可使用FactoryBean来实例化Bean时,也即可以向Spring容器中注入接口的动态代理对象,而不再是基于BeanDefinition来注入具体的实现Bean。In the above scheme, before the Spring container instantiates the Bean, by setting the Primary parameter in the BeanDefinition to the enabled state, when the Bean is instantiated, the Spring container can use the FactoryBean to instantiate the Bean, that is, it can inject into the Spring container The dynamic proxy object of the interface, instead of injecting the specific implementation Bean based on BeanDefinition.
在一种可能实现的方法中,通过如下方式确定所述接口是否设置有接口注解,包括:Spring容器在接收到启动指令后,通过包扫描技术遍历各BeanDefinition;针对任一BeanDefinition,确定所述BeanDefinition指示的Bean是否对应接口及是否有接口注解;若确定所述BeanDefinition指示的Bean未对应接口,则确定所述BeanDefinition指示的Bean对应的实现类是否包括类注解。In a possible implementation method, it is determined whether the interface is provided with an interface annotation in the following manner, including: after the Spring container receives the startup instruction, it traverses each BeanDefinition through the package scanning technology; for any BeanDefinition, determine the BeanDefinition Whether the indicated Bean corresponds to an interface and whether there is an interface annotation; if it is determined that the Bean indicated by the BeanDefinition does not correspond to an interface, then determine whether the implementation class corresponding to the Bean indicated by the BeanDefinition includes class annotations.
上述方案中,对于一个接口对应至少两个实现类的场景,通过为接口以及实现类添加注解,从而在Spring容器启动过程中,通过包扫描技术,就可以确定源代码中各BeanDefinition指示的Bean是否对应接口或实现类,并在确定是对应接口或者是对应实现类时,进一步判定接口或者实现类是否具有接口注解或者类注解,如此,为接下来建立路由关系以及更改接口注解所在接口的BeanDefinition的各实现类奠定基础。In the above solution, for the scenario where an interface corresponds to at least two implementation classes, by adding annotations to the interface and the implementation class, it is possible to determine whether the Bean indicated by each BeanDefinition in the source code is Corresponding to the interface or implementation class, and when determining whether it is the corresponding interface or the corresponding implementation class, further determine whether the interface or implementation class has interface annotations or class annotations, so that for the next establishment of routing relationships and changes to the BeanDefinition of the interface where the interface annotation is located Each implementation class lays the foundation.
在一种可能实现的方法中,所述预设路由关系是通过如下方式得到的,包括:针对任一实现类,若所述实现类设置有类注解,则遍历所述实现类所实现的各接口;针对各接口中任一接口,若所述接口设置有接口注解,则构建所述接口与所述实现类的路由关系;所述接口与所述实现类的路由关系设置有所述类注解中携带的路由参数+所述接口的接口信息与所述实现类的映射关系。In a possible implementation method, the preset routing relationship is obtained in the following manner, including: for any implementation class, if the implementation class is set with class annotations, then traversing the various implementation classes implemented by the implementation class Interface; for any interface in each interface, if the interface is provided with an interface annotation, the routing relationship between the interface and the implementation class is constructed; the routing relationship between the interface and the implementation class is provided with the class annotation The routing parameters carried in + the mapping relationship between the interface information of the interface and the implementation class.
上述方案中,通过遍历实现类,并对设置有类注解的实现类所实现的各接口进行遍历,若一接口设置有接口注解,则可以构建当前接口与当前实现类路由关系,其中路由关系中包括接口与实现类的对应关系以及类注解中携带的路由参数与实现类的对应关系;基于所构建的路由关系,当在对用户请求进行响应时,就可以快速基于路由参数与接口信息定位到对应的实现类,最后通过调用实现类对应的方法,就可以对用户请求进行处理。In the above scheme, by traversing the implementation classes and traversing the interfaces implemented by the implementation classes with class annotations set, if an interface is set with interface annotations, the routing relationship between the current interface and the current implementation class can be constructed, where the routing relationship Including the corresponding relationship between the interface and the implementation class, and the corresponding relationship between the routing parameters carried in the class annotation and the implementation class; based on the routing relationship built, when responding to user requests, you can quickly locate based on routing parameters and interface information The corresponding implementation class, and finally by calling the corresponding method of the implementation class, the user request can be processed.
在一种可能实现的方法中,所述动态代理对象通过如下方式得到所述业务请求中的路由参数,包括:通过面向切面编程AOP,将所述业务请求中的路由参数保存于线程局部变量ThreadLocal中;所述动态代理对象从所述ThreadLocal中获取所述业务请求中的路由参 数。In a possible implementation method, the dynamic proxy object obtains the routing parameters in the business request in the following manner, including: saving the routing parameters in the business request in the thread local variable ThreadLocal through aspect-oriented programming AOP In; the dynamic proxy object obtains the routing parameters in the service request from the ThreadLocal.
上述方案中,通过AOP技术保存路由参数至ThreadLocal中,则可以避免在控制器的每个方法中都编写路由字段的获取逻辑。In the above solution, by saving the routing parameters in ThreadLocal through AOP technology, it is possible to avoid writing the acquisition logic of the routing field in each method of the controller.
在一种可能实现的方法中,若确定所述接口中注入的是实现对象,则获取所述接口的第二实现类;所述实现对象是所述Spring容器基于BeanDefinition实例化得到的,所述接口与所述第二实现类一一对应;通过所述第二实现类的实例对所述业务请求进行处理。In a possible implementation method, if it is determined that the injection in the interface is an implementation object, then obtain the second implementation class of the interface; the implementation object is obtained by the Spring container based on BeanDefinition instantiation, the The interface is in one-to-one correspondence with the second implementation class; the service request is processed through the instance of the second implementation class.
上述方案中,对于一个接口仅对应一个实现类的场景,在Spring容器启动过程中,通过包扫描技术,若确定某接口仅对应一个实现类,则无需建立该接口与实现类的路由关系,且在Spring容器实例化Bean的过程中,Spring容器可直接基于BeanDefinition实例化出一个具体的实现Bean,即实现对象。该方式下,在用户请求进入时,可直接基于实现对象指向的第二实现类来对用户请求进行处理。In the above solution, for the scenario where an interface corresponds to only one implementation class, during the startup process of the Spring container, if it is determined that an interface corresponds to only one implementation class through package scanning technology, there is no need to establish a routing relationship between the interface and the implementation class, and In the process of instantiating beans in the Spring container, the Spring container can directly instantiate a specific implementation Bean based on the BeanDefinition, that is, the implementation object. In this way, when a user requests to enter, the user request can be processed directly based on the second implementation class pointed to by the implementation object.
第二方面,本申请实施例提供一种请求处理装置,适用于Spring开源框架;该装置包括:接口确定单元,用于针对接收的业务请求,确定所述业务请求对应的接口;实现类确定单元,用于若确定所述接口中注入的是动态代理对象,通过所述业务请求中的路由参数和所述接口的接口信息,从预设路由关系中确定所述接口的第一实现类;其中,动态代理对象是Spring容器基于建模对象BeanDefinition中的工厂对象FactoryBean实例化得到的;所述预设路由关系设置有路由参数+接口信息与实现类的映射关系;处理单元,用于通过所述第一实现类的实例对所述业务请求进行处理。In the second aspect, the embodiment of the present application provides a request processing device, which is applicable to the Spring open source framework; the device includes: an interface determination unit, for determining the interface corresponding to the business request received; the implementation class determination unit , if it is determined that the injection into the interface is a dynamic proxy object, determine the first implementation class of the interface from the preset routing relationship through the routing parameters in the service request and the interface information of the interface; wherein , the dynamic proxy object is obtained by the Spring container based on the instantiation of the factory object FactoryBean in the modeling object BeanDefinition; the preset routing relationship is provided with a mapping relationship between routing parameters+interface information and implementation classes; The instance of the first implementation class processes the service request.
第三方面,本申请实施例提供了一种计算设备,包括:In a third aspect, the embodiment of the present application provides a computing device, including:
存储器,用于存储程序指令;memory for storing program instructions;
处理器,用于调用所述存储器中存储的程序指令,按照获得的程序执行如第一方面任一实现方法。The processor is configured to call the program instructions stored in the memory, and execute any implementation method according to the first aspect according to the obtained program.
第四方面,本申请实施例提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机可执行指令,所述计算机可执行指令用于使计算机执行如第一方面任一实现方法。In a fourth aspect, the embodiment of the present application provides a computer-readable storage medium, the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to make a computer execute any one of the implementations of the first aspect. method.
附图说明Description of drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简要介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域的普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings that need to be used in the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. For Those skilled in the art can also obtain other drawings based on these drawings without any creative effort.
图1为现有技术提供的一种工厂设计模式的开发流程图;Fig. 1 is the development flow diagram of a kind of factory design mode that prior art provides;
图2为本申请实施例提供的一种请求处理方法的示意图;FIG. 2 is a schematic diagram of a request processing method provided by an embodiment of the present application;
图3为本申请实施例提供的一种Spring容器初始化的流程图;Fig. 3 is the flow chart of a kind of Spring container initialization that the embodiment of the present application provides;
图4为本申请实施例提供的一种路由关系配置示意图;FIG. 4 is a schematic diagram of a routing relationship configuration provided in an embodiment of the present application;
图5为本申请实施例提供的一种请求处理装置的示意图;FIG. 5 is a schematic diagram of a request processing device provided by an embodiment of the present application;
图6为本申请实施例提供的一种计算设备的示意图。FIG. 6 is a schematic diagram of a computing device provided by an embodiment of the present application.
具体实施方式Detailed ways
为了使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请作进一步地详细描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本申请保护的范围。In order to make the purpose, technical solution and advantages of the application clearer, the application will be further described in detail below in conjunction with the accompanying drawings. Apparently, the described embodiments are only some of the embodiments of the application, not all of them. Based on the embodiments in this application, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the scope of protection of this application.
目前,服务端可基于工厂设计模式,而为各个接口编写不同的实现类,从而在服务端对用户请求进行响应时,其可根据前端传入参数、返回同个接口的不同实现类的实例,进而达到执行对应方法的效果。At present, the server can write different implementation classes for each interface based on the factory design pattern, so that when the server responds to user requests, it can return instances of different implementation classes of the same interface according to the parameters passed in from the front end. Then achieve the effect of executing the corresponding method.
然而上述方法在接口开发的过程中,由于需要为每一个接口编写工厂类,因而存在开发、维护繁琐的缺点,以及,在接口调用时首先需要手动获取路由参数,接着向工厂中传入路由参数以获取实例,最后再对实例进行调用方能执行对应方法,因此存在对接口调用者不够透明的缺点。However, in the process of interface development, the above method has the disadvantage of cumbersome development and maintenance due to the need to write a factory class for each interface. In addition, when the interface is called, it is first necessary to manually obtain the routing parameters, and then pass the routing parameters to the factory. To obtain the instance, and finally the caller of the instance can execute the corresponding method, so there is a disadvantage of not being transparent to the interface caller.
针对上述技术问题,本申请实施例提供一种请求处理方法,适用于Spring框架。如图2所示,为本申请实施例提供的一种请求处理方法的示意图,该方法包括以下步骤:In view of the above technical problems, the embodiment of the present application provides a request processing method, which is applicable to the Spring framework. As shown in Figure 2, it is a schematic diagram of a request processing method provided by the embodiment of the present application, and the method includes the following steps:
步骤201,针对接收的业务请求,确定所述业务请求对应的接口; Step 201, for the received service request, determine the interface corresponding to the service request;
步骤202,若确定所述接口中注入的是动态代理对象,则通过所述业务请求中的路由参数和所述接口的接口信息,从预设路由关系中确定所述接口的第一实现类;其中,动态代理对象是Spring容器基于建模对象BeanDefinition中的工厂对象FactoryBean实例化得到的;所述预设路由关系设置有路由参数+接口信息与实现类的映射关系; Step 202, if it is determined that the injection into the interface is a dynamic proxy object, then determine the first implementation class of the interface from the preset routing relationship through the routing parameters in the service request and the interface information of the interface; Wherein, the dynamic proxy object is obtained by the Spring container based on the instantiation of the factory object FactoryBean in the modeling object BeanDefinition; the preset routing relationship is provided with routing parameters+interface information and the mapping relationship of the implementation class;
步骤203,通过所述第一实现类的实例对所述业务请求进行处理。 Step 203, process the service request through the instance of the first implementation class.
上述方案中,通过使用注解技术描述路由关系,基于动态代理,对实现对象的调用进行路由,无需为每一个接口编写一个工厂类;以及,通过替换控制器注入的服务接口为动态代理对象,实现了对接口调用者的尽可能透明。In the above solution, by using annotation technology to describe the routing relationship, based on dynamic proxy, the call of the implementation object is routed, without writing a factory class for each interface; and, by replacing the service interface injected by the controller with a dynamic proxy object, the realization To be as transparent as possible to the interface caller.
以下将结合示例分别对上述一些步骤进行详细说明。Some of the above steps will be described in detail below in combination with examples.
在本申请的某些实施中,Spring容器在接收到启动指令后,通过包扫描技术遍历各BeanDefinition;针对任一BeanDefinition,确定所述BeanDefinition指示的Bean是否对应接口及是否有接口注解;若确定所述BeanDefinition指示的Bean未对应接口,则确定所述BeanDefinition指示的Bean对应的实现类是否包括类注解。In some implementations of the present application, the Spring container traverses each BeanDefinition through package scanning technology after receiving the startup instruction; for any BeanDefinition, determine whether the Bean indicated by the BeanDefinition corresponds to an interface and whether there is an interface annotation; If the Bean indicated by the BeanDefinition does not correspond to an interface, determine whether the implementation class corresponding to the Bean indicated by the BeanDefinition includes class annotations.
在本申请的某些实施中,针对任一实现类,若所述实现类设置有类注解,则遍历所述实现类所实现的各接口;针对各接口中任一接口,若所述接口设置有接口注解,则构建所述接口与所述实现类的路由关系;所述接口与所述实现类的路由关系设置有所述类注解中携带的路由参数+所述接口的接口信息与所述实现类的映射关系。In some implementations of the present application, for any implementation class, if the implementation class is set with class annotations, then traverse the interfaces implemented by the implementation class; for any interface in each interface, if the interface is set If there is an interface annotation, then construct the routing relationship between the interface and the implementation class; the routing relationship between the interface and the implementation class is set with the routing parameters carried in the class annotation + the interface information of the interface and the Realize the mapping relationship of classes.
在本申请实施例中,以服务端采用Spring开源框架为例进行说明。此外,本申请实施例中可设计有接口注解和类注解,作为示例,可将接口注解表示为@RouteInterface,以及将类注解表示为@RouteImpl,所设计的这两个注解分别修饰在接口和实现类上,其中注解@RouteImpl中会携带设定路由参数。通过这两个注解,可以描述一种路由关系,即当用户请求中包含设定路由参数,并调用@RouteInterface注解的接口时,那么实际上会调用到@RouteImpl注解中与设定路由参数相同的实现类。本申请实施例中对于路由关系的建立, 可在Spring容器初始化时,利用包扫描技术读取注解,以进行路由关系的建立。具体内容如下:In the embodiment of this application, the server uses the Spring open source framework as an example for illustration. In addition, interface annotations and class annotations can be designed in this embodiment of the application. As an example, the interface annotation can be expressed as @RouteInterface, and the class annotation can be expressed as @RouteImpl. These two designed annotations are respectively modified on the interface and implementation On the class, the annotation @RouteImpl will carry the set routing parameters. Through these two annotations, a routing relationship can be described, that is, when the user request contains setting routing parameters and calls the @RouteInterface annotated interface, it will actually call the @RouteImpl annotation that is the same as setting the routing parameters Implementation class. For the establishment of the routing relationship in the embodiment of the present application, when the Spring container is initialized, the package scanning technology can be used to read the annotation, so as to establish the routing relationship. The specific content is as follows:
路由关系是在Spring容器启动的生命周期BeanDefinitionRegistryPostProcessor中建立的。其中,包扫描遍历源代码中所有的实现类,当遇到带有@RouteImpl注解的实现类α时,读取注解中的路由参数β,并遍历该实现类所实现的各接口;当存在该实现类所实现的接口γ带有@RouteInterface注解时,则建立路由关系(β,γ)->α。The routing relationship is established in the life cycle BeanDefinitionRegistryPostProcessor started by the Spring container. Among them, the package scan traverses all the implementation classes in the source code, when encountering the implementation class α with @RouteImpl annotation, read the routing parameter β in the annotation, and traverse the interfaces implemented by the implementation class; when there is such When the interface γ implemented by the implementation class is annotated with @RouteInterface, the routing relationship (β, γ) -> α is established.
在本申请的某些实施中,针对任一接口,若所述接口设置有接口注解,则将所述接口的BeanDefinition指示的对象Bean的实现类修改为FactoryBean,并向所述FactoryBean传入所述接口的接口信息;所述FactoryBean用于实例化所述Bean得到所述接口的动态代理对象。In some implementations of the present application, for any interface, if the interface is provided with interface annotations, the implementation class of the object Bean indicated by the BeanDefinition of the interface is modified to FactoryBean, and the FactoryBean is passed in the Interface information of the interface; the FactoryBean is used to instantiate the Bean to obtain the dynamic proxy object of the interface.
在本申请的某些实施中,所述FactoryBean用于实例化所述Bean得到所述接口的动态代理对象,包括:设置所述BeanDefinition中的Primary参数的启用状态;Spring容器在实例化所述Bean时,基于所述Primary参数的启用状态,通过所述FactoryBean实例化所述Bean得到所述接口的动态代理对象。In some implementations of the present application, the FactoryBean is used to instantiate the Bean to obtain the dynamic proxy object of the interface, including: setting the enabled state of the Primary parameter in the BeanDefinition; the Spring container is instantiating the Bean , based on the enabled state of the Primary parameter, instantiate the Bean through the FactoryBean to obtain the dynamic proxy object of the interface.
在Spring容器初始化过程中,除了需要建立路由关系,还需要注册动态代理对象Bean到Spring容器中。其中,注册动态代理对象Bean到Spring容器中同样是在Spring容器启动的生命周期BeanDefinitionRegistryPostProcessor中进行的,由于该生命周期处于Spring实例化Bean之前,因此此时,仍允许对BeanDefinition进行修改。具体的,在注册动态代理对象Bean到Spring容器中时,同样可利用包扫描技术进行遍历,不过本次包扫描将遍历源代码中所有的接口,当遇到带有@RouteInterface注解的接口γ时,将其BeanDefinition中的各实现类一一修改为工厂对象FactoryBean,并向FactoryBean中传入接口名,即γ,同时设置Primary参数为启用。从而当Spring对Bean实例化时,就会基于FactoryBean实例化出接口γ的动态代理对象。During the initialization process of the Spring container, in addition to establishing the routing relationship, it is also necessary to register the dynamic proxy object Bean into the Spring container. Among them, registering the dynamic proxy object Bean into the Spring container is also carried out in the life cycle BeanDefinitionRegistryPostProcessor started by the Spring container. Since the life cycle is before the Spring instantiates the Bean, it is still allowed to modify the BeanDefinition at this time. Specifically, when registering the dynamic proxy object Bean in the Spring container, it can also use the package scanning technology to traverse, but this package scanning will traverse all the interfaces in the source code, when encountering the interface γ with @RouteInterface annotation , modify each implementation class in its BeanDefinition to the factory object FactoryBean one by one, and pass in the interface name, namely γ, to the FactoryBean, and set the Primary parameter to enable. Therefore, when Spring instantiates the Bean, it will instantiate the dynamic proxy object of the interface γ based on the FactoryBean.
对于上述描述的对路由关系进行建立的这一过程以及注册动态代理对象Bean到Spring容器中的这一过程,可以通过图3所示的Spring容器初始化的流程图进行直观展示。如图3所示,为本申请实施例提供的一种Spring容器初始化的流程图,包括以下步骤:The process of establishing the routing relationship described above and the process of registering the dynamic proxy object Bean into the Spring container can be visually displayed through the flowchart of Spring container initialization shown in Figure 3 . As shown in Figure 3, a flow chart of Spring container initialization provided by the embodiment of the present application includes the following steps:
步骤301,Spring容器初始化开始。 Step 301, Spring container initialization starts.
步骤302,包扫描遍历BeanDefinition。In step 302, the package scans and traverses the BeanDefinition.
步骤303,确定当前BeanDefinition指示的Bean对应接口或实现类。若确定对应接口,则执行步骤304;若确定对应实现类,则执行步骤306。 Step 303, determine the corresponding interface or implementation class of the Bean indicated by the current BeanDefinition. If the corresponding interface is determined, step 304 is performed; if the corresponding implementation class is determined, step 306 is performed.
步骤304,确定当前接口γ是否包含注解@RouteInterface。若确定包含,则执行步骤305,否则执行步骤310。 Step 304, determine whether the current interface γ contains the annotation @RouteInterface. If it is determined that it is included, go to step 305 , otherwise go to step 310 .
步骤305,将接口γ对应的实现类修改为工厂对象FactoryBean,并向FactoryBean中传入接口名γ,并执行步骤310。 Step 305 , modify the implementation class corresponding to the interface γ to the factory object FactoryBean, and pass the interface name γ into the FactoryBean, and execute step 310 .
步骤306,确定当前实现类α是否包含注解@RouteImpl。若确定包含,则执行步骤307,否则执行步骤310。 Step 306, determine whether the current implementation class α contains the annotation @RouteImpl. If it is determined that it is included, go to step 307 , otherwise go to step 310 .
步骤307,遍历实现类α所实现的接口。 Step 307, traversing the interfaces realized by the implementation class α.
步骤308,确定当前接口γ是否包含注解@RouteInterface。若确定包含,则执行步骤309,否则执行步骤310。 Step 308, determine whether the current interface γ contains the annotation @RouteInterface. If it is determined that it is included, go to step 309 , otherwise go to step 310 .
步骤309,读取@RouteImpl中的路由参数β,以建立路由关系(β,γ)->α,并执行步 骤310。 Step 309, read the routing parameter β in @RouteImpl to establish the routing relationship (β, γ)->α, and execute step 310.
步骤310,确定包扫描是否结束。若确定未结束,则重新执行步骤302-310,否则执行步骤311。 Step 310, determine whether the packet scanning ends. If it is determined that it is not finished, then execute steps 302-310 again, otherwise, execute step 311.
步骤311,Spring容器初始化结束。In step 311, the initialization of the Spring container ends.
下面是对图3所示的流程图的一些说明。The following are some descriptions of the flowchart shown in FIG. 3 .
首先,图3所示的流程图对应的操作发生于Spring生命周期的BeanDefinitionRegistryPostProcessor中。其中,在该生命周期中,是允许对BeanDefinition进行修改的。First, the operations corresponding to the flowchart shown in Figure 3 occur in the BeanDefinitionRegistryPostProcessor of the Spring lifecycle. Among them, in this life cycle, it is allowed to modify the BeanDefinition.
其次,步骤302的包扫描可通过继承并扩展ClassPathBeanDefinitionScanner类实现,该类会通过配置的包路径在ClassPath中扫描BeanDefinition。BeanDefinition中会提供类的metadata。由于metadata中包含Bean实现类的接口属性、注解信息等详细参数,因此包扫描过程中将可以根据metadata完成步骤303、步骤304、步骤306和步骤308的分支判断。Secondly, the package scanning in step 302 can be implemented by inheriting and extending the ClassPathBeanDefinitionScanner class, which will scan the BeanDefinition in the ClassPath through the configured package path. The metadata of the class will be provided in the BeanDefinition. Since the metadata contains detailed parameters such as the interface properties and annotation information of the Bean implementation class, the branch judgment of steps 303, 304, 306 and 308 can be completed according to the metadata during the package scanning process.
此外,通过步骤304和305,可对带有注解@RouteInterface的接口γ的BeanDefinition进行修改并注册到Spring容器中。具体的,接口γ的BeanDefinition中的各实现类将被一一修改为工厂对象FactoryBean,如此FactoryBean可在实例化时产生一个实现接口γ的动态代理对象,从而在调用此对象的方法时,动态代理对象可根据路由参数和路由关系找到具体的实现bean,并调用该bean的同名方法。同时,可将工厂对象FactoryBean的BeanDefinition的Primary参数设置为高优先级;从而在Spring容器实例化Bean时,具体为在@Autowired注入带有@RouteInterface注解的接口时,由于优先级的关系,所注入的将是动态代理对象,而不再是具体的实现Bean。In addition, through steps 304 and 305, the BeanDefinition of the interface γ annotated with @RouteInterface can be modified and registered in the Spring container. Specifically, each implementation class in the BeanDefinition of interface γ will be modified one by one into the factory object FactoryBean, so that FactoryBean can generate a dynamic proxy object that implements interface γ when instantiated, so that when the method of this object is called, the dynamic proxy The object can find the specific implementation bean according to the routing parameters and routing relationship, and call the bean's method with the same name. At the same time, the Primary parameter of the BeanDefinition of the factory object FactoryBean can be set to a high priority; thus when the Spring container instantiates the Bean, specifically when @Autowired injects the interface with the @RouteInterface annotation, due to the priority relationship, the injected It will be a dynamic proxy object instead of a specific implementation Bean.
最后,路由关系的获取可通过步骤306-309完成,也即在对带有@RouteImpl注解的实现类进行反射获取其接口信息并取出注解中的路由参数,逐个接口判断是否附带@RouteInterface注解,若能够找到,则可建立一条路由关系。Finally, the acquisition of the routing relationship can be completed through steps 306-309, that is, reflect the implementation class with @RouteImpl annotation to obtain its interface information and take out the routing parameters in the annotation, and judge whether the @RouteInterface annotation is attached to each interface. If it can be found, a routing relationship can be established.
基于以上描述的动态代理的对象调用路由的流程图,本申请实施例不再需要开发和维护工厂来处理路由参数与实现类的关系,此外调用者也不需要重复地在方法中根据路由参数来获得实现类,而是通过使用由Spring注入的动态代理对象即可。Based on the above-described flow chart of dynamic proxy object call routing, the embodiment of the present application no longer needs to develop and maintain factories to handle the relationship between routing parameters and implementation classes, and the caller does not need to repeat routing parameters in the method. Get the implementation class, but by using the dynamic proxy object injected by Spring.
作为示例,接下来以一个具体的例子进行Spring容器初始化的说明。As an example, a specific example is used to describe the initialization of the Spring container.
如图4所示,为本申请实施例提供的一种路由关系配置示意图。设工程师基于各业务的处理逻辑、配置了如图4所示的接口-实现类的对应关系。在图4中,上面一行表示实现类,设包括有4个实现类,分别记作A1、A2、A3和A4;下面一行表示接口,设包括有6个接口,分别记作C1、C2、C3、C4、C5和C6。As shown in FIG. 4 , it is a schematic diagram of routing relationship configuration provided by the embodiment of the present application. Based on the processing logic of each business, the design engineer configured the interface-implementation class correspondence as shown in Figure 4. In Figure 4, the upper line represents the implementation class, and it is assumed that there are 4 implementation classes, which are recorded as A1, A2, A3, and A4 respectively; the bottom line represents the interface, and it is assumed that it includes 6 interfaces, which are respectively recorded as C1, C2, and C3. , C4, C5 and C6.
其中,通过对图4所示的接口-实现类的对应关系的观察可知,当中包括以下两种情况:Among them, through the observation of the corresponding relationship between the interface and the implementation class shown in Figure 4, it can be known that the following two situations are included:
情况1,一个接口对应至少两个实现类。如接口C2对应A1和A2两个实现类,接口C4对应A2、A3和A4三个实现类。Case 1, an interface corresponds to at least two implementation classes. For example, interface C2 corresponds to two implementation classes A1 and A2, and interface C4 corresponds to three implementation classes A2, A3, and A4.
情况2,一个接口仅对应唯一的一个实现类。如接口C1、C3、C5和C6分别仅对应一个实现类,分别为A1、A2、A4和A3。In case 2, an interface corresponds to only one implementation class. For example, interfaces C1, C3, C5, and C6 respectively correspond to only one implementation class, namely A1, A2, A4, and A3.
则,基于图4所示的接口-实现类的对应关系,工程师将在接口C2和接口C4上分别修饰有接口注解@RouteInterface,以及在A1、A2、A3和A4分别修饰有类注解@RouteImpl,但并不会在接口C1、C3、C5和C6上分别修饰接口注解@RouteInterface。那么:Then, based on the interface-implementation class correspondence shown in Figure 4, the engineer will decorate the interface annotation @RouteInterface on interface C2 and interface C4 respectively, and the class annotation @RouteImpl on A1, A2, A3 and A4 respectively, However, the interface annotation @RouteInterface will not be modified on the interfaces C1, C3, C5, and C6 respectively. So:
在Spring容器初始化时,一方面,通过包扫描技术,当在对各实现类进行遍历并设遍 历到实现类A1时,由于A1上修饰有注解@RouteImpl,那么可继续遍历A1所实现的各接口;其中,当遍历到接口C2时,由于C2上修饰有注解@RouteInterface,则可以建立一条路由关系:(β A1C2)->α A1When the Spring container is initialized, on the one hand, through the package scanning technology, when traversing the implementation classes and setting the traversal to the implementation class A1, since A1 is decorated with the annotation @RouteImpl, you can continue to traverse the interfaces implemented by A1 ; Among them, when traversing to the interface C2, since C2 is decorated with the annotation @RouteInterface, a routing relationship can be established: (β A1C2 )->α A1 .
其中,β A1表示实现类A1的注解@RouteImpl中包括的路由参数,γ C2表示C2这一带有@RouteInterface注解的接口,α A1数表示A1这一带有@RouteImpl注解的实现类。 Among them, β A1 represents the routing parameters included in the annotation @RouteImpl of the implementation class A1, γ C2 represents the interface C2 with the @RouteInterface annotation, and α A1 represents the implementation class A1 with the @RouteImpl annotation.
同理,在包扫描结束后,共可获取5条路由关系,分别为:(β A1C2)->α A1、(β A2C2)->α A2、(β A2C4)->α A2、(β A3C4)->α A3和(β A4C4)->α A4Similarly, after the packet scanning, a total of 5 routing relationships can be obtained, namely: (β A1C2 )->α A1 , (β A2C2 )->α A2 , (β A2C4 )->α A2 , (β A3C4 )->α A3 and (β A4C4 )->α A4 .
但,对于图4中的C1这一接口,由于其仅对应A1这一个实现类,并未被修饰有注解@RouteInterface,故在包扫描结束后,则无需建立C1-A1这一路径之间的路由关系。接口C3、C5和C6与C1同理。However, for the interface C1 in Figure 4, since it only corresponds to the implementation class of A1, and has not been modified with the annotation @RouteInterface, there is no need to establish the route between C1-A1 after the packet scanning is completed. Routing relationship. Interfaces C3, C5 and C6 are the same as C1.
另一方面,在Spring容器初始化时,通过包扫描技术,当在对各接口进行遍历并设遍历到接口C2时,由于C2上修饰有注解@RouteInterface,则可以将其BeanDefinition中的各实现类修改为工厂对象FactoryBean,并向FactoryBean传入接口C2的名称,同时将FactoryBean在BeanDefinition中的Primary参数设置为启用状态,从而在包扫描结束后,Spring容器对Bean进行实例化时,Spring容器关于接口C2注入的是动态代理对象,而不再是具体的实现Bean。例如,当遍历到修饰有注解@RouteInterface的接口C2时,接口C2对应的BeanDefinition中将包括有两个实现类,分别为实现类A1和A2,其中,针对于每一个实现类,如针对A1,可以将A1修改为工厂对象FactoryBean_A1,并向FactoryBean_A1传入接口C2的名称,同时将FactoryBean_A1在BeanDefinition中的Primary参数设置为启用状态,从而在包扫描结束后,Spring容器对Bean进行实例化时,Spring容器关于接口C2、实现类A1注入的是动态代理对象,而不再是具体的实现Bean。On the other hand, when the Spring container is initialized, through the package scanning technology, when traversing each interface and setting the traversal to interface C2, since C2 is decorated with the annotation @RouteInterface, each implementation class in its BeanDefinition can be modified For the factory object FactoryBean, and pass the name of the interface C2 to the FactoryBean, and at the same time set the Primary parameter of the FactoryBean in the BeanDefinition to the enabled state, so that when the Spring container instantiates the Bean after the package scanning is completed, the Spring container regarding the interface C2 What is injected is a dynamic proxy object, rather than a specific implementation Bean. For example, when traversing to the interface C2 decorated with the annotation @RouteInterface, the BeanDefinition corresponding to the interface C2 will include two implementation classes, namely the implementation classes A1 and A2, among which, for each implementation class, such as for A1, You can modify A1 to the factory object FactoryBean_A1, and pass the name of the interface C2 to FactoryBean_A1, and set the Primary parameter of FactoryBean_A1 in BeanDefinition to the enabled state, so that after the package scanning is completed, when the Spring container instantiates the bean, Spring What the container injects with respect to the interface C2 and the implementation class A1 is a dynamic proxy object instead of a specific implementation bean.
但,对于遍历到接口C1时,由于C1上未修饰有注解@RouteInterface,则无需将其BeanDefinition中的唯一实现类修改为工厂对象FactoryBean;且,对于该种情况,在包扫描结束后,Spring容器对Bean进行实例化时,Spring容器关于接口C1、实现类A1注入的将是具体的实现Bean。However, when traversing to interface C1, since there is no @RouteInterface annotation on C1, there is no need to modify the only implementation class in its BeanDefinition to the factory object FactoryBean; and, for this case, after the package scanning is completed, the Spring container When instantiating the Bean, the Spring container injects the interface C1 and the implementation class A1 into specific implementation beans.
在本申请的某些实施中,通过面向切面编程AOP,将所述业务请求中的路由参数保存于线程局部变量ThreadLocal中;所述动态代理对象从所述ThreadLocal中获取所述业务请求中的路由参数。In some implementations of the present application, the routing parameters in the business request are saved in the thread local variable ThreadLocal through aspect-oriented programming AOP; the dynamic proxy object obtains the routing in the business request from the ThreadLocal parameter.
运行时动态代理对象需要依据路由参数和路由关系确定实现类。由于Spring容器启动过程获取了路由关系,接下来需要获取路由参数。路由参数会包含路由字段。为避免在控制器的每个方法中都编写路由字段获取逻辑,本申请实施例中采用AOP技术处理用户请求,统一将路由参数保存于ThreadLocal。The runtime dynamic proxy object needs to determine the implementation class according to the routing parameters and routing relationship. Since the Spring container startup process has obtained the routing relationship, the routing parameters need to be obtained next. Route parameters will contain route fields. In order to avoid writing routing field acquisition logic in each method of the controller, the embodiment of the present application uses AOP technology to process user requests, and uniformly saves routing parameters in ThreadLocal.
在控制器中注入指定服务接口,即带有接口注解的接口时,会因为BeanDefinition被修改,以及Primary参数带来的优先级关系,实际上注入的是动态代理对象。控制器处理客户请求过程中会调用服务接口中的方法,此时交由动态代理对象处理。动态代理对象中保存着原接口信息γ,并从ThreadLocal中取出路由参数β,根据路由规则(β,γ)->α得到实现对象,通过反射技术调用同名方法。When the specified service interface is injected into the controller, that is, the interface with interface annotations, because the BeanDefinition is modified and the priority relationship brought by the Primary parameter, the dynamic proxy object is actually injected. The controller will call the method in the service interface during the process of processing the client request, which will be handled by the dynamic proxy object at this time. The original interface information γ is saved in the dynamic proxy object, and the routing parameter β is taken out from ThreadLocal, and the implementation object is obtained according to the routing rule (β, γ)->α, and the method with the same name is called through reflection technology.
例如,基于图4所示的接口-实现类的对应关系,设接收到的业务请求对应的接口为C2时,由于C2被配置有A1和A2两个实现类,因此C2上被修饰有注解@RouteInterface, 从而说明Spring容器在对Bean进行实例化时,Spring容器关于接口C2注入的是动态代理对象;此时假设该动态代理对象关于该业务请求保存于ThreadLocal中的路由参数获取到的是β A1,则表示该动态代理对象可根据路由参数β A1和路由关系(β A1C2)->α A1找到具体的实现bean,并调用该bean的同名方法来对该业务请求进行处理。 For example, based on the interface-implementation class correspondence shown in Figure 4, when the interface corresponding to the received service request is C2, since C2 is configured with two implementation classes A1 and A2, C2 is decorated with the annotation @ RouteInterface, which shows that when the Spring container instantiates the Bean, the Spring container injects the dynamic proxy object into the interface C2; at this time, it is assumed that the dynamic proxy object obtains β A1 for the routing parameters stored in the ThreadLocal of the business request , it means that the dynamic proxy object can find the specific implementation bean according to the routing parameter β A1 and the routing relationship (β A1 , γ C2 ) -> α A1 , and call the method of the same name of the bean to process the service request.
在本申请的某些实施中,若确定所述接口中注入的是实现对象,获取所述接口的第二实现类;所述实现对象是所述Spring容器基于BeanDefinition实例化得到的,所述接口与所述第二实现类一一对应;通过所述第二实现类的实例对所述业务请求进行处理。In some implementations of the present application, if it is determined that the injection in the interface is an implementation object, obtain the second implementation class of the interface; the implementation object is obtained by instantiating the Spring container based on BeanDefinition, and the interface One-to-one correspondence with the second implementation class; the service request is processed through the instance of the second implementation class.
对于一业务请求,若该业务请求对应的接口并非为在控制器中注入的指定服务接口,即该接口并不带有接口注解,那么可因为该接口实例化过程中实际上注入的是具体的实现Bean,控制器可直接调用与实现Bean对应的实现类来对该业务请求进行处理。For a business request, if the interface corresponding to the business request is not the specified service interface injected in the controller, that is, the interface does not have interface annotations, then it may be because the interface is actually injected during the instantiation process of the interface. To implement the Bean, the controller can directly call the implementation class corresponding to the implemented Bean to process the service request.
例如,基于图4所示的接口-实现类的对应关系,设接收到的业务请求对应的接口为C1时,由于C1仅被配置有A1一个实现类,因此C1上未被修饰有注解@RouteInterface,从而说明Spring容器在对Bean进行实例化时,Spring容器关于接口C1注入的是具体的实现Bean(实现对象),因此控制器可直接调用接口C1的实现类(即A1)的实例来对业务请求进行处理。For example, based on the interface-implementation class correspondence shown in Figure 4, when the interface corresponding to the received service request is C1, since C1 is only configured with an implementation class of A1, C1 is not modified with the annotation @RouteInterface , which shows that when the Spring container instantiates the Bean, the Spring container injects the specific implementation Bean (implementation object) about the interface C1, so the controller can directly call the instance of the implementation class (ie A1) of the interface C1 to implement the business The request is processed.
基于同样的构思,本申请实施例提供一种请求处理装置,适用于Spring开源框架。如图5所示,为本申请实施例提供的一种请求处理装置的示意图,该装置包括接口确定单元501、实现类确定单元502和处理单元503;Based on the same idea, the embodiment of the present application provides a request processing device, which is applicable to the Spring open source framework. As shown in FIG. 5 , it is a schematic diagram of a request processing device provided in the embodiment of the present application, which includes an interface determination unit 501, an implementation class determination unit 502, and a processing unit 503;
接口确定单元501,用于针对接收的业务请求,确定所述业务请求对应的接口;An interface determining unit 501, configured to determine an interface corresponding to the service request for the received service request;
实现类确定单元502,用于若确定所述接口中注入的是动态代理对象,通过所述业务请求中的路由参数和所述接口的接口信息,从预设路由关系中确定所述接口的第一实现类;其中,动态代理对象是Spring容器基于建模对象BeanDefinition中的工厂对象FactoryBean实例化得到的;所述预设路由关系设置有路由参数+接口信息与实现类的映射关系;The implementation class determination unit 502 is configured to determine the first route of the interface from the preset routing relationship through the routing parameters in the service request and the interface information of the interface if it is determined that the injection into the interface is a dynamic proxy object. An implementation class; wherein, the dynamic proxy object is obtained by the Spring container based on the instantiation of the factory object FactoryBean in the modeling object BeanDefinition; the preset routing relationship is provided with routing parameters+interface information and the mapping relationship of the implementation class;
处理单元503,用于通过所述第一实现类的实例对所述业务请求进行处理。The processing unit 503 is configured to process the service request through the instance of the first implementation class.
进一步的,对于该装置,还包括动态代理对象生成单元504;动态代理对象生成单元504,用于:针对任一接口,若所述接口设置有接口注解,则将所述接口的BeanDefinition指示的对象Bean的实现类修改为FactoryBean,并向所述FactoryBean传入所述接口的接口信息;所述FactoryBean用于实例化所述Bean得到所述接口的动态代理对象。Further, for the device, it also includes a dynamic proxy object generation unit 504; the dynamic proxy object generation unit 504 is configured to: for any interface, if the interface is provided with an interface annotation, the object indicated by the BeanDefinition of the interface The implementation class of the Bean is changed to FactoryBean, and the interface information of the interface is transferred to the FactoryBean; the FactoryBean is used to instantiate the Bean to obtain a dynamic proxy object of the interface.
进一步的,对于该装置,动态代理对象生成单元504,具体用于:设置所述BeanDefinition中的Primary参数的启用状态;Spring容器在实例化所述Bean时,基于所述Primary参数的启用状态,通过所述FactoryBean实例化所述Bean得到所述接口的动态代理对象。Further, for this device, the dynamic proxy object generation unit 504 is specifically used to: set the enabled state of the Primary parameter in the BeanDefinition; when the Spring container instantiates the Bean, based on the enabled state of the Primary parameter, through The FactoryBean instantiates the Bean to obtain the dynamic proxy object of the interface.
进一步的,对于该装置,还包括注解确定单元505;注解确定单元505,用于:Spring容器在接收到启动指令后,通过包扫描技术遍历各BeanDefinition;针对任一BeanDefinition,确定所述BeanDefinition指示的Bean是否对应接口及是否有接口注解;若确定所述BeanDefinition指示的Bean未对应接口,则确定所述BeanDefinition指示的Bean对应的实现类是否包括类注解。Further, for the device, an annotation determination unit 505 is also included; the annotation determination unit 505 is used for: after the Spring container receives the startup instruction, it traverses each BeanDefinition through the package scanning technology; for any BeanDefinition, determine the BeanDefinition indicated by the BeanDefinition Whether the Bean corresponds to the interface and whether there is an interface annotation; if it is determined that the Bean indicated by the BeanDefinition does not correspond to the interface, then determine whether the implementation class corresponding to the Bean indicated by the BeanDefinition includes class annotations.
进一步的,对于该装置,还包括路由关系获取单元506;路由关系获取单元506,用于:针对任一实现类,若所述实现类设置有类注解,则遍历所述实现类所实现的各接口; 针对各接口中任一接口,若所述接口设置有接口注解,则构建所述接口与所述实现类的路由关系;所述接口与所述实现类的路由关系设置有所述类注解中携带的路由参数+所述接口的接口信息与所述实现类的映射关系。Further, for the device, it also includes a routing relationship acquisition unit 506; the routing relationship acquisition unit 506 is configured to: for any implementation class, if the implementation class is provided with class annotations, then traverse each implementation class implemented by the implementation class Interface; For any interface in each interface, if the interface is provided with an interface annotation, then construct the routing relationship between the interface and the implementation class; the routing relationship between the interface and the implementation class is set with the class annotation The routing parameters carried in + the mapping relationship between the interface information of the interface and the implementation class.
进一步的,对于该装置,还包括路由参数获取单元507;路由参数获取单元507,用于:通过面向切面编程AOP,将所述业务请求中的路由参数保存于线程局部变量ThreadLocal中;所述动态代理对象从所述ThreadLocal中获取所述业务请求中的路由参数。Further, for the device, it also includes a routing parameter acquisition unit 507; the routing parameter acquisition unit 507 is used to: save the routing parameters in the service request in the thread local variable ThreadLocal through the aspect-oriented programming AOP; the dynamic The proxy object obtains the routing parameters in the service request from the ThreadLocal.
进一步的,对于该装置,实现类确定单元502,还用于:若确定所述接口中注入的是实现对象,获取所述接口的第二实现类;所述实现对象是所述Spring容器基于BeanDefinition实例化得到的,所述接口与所述第二实现类一一对应;处理单元,还用于通过所述第二实现类的实例对所述业务请求进行处理。Further, for this device, the implementation class determination unit 502 is also used for: if it is determined that the injection in the interface is an implementation object, obtain the second implementation class of the interface; the implementation object is the Spring container based on BeanDefinition obtained by instantiation, the interface is in one-to-one correspondence with the second implementation class; the processing unit is further configured to process the service request through the instance of the second implementation class.
本申请实施例还提供了一种计算设备,该计算设备具体可以为桌面计算机、便携式计算机、智能手机、平板电脑、个人数字助理(Personal Digital Assistant,PDA)等。该计算设备可以包括中央处理器(Center Processing Unit,CPU)、存储器、输入/输出设备等,输入设备可以包括键盘、鼠标、触摸屏等,输出设备可以包括显示设备,如液晶显示器(Liquid Crystal Display,LCD)、阴极射线管(Cathode Ray Tube,CRT)等。The embodiment of the present application also provides a computing device, which may specifically be a desktop computer, a portable computer, a smart phone, a tablet computer, a personal digital assistant (Personal Digital Assistant, PDA), etc. The computing device may include a central processing unit (Center Processing Unit, CPU), memory, input/output devices, etc., the input device may include a keyboard, mouse, touch screen, etc., and the output device may include a display device, such as a liquid crystal display (Liquid Crystal Display, LCD), cathode ray tube (Cathode Ray Tube, CRT), etc.
存储器,可以包括只读存储器(ROM)和随机存取存储器(RAM),并向处理器提供存储器中存储的程序指令和数据。在本申请实施例中,存储器可以用于存储请求处理方法的程序指令;The memory, which may include read-only memory (ROM) and random-access memory (RAM), provides the processor with program instructions and data stored in the memory. In the embodiment of the present application, the memory may be used to store program instructions of the request processing method;
处理器,用于调用所述存储器中存储的程序指令,按照获得的程序执行请求处理方法。The processor is configured to call the program instructions stored in the memory, and execute the request processing method according to the obtained program.
如图6所示,为本申请实施例提供的一种计算设备的示意图,该计算设备包括:As shown in FIG. 6, it is a schematic diagram of a computing device provided in the embodiment of the present application. The computing device includes:
处理器601、存储器602、收发器603、总线接口604;其中,处理器601、存储器602与收发器603之间通过总线605连接;A processor 601, a memory 602, a transceiver 603, and a bus interface 604; wherein, the processor 601, the memory 602, and the transceiver 603 are connected through a bus 605;
所述处理器601,用于读取所述存储器602中的程序,执行上述请求处理方法;The processor 601 is configured to read the program in the memory 602, and execute the above request processing method;
处理器601可以是中央处理器(central processing unit,简称CPU),网络处理器(network processor,简称NP)或者CPU和NP的组合。还可以是硬件芯片。上述硬件芯片可以是专用集成电路(application-specific integrated circuit,简称ASIC),可编程逻辑器件(programmable logic device,简称PLD)或其组合。上述PLD可以是复杂可编程逻辑器件(complex programmable logic device,简称CPLD),现场可编程逻辑门阵列(field-programmable gate array,简称FPGA),通用阵列逻辑(generic array logic,简称GAL)或其任意组合。The processor 601 may be a central processing unit (central processing unit, CPU for short), a network processor (network processor, NP for short), or a combination of CPU and NP. It may also be a hardware chip. The aforementioned hardware chip may be an application-specific integrated circuit (ASIC for short), a programmable logic device (PLD for short), or a combination thereof. The above-mentioned PLD can be a complex programmable logic device (complex programmable logic device, CPLD for short), a field-programmable gate array (field-programmable gate array, FPGA for short), a generic array logic (generic array logic, GAL for short) or any combination.
所述存储器602,用于存储一个或多个可执行程序,可以存储所述处理器601在执行操作时所使用的数据。The memory 602 is used to store one or more executable programs, and may store data used by the processor 601 when performing operations.
具体地,程序可以包括程序代码,程序代码包括计算机操作指令。存储器602可以包括易失性存储器(volatile memory),例如随机存取存储器(random-access memory,简称RAM);存储器602也可以包括非易失性存储器(non-volatile memory),例如快闪存储器(flash memory),硬盘(hard disk drive,简称HDD)或固态硬盘(solid-state drive,简称SSD);存储器602还可以包括上述种类的存储器的组合。Specifically, the program may include program code, and the program code includes computer operation instructions. The memory 602 may include a volatile memory (volatile memory), such as a random-access memory (random-access memory, RAM for short); the memory 602 may also include a non-volatile memory (non-volatile memory), such as a flash memory ( flash memory), hard disk (hard disk drive, referred to as HDD) or solid-state drive (solid-state drive, referred to as SSD); the memory 602 may also include a combination of the above-mentioned types of memory.
存储器602存储了如下的元素,可执行模块或者数据结构,或者它们的子集,或者它们的扩展集:The memory 602 stores the following elements, executable modules or data structures, or their subsets, or their extended sets:
操作指令:包括各种操作指令,用于实现各种操作。Operation instructions: include various operation instructions for realizing various operations.
操作系统:包括各种系统程序,用于实现各种基础业务以及处理基于硬件的任务。Operating system: includes various system programs for implementing various basic services and processing hardware-based tasks.
总线605可以是外设部件互连标准(peripheral component interconnect,简称PCI)总线或扩展工业标准结构(extended industry standard architecture,简称EISA)总线等。总线可以分为地址总线、数据总线、控制总线等。为便于表示,图6中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。The bus 605 may be a peripheral component interconnect standard (PCI for short) bus or an extended industry standard architecture (EISA for short) bus or the like. The bus can be divided into address bus, data bus, control bus and so on. For ease of representation, only one thick line is used in FIG. 6 , but it does not mean that there is only one bus or one type of bus.
总线接口604可以为有线通信接入口,无线总线接口或其组合,其中,有线总线接口例如可以为以太网接口。以太网接口可以是光接口,电接口或其组合。无线总线接口可以为WLAN接口。The bus interface 604 may be a wired communication access interface, a wireless bus interface or a combination thereof, wherein the wired bus interface may be, for example, an Ethernet interface. The Ethernet interface can be an optical interface, an electrical interface or a combination thereof. The wireless bus interface may be a WLAN interface.
本申请实施例还提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机可执行指令,所述计算机可执行指令用于使计算机执行请求处理方法。The embodiment of the present application also provides a computer-readable storage medium, where the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to cause a computer to execute the request processing method.
本领域内的技术人员应明白,本申请的实施例可提供为方法、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art should understand that the embodiments of the present application may be provided as methods or computer program products. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
本申请是参照根据本申请实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present application is described with reference to flowcharts and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present application. It should be understood that each procedure and/or block in the flowchart and/or block diagram, and a combination of procedures and/or blocks in the flowchart and/or block diagram can be realized by computer program instructions. These computer program instructions may be provided to a general purpose computer, special purpose computer, embedded processor, or processor of other programmable data processing equipment to produce a machine such that the instructions executed by the processor of the computer or other programmable data processing equipment produce a An apparatus for realizing the functions specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to operate in a specific manner, such that the instructions stored in the computer-readable memory produce an article of manufacture comprising instruction means, the instructions The device realizes the function specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing device, causing a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, thereby The instructions provide steps for implementing the functions specified in the flow chart or blocks of the flowchart and/or the block or blocks of the block diagrams.
尽管已描述了本申请的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例作出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本申请范围的所有变更和修改。While preferred embodiments of the present application have been described, additional changes and modifications can be made to these embodiments by those skilled in the art once the basic inventive concept is appreciated. Therefore, the appended claims are intended to be construed to cover the preferred embodiment and all changes and modifications which fall within the scope of the application.
显然,本领域的技术人员可以对本申请进行各种改动和变型而不脱离本申请的精神和范围。这样,倘若本申请的这些修改和变型属于本申请权利要求及其等同技术的范围之内,则本申请也意图包含这些改动和变型在内。Obviously, those skilled in the art can make various changes and modifications to the application without departing from the spirit and scope of the application. In this way, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalent technologies, the present application is also intended to include these modifications and variations.

Claims (10)

  1. 一种请求处理方法,其特征在于,适用于Spring开源框架;所述方法包括:A kind of request processing method is characterized in that, is applicable to Spring open source framework; Described method comprises:
    针对接收的业务请求,确定所述业务请求对应的接口;For the received service request, determine the interface corresponding to the service request;
    若确定所述接口中注入的是动态代理对象,则通过所述业务请求中的路由参数和所述接口的接口信息,从预设路由关系中确定所述接口的第一实现类;其中,动态代理对象是Spring容器基于建模对象BeanDefinition中的工厂对象FactoryBean实例化得到的;所述预设路由关系设置有路由参数+接口信息与实现类的映射关系;If it is determined that the injection into the interface is a dynamic proxy object, then determine the first implementation class of the interface from the preset routing relationship through the routing parameters in the service request and the interface information of the interface; wherein, dynamic The proxy object is instantiated by the Spring container based on the factory object FactoryBean in the modeling object BeanDefinition; the preset routing relationship is provided with a mapping relationship between routing parameters+interface information and implementation classes;
    通过所述第一实现类的实例对所述业务请求进行处理。The service request is processed through the instance of the first implementation class.
  2. 如权利要求1所述的方法,其特征在于,The method of claim 1, wherein
    所述动态代理对象是Spring容器基于建模对象BeanDefinition中的工厂对象FactoryBean实例化得到的,包括:The dynamic proxy object is obtained by the Spring container based on the instantiation of the factory object FactoryBean in the modeling object BeanDefinition, including:
    针对任一接口,若所述接口设置有接口注解,则将所述接口的BeanDefinition指示的对象Bean的实现类修改为FactoryBean,并向所述FactoryBean传入所述接口的接口信息;所述FactoryBean用于实例化所述Bean得到所述接口的动态代理对象。For any interface, if the interface is provided with interface annotations, then the implementation class of the object Bean indicated by the BeanDefinition of the interface is modified to FactoryBean, and the interface information of the interface is passed in to the FactoryBean; Obtain the dynamic proxy object of the interface by instantiating the bean.
  3. 如权利要求2所述的方法,其特征在于,所述FactoryBean用于实例化所述Bean得到所述接口的动态代理对象,包括:The method according to claim 2, wherein said FactoryBean is used to instantiate said Bean to obtain a dynamic proxy object of said interface, comprising:
    设置所述BeanDefinition中的Primary参数的启用状态;Set the enabled state of the Primary parameter in the BeanDefinition;
    Spring容器在实例化所述Bean时,基于所述Primary参数的启用状态,通过所述FactoryBean实例化所述Bean得到所述接口的动态代理对象。When instantiating the Bean, the Spring container instantiates the Bean through the FactoryBean based on the enabled state of the Primary parameter to obtain the dynamic proxy object of the interface.
  4. 如权利要求2所述的方法,其特征在于,通过如下方式确定所述接口是否设置有接口注解,包括:The method according to claim 2, wherein determining whether the interface is provided with an interface annotation is performed in the following manner, comprising:
    Spring容器在接收到启动指令后,通过包扫描技术遍历各BeanDefinition;针对任一BeanDefinition,确定所述BeanDefinition指示的Bean是否对应接口及是否有接口注解;After the Spring container receives the startup command, it traverses each BeanDefinition through the package scanning technology; for any BeanDefinition, it is determined whether the Bean indicated by the BeanDefinition corresponds to the interface and whether there is an interface annotation;
    若确定所述BeanDefinition指示的Bean未对应接口,则确定所述BeanDefinition指示的Bean对应的实现类是否包括类注解。If it is determined that the Bean indicated by the BeanDefinition does not correspond to an interface, it is determined whether the implementation class corresponding to the Bean indicated by the BeanDefinition includes a class annotation.
  5. 如权利要求1所述的方法,其特征在于,The method of claim 1, wherein
    所述预设路由关系是通过如下方式得到的,包括:The preset routing relationship is obtained through the following methods, including:
    针对任一实现类,若所述实现类设置有类注解,则遍历所述实现类所实现的各接口;For any implementation class, if the implementation class is provided with class annotations, then traverse each interface implemented by the implementation class;
    针对各接口中任一接口,若所述接口设置有接口注解,则构建所述接口与所述实现类的路由关系;所述接口与所述实现类的路由关系设置有所述类注解中携带的路由参数+所述接口的接口信息与所述实现类的映射关系。For any interface in each interface, if the interface is provided with an interface annotation, then construct the routing relationship between the interface and the implementation class; the routing relationship between the interface and the implementation class is set to be carried in the class annotation routing parameters + the mapping relationship between the interface information of the interface and the implementation class.
  6. 如权利要求1-5任一项所述的方法,其特征在于,The method according to any one of claims 1-5, characterized in that,
    所述动态代理对象通过如下方式得到所述业务请求中的路由参数,包括:The dynamic proxy object obtains the routing parameters in the service request through the following methods, including:
    通过面向切面编程AOP,将所述业务请求中的路由参数保存于线程局部变量ThreadLocal中;By aspect-oriented programming AOP, the routing parameters in the service request are stored in the thread local variable ThreadLocal;
    所述动态代理对象从所述ThreadLocal中获取所述业务请求中的路由参数。The dynamic proxy object obtains the routing parameters in the service request from the ThreadLocal.
  7. 如权利要求1所述的方法,其特征在于,所述方法还包括:The method of claim 1, further comprising:
    若确定所述接口中注入的是实现对象,则获取所述接口的第二实现类;所述实现对象是所述Spring容器基于BeanDefinition实例化得到的,所述接口与所述第二实现类一一对 应;If it is determined that the injection in the interface is an implementation object, then obtain the second implementation class of the interface; the implementation object is obtained by the Spring container based on BeanDefinition instantiation, and the interface is the same as the second implementation class one-to-one correspondence;
    通过所述第二实现类的实例对所述业务请求进行处理。The service request is processed through the instance of the second implementation class.
  8. 一种请求处理装置,其特征在于,适用于Spring开源框架;所述装置包括:A kind of request processing device is characterized in that, is applicable to Spring open source framework; Described device comprises:
    接口确定单元,用于针对接收的业务请求,确定所述业务请求对应的接口;An interface determination unit, configured to determine an interface corresponding to the service request for the received service request;
    实现类确定单元,用于若确定所述接口中注入的是动态代理对象,则通过所述业务请求中的路由参数和所述接口的接口信息,从预设路由关系中确定所述接口的第一实现类;其中,动态代理对象是Spring容器基于建模对象BeanDefinition中的工厂对象FactoryBean实例化得到的;所述预设路由关系设置有路由参数+接口信息与实现类的映射关系;An implementation class determining unit, configured to determine the first route of the interface from the preset routing relationship through the routing parameters in the service request and the interface information of the interface if it is determined that the injection into the interface is a dynamic proxy object. An implementation class; wherein, the dynamic proxy object is obtained by the Spring container based on the instantiation of the factory object FactoryBean in the modeling object BeanDefinition; the preset routing relationship is provided with routing parameters+interface information and the mapping relationship of the implementation class;
    处理单元,用于通过所述第一实现类的实例对所述业务请求进行处理。A processing unit, configured to process the service request through the instance of the first implementation class.
  9. 一种计算机设备,其特征在于,包括:A computer device, characterized in that it includes:
    存储器,用于存储计算机程序;memory for storing computer programs;
    处理器,用于调用所述存储器中存储的计算机程序,按照获得的程序执行如权利要求1-7任一项所述的方法。A processor, configured to call the computer program stored in the memory, and execute the method according to any one of claims 1-7 according to the obtained program.
  10. 一种计算机可读存储介质,其特征在于,所述存储介质存储有计算机可执行指令,所述计算机可执行指令用于使计算机执行如权利要求1-7任一项所述的方法。A computer-readable storage medium, wherein the storage medium stores computer-executable instructions, and the computer-executable instructions are used to cause a computer to execute the method according to any one of claims 1-7.
PCT/CN2022/120218 2021-12-03 2022-09-21 Request processing method and apparatus WO2023098241A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111461675.2 2021-12-03
CN202111461675.2A CN114090193A (en) 2021-12-03 2021-12-03 Request processing method and device

Publications (1)

Publication Number Publication Date
WO2023098241A1 true WO2023098241A1 (en) 2023-06-08

Family

ID=80306547

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/120218 WO2023098241A1 (en) 2021-12-03 2022-09-21 Request processing method and apparatus

Country Status (2)

Country Link
CN (1) CN114090193A (en)
WO (1) WO2023098241A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116795426A (en) * 2023-08-21 2023-09-22 智慧眼科技股份有限公司 Data processing method and system
CN117056317A (en) * 2023-10-11 2023-11-14 腾讯科技(深圳)有限公司 Data processing method, device, equipment and computer readable storage medium

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114090193A (en) * 2021-12-03 2022-02-25 深圳前海微众银行股份有限公司 Request processing method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6877163B1 (en) * 1999-06-14 2005-04-05 Sun Microsystems, Inc. Method and system for dynamic proxy classes
CN1779636A (en) * 2004-11-28 2006-05-31 中兴通讯股份有限公司 Method for constructing coupling system
CN111259067A (en) * 2020-01-21 2020-06-09 褚晶晶 Method, device and equipment for realizing DAO interface based on Spring
CN111831365A (en) * 2020-07-29 2020-10-27 中国平安财产保险股份有限公司 Interface route forwarding method, system, computer equipment and readable storage medium
CN114090193A (en) * 2021-12-03 2022-02-25 深圳前海微众银行股份有限公司 Request processing method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6877163B1 (en) * 1999-06-14 2005-04-05 Sun Microsystems, Inc. Method and system for dynamic proxy classes
CN1779636A (en) * 2004-11-28 2006-05-31 中兴通讯股份有限公司 Method for constructing coupling system
CN111259067A (en) * 2020-01-21 2020-06-09 褚晶晶 Method, device and equipment for realizing DAO interface based on Spring
CN111831365A (en) * 2020-07-29 2020-10-27 中国平安财产保险股份有限公司 Interface route forwarding method, system, computer equipment and readable storage medium
CN114090193A (en) * 2021-12-03 2022-02-25 深圳前海微众银行股份有限公司 Request processing method and device

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116795426A (en) * 2023-08-21 2023-09-22 智慧眼科技股份有限公司 Data processing method and system
CN116795426B (en) * 2023-08-21 2023-11-10 智慧眼科技股份有限公司 Data processing method and system
CN117056317A (en) * 2023-10-11 2023-11-14 腾讯科技(深圳)有限公司 Data processing method, device, equipment and computer readable storage medium
CN117056317B (en) * 2023-10-11 2024-01-26 腾讯科技(深圳)有限公司 Data processing method, device, equipment and computer readable storage medium

Also Published As

Publication number Publication date
CN114090193A (en) 2022-02-25

Similar Documents

Publication Publication Date Title
WO2023098241A1 (en) Request processing method and apparatus
US9110581B2 (en) Touch support for remoted applications
US11036345B2 (en) System and method for on-screen graphical user interface encapsulation and reproduction
US11262884B1 (en) Managing application windows of applications from different servers within a same browser window on a user device
US20160006800A1 (en) Peer to peer remote application discovery
CN105807966B (en) Method and device for acquiring touch screen event
KR20220001008A (en) Distributed training method and system, device and storage medium
US11283866B2 (en) Providing remote access to applications through interface hooks
JP2021096857A (en) Data processing method, device, electronic apparatus, and storage medium
WO2020052337A1 (en) Information processing method and apparatus, storage medium, and electronic device
CN106529408B (en) A kind of method and device of Face datection
US11075976B2 (en) Remoting application user interfaces
WO2023065707A1 (en) Method and apparatus for page display
US11843674B2 (en) Virtual workspace experience visualization and optimization
CN109471626B (en) Page logic structure, page generation method, page data processing method and device
CN109828820B (en) Focus refreshing method and device of application window, storage medium and terminal
WO2021238596A1 (en) Interface calling method and apparatus, and computer-readable storage medium
KR20170030602A (en) Method and device for setting background of ui control and terminal
TW201941132A (en) Information display method, apparatus and device
US20150007130A1 (en) Software development using gestures
US10310863B1 (en) Patching functions in use on a running computer system
US20140379634A1 (en) Application-to-repository data mapping in data repositories, and related methods, systems, and computer-readable media
EP3828739A2 (en) Parallelization of authentication strategies
WO2021057811A1 (en) Network node processing method, device, storage medium, and electronic apparatus
US20180300189A1 (en) Hybrid remote controller

Legal Events

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

Ref document number: 22900049

Country of ref document: EP

Kind code of ref document: A1