Spring Boot 中的 REST API 调用期间调用的第一个函数是什么?
我想设置一个断点以进行调试。我从 Postman 调用一个 REST API,我想检查 Java 应用程序获得调用的第一个点。有听众吗?在哪里设置断点?
I would like to set a breakpoint for debugging purpose. I call a rest api from Postman and I would like to check the very first point where the java application gets the call. Is there a listener? Where to set the breakpoint?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我猜 DispatcherServlet 就是您要寻找的内容。之前还有很多其他东西在运行,例如 servlet 容器和潜在的 servlet 过滤器,但是 DispatcherServlet 是调试 Spring MVC 问题的一个很好的起点。
文档也相当不错: https ://docs.spring.io/spring-framework/docs/current/reference/html/web.html#mvc-servlet
对于 Spring MVC Webflux 应用程序,请查看 DispatcherHandler 和在
public Mono中设置断点句柄(ServerWebExchange交换)
。I guess the DispatcherServlet is what you are looking for. There is a lot of other stuff running before e.g. the servlet container and potential servlet filter, but the
DispatcherServlet
is a good starting point for debugging Spring MVC issues.The documentation is also quite good: https://docs.spring.io/spring-framework/docs/current/reference/html/web.html#mvc-servlet
For Spring MVC Webflux applications have a look at DispatcherHandler and set a breakpoint in
public Mono<Void> handle(ServerWebExchange exchange)
.