简体   繁体   English

找不到Java接口的实现类

[英]Not able to find the Implementation Class for an Interface in Java

I am trying to modify Openmrs rest call given at this link: https://github.com/openmrs/openmrs-module-webservices.rest/blob/master/omod-common/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/controller/SessionController.java 我正在尝试修改此链接上给出的Openmrs休息电话: https : //github.com/openmrs/openmrs-module-webservices.rest/blob/master/omod-common/src/main/java/org/openmrs/module /webservices/rest/web/v1_0/controller/SessionController.java

It imports a spring framework org.springframework.web.context.request.WebRequest in the code. 它在代码中导入了一个Spring框架org.springframework.web.context.request.WebRequest I am not able to track where in the openmrs repo is the class implementing this interface WebRequest. 我无法跟踪openmrs回购中实现该接口WebRequest的类的位置。

The openmrs repo is given on this link - https://github.com/openmrs/openmrs-module-webservices.rest openmrs仓库在此链接上给出-https: //github.com/openmrs/openmrs-module-webservices.rest

Till now I have come across this small line on Openmrs wiki that says- All of our services are interfaces. 到目前为止,我在Openmrs Wiki上碰到了一条小字:“我们所有的服务都是接口。 The default implementation of these services are named *ServiceImpl.java. 这些服务的默认实现名为* ServiceImpl.java。 The implementations can be found in the impl directory of the api package. 可以在api包的impl目录中找到这些实现。

Can anyone help me in figuring out how to find the implementation class ? 谁能帮助我弄清楚如何找到实现类?

It is Spring's interface. 这是Spring的界面。 So Spring create and inject some implementation of it. 因此,Spring创建并注入了一些实现。

import org.springframework.web.context.request.WebRequest;

If you can run and debug the code, put breakpoint into this controller, make request to this endpoint and than you can figure out implementation class. 如果可以运行和调试代码,则将断点放入此控制器,向该端点发出请求,然后可以找出实现类。

It will be one of these classes according documentation : DispatcherServletWebRequest, FacesWebRequest, NoSupportAsyncWebRequest, PortletWebRequest, ServletWebRequest, StandardServletAsyncWebRequest 根据文档它将是这些类别之一:DispatcherServletWebRequest,FacesWebRequest,NoSupportAsyncWebRequest,PortletWebRequest,ServletWebRequest,StandardServletAsyncWebRequest

By quick find, I couldn't find servlet configuration in that repo. 通过快速查找,我在该存储库中找不到servlet配置。 So really don't know which of this classes it would be. 所以真的不知道它将是哪个类。 DispatcherServletWebRequest is most common because Spring MVC is mostly used with Spring's DispatcherServlet filter. DispatcherServletWebRequest是最常见的,因为Spring MVC通常与Spring的DispatcherServlet过滤器一起使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM