【发布时间】:2022-01-14 10:18:44
【问题描述】:
我有一段代码如下,
final Entry<RequestMappingInfo, HandlerMethod> e = mappingHandler.getHandlerMethods()
.entrySet()
.stream()
.filter(entry -> entry.getKey().getMatchingCondition(request) != null)
.findFirst()
.orElse(null);
在 spring-boot 版本 2.3.8.RELEASE 中运行良好,但如果我将其升级到 2.4.13,它会引发如下异常,
java.lang.IllegalArgumentException: Expected lookupPath in request attribute "org.springframework.web.util.UrlPathHelper.PATH".
at org.springframework.util.Assert.notNull(Assert.java:201)
at org.springframework.web.util.UrlPathHelper.getResolvedLookupPath(UrlPathHelper.java:213)
at org.springframework.web.servlet.mvc.condition.PatternsRequestCondition.getMatchingCondition(PatternsRequestCondition.java:280)
at org.springframework.web.servlet.mvc.method.RequestMappingInfo.getMatchingCondition(RequestMappingInfo.java:406)
我尝试在网上查找并找到https://github.com/spring-projects/spring-framework/issues/27715,但我无法联系起来,因为该问题说明了有关自己构建映射的内容,而我根本没有这样做。我正在使用命中上述代码的 MockMvc 对象调用 Rest Endpoint。
【问题讨论】:
标签: java spring spring-boot spring-mvc