本文共 859 字,大约阅读时间需要 2 分钟。
/** * 配置了自己的解析器 */public static class MyViewResolver implements ViewResolver{ @Override public View resolveViewName(String viewName, Locale locale) throws Exception { return null; }}
/** * 扩展MVC,但是不覆盖 */@Configurationpublic class MyMvcConfig implements WebMvcConfigurer{ /** * 注入到 Spring IoC 容器中 */ @Bean public MyViewResolver myViewResolver(){ return new MyViewResolver(); }; /** * 配置了自己的解析器 */ public static class MyViewResolver implements ViewResolver{ @Override public View resolveViewName(String viewName, Locale locale) throws Exception { return null; } }}
转载地址:http://nqded.baihongyu.com/