接口 ModelAndViewResolver


  • public interface ModelAndViewResolver
    SPI for resolving custom return values from a specific handler method. Typically implemented to detect special return types, resolving well-known result values for them.

    A typical implementation could look like as follows:

     public class MyModelAndViewResolver implements ModelAndViewResolver {
    
         public ModelAndView resolveModelAndView(Method handlerMethod, Class handlerType,
                 Object returnValue, ExtendedModelMap implicitModel, NativeWebRequest webRequest) {
             if (returnValue instanceof MySpecialRetVal.class)) {
                 return new MySpecialRetVal(returnValue);
             }
             return UNRESOLVED;
         }
     }
    从以下版本开始:
    3.0
    作者:
    Arjen Poutsma