如何在spring4中配置多个视图解析器?

时间:2016-12-27 10:12:35

标签: java spring-mvc spring-4

如何在spring4中配置多个视图解析器以防止它们之间发生冲突?例如:

@Bean
    public ViewResolver viewResolver() {
        InternalResourceViewResolver resolver = new InternalResourceViewResolver();
        resolver.setPrefix("/WEB-INF/views/");
        resolver.setSuffix(".jsp");
        resolver.setExposeContextBeansAsAttributes(true);
        return resolver;
    }

@Bean
    public ViewResolver viewResolver() {
        return new TilesViewResolver();
    }

互联网上有xml配置的解释,但我还没有看到任何spring4 java配置。

1 个答案:

答案 0 :(得分:2)