Tenho tentando configurar o springMVC para utilizar o thymeleaf , mas ao executar o projeto acontece alguns erros como : pagina não encontrada, ou pior ainda, HTTP Status 500 - Could not resolve view with name ‘index’ in servlet with name ‘dispatcher’
tenho algumas classes de configuraçoes :
package br.com.system.config;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
@Configuration
@ComponentScan(“br.com.system”)
@EnableWebMvc
public class RootConfig {
}
package br.com.system.config;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
public class SpringInitConfig extends AbstractAnnotationConfigDispatcherServletInitializer{
@Override
protected Class<?>[] getRootConfigClasses() {
return new Class[] {RootConfig.class};
}
@Override
protected Class<?>[] getServletConfigClasses() {
return new Class[]{SpringMvcConfig.class};
}
@Override
protected String[] getServletMappings() {
return new String[] {"/"};
}
}
package br.com.system.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.ViewResolver;
import org.thymeleaf.ITemplateEngine;
import org.thymeleaf.spring4.SpringTemplateEngine;
import org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver;
import org.thymeleaf.spring4.view.ThymeleafViewResolver;
import org.thymeleaf.templatemode.TemplateMode;
import org.thymeleaf.templateresolver.ITemplateResolver;
@Configuration
public class SpringMvcConfig {
@Autowired
ApplicationContext applicationContext;
@Bean
public ViewResolver thymelafViewResolver(ITemplateEngine templateEngine) {
ThymeleafViewResolver viewResolver = new ThymeleafViewResolver();
viewResolver.setOrder(1);
viewResolver.setTemplateEngine(templateEngine);
viewResolver.setCharacterEncoding("UTF-8");
viewResolver.setViewNames(new String[]{".html"});
return viewResolver;
}
@Bean
public ITemplateEngine templateEngine(ITemplateResolver templateResolver) {
SpringTemplateEngine templateEngine = new SpringTemplateEngine();
templateEngine.setTemplateResolver(templateResolver);
templateEngine.setEnableSpringELCompiler(true);
return null;
}
@Bean
public ITemplateResolver templateResolver() {
SpringResourceTemplateResolver templateResolver = new SpringResourceTemplateResolver();
templateResolver.setApplicationContext(this.applicationContext);
templateResolver.setTemplateMode(TemplateMode.HTML);
templateResolver.setPrefix("/WEB-INF/templates/");
templateResolver.setSuffix(".html");
templateResolver.setCharacterEncoding("UTF-8");
templateResolver.setCacheable(false);
return templateResolver;
}
}
e meu controller com a imagem de onde fica minha página
package br.com.system.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping("/")
public class IndexController {
@RequestMapping("/index")
public String index(){
return "index";
}
}

Antes de sair fazendo as coisas, estude tutoriais, exemplos, etc.
Exemplo que você pode baixar e ver como foi feito:
javaflex agradeço o exemplo que vc me disponibilizou, é… seguinte, esse projeto que postei como tópico, foi feito em um tutorial,mas por algum erro meu não está funcionando , vou olhar seu projeto , mas minha intenção era que alguém me dissesse o que fiz de errado, então não saí fazendo as coisas
Entendi. Tem que levar em consideração que o tutorial possa estar errado também, então tente outros. Quanto mais simples melhor pra você conseguir dar um start.