从Spring5.2.x升级到5.3.x后,错误消息DispatcherServlet.noHandlerFound Message=No mapping for GET /sampler/
样例代码-- https://github.com/hth/sampler与5.2.12lib一起工作得很好
发布于 2021-01-22 12:24:24
这可能与向DispatcherServlet
注册其他bean的change有关。
具体地说,现在5.3.x中加载了DefaultRequestToViewNameTranslator bean,这可能会将URI转换为视图名称。
您可以通过将stripLeadingSlash
、stripExtension
和stripTrailingSlash
属性设置为false
来禁用此行为。
尝试将以下bean定义添加到root-context.xml
文件中。
<bean id="viewNameTranslator" class="org.springframework.web.servlet.view.DefaultRequestToViewNameTranslator">
<property name="stripLeadingSlash" value="false" />
<property name="stripExtension" value="false" />
<property name="stripTrailingSlash" value="false" />
</bean>
https://stackoverflow.com/questions/65710614
复制相似问题