java – localhost: 8080 no function

Como podeis observar, he chooses the Web.xml

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
Import javax.servlet.ServletRegistration;

import org.springframework.web.WebApplicationInitializer;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import org.springframework.web.servlet.DispatcherServlet;


public class SpringWebInicializador implements WebApplicationInitializer {

public void onStartup (ServletContext Recipient) triggers ServletException {.


AnnotationConfigWebApplicationContext contexto = new AnnotationConfigWebApplicationContext ();
contexto.register (ConfiguracionSpring.class);
contexto.setServletContext (content);

ServletRegistration.Dynamic servlet = contenedor.addServlet ("dispatcher", new DispatcherServlet (contexto));
servlet.setLoadOnStartup (0);
servlet.addMapping ("/");
}

}

Aqui pongo el codigo for spring

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.DispatcherServlet;
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.view.InternalResourceViewResolver;

@EnableWebMvc
@ComponentScan ("lacasadelasabuelas. *")
@Construction
public class ConfiguracionSpring implements the WebMvcConfigurer {

public void addViewControllers (ViewControllerRegistry registry) {
registry.addViewController ("/"). setViewName ("index");
}

@Bean
// Used only when the embedded servlet is running
public DispatcherServlet dispatcherServlet () {
return new DispatcherServlet ();
}

public void configureDefaultServletHandling (
DefaultServletHandlerConfigurer Configurator) {
configureer.enable ();
}

@Bean
public InternalResourceViewResolver getInternalResourceViewResolver () {
System.out.println ("llega");
InternalResourceViewResolver resolver = new InternalResourceViewResolver ();
resolver.setPrefix ("/ WEB-INF / jsp /");
resolver.setSuffix (".jsp");
Return resolver;

}
}

Pero a la hora de hacer and requestsApplication of the ae direction: localhost: 8080 / hola me sale un 404

@Regler
public class MainController {

@RequestMapping ("/ hola")
public String hola () {

return "index";
}