Error

javax.servlet.ServletException: Could not resolve view with name 'index' in servlet with name 'dispatcherServlet'

Solution

@Bean
public ViewResolver viewResolver(){

    InternalResourceViewResolver resolver = new InternalResourceViewResolver();
    resolver.setCache(true);
    resolver.setPrefix("XXX");
    resolver.setSuffix("XXX");
    resolver.setExposeContextBeansAsAttributes(true);
    resolver.setContentType("XXX");
    return resolver;
}