1

在 Spring Web MVC 中,DispatcherServlet 有一堆标志,例如

detectAllHandlerMappings detectAllHandlerAdapters detectAllHandlerExceptionResolvers detectAllViewResolvers

它允许您在查找应用上下文中所有类型匹配的 bean 和最多查找一个在特定 ID 下匹配的 bean 之间进行选择。它们都默认为真。

我正在尝试为这些找出一个好的用例;具体来说,是否有令人信服的情况我会设置一个错误?

4

1 回答 1

0

例如,“handlerMapping”是一个预定义的 bean id,如果定义则隐式使用(不需要显式连接)。如果使用了多个handlerMappings detectAllHandlerMappings == true,Spring会按类型加载它们,并采用多个URL-to-controller方法策略

于 2008-12-18T00:03:54.797 回答