Extended SpringMVC-Configuration

 

 

Package com.syu.config; 

Import org.springframework.context.annotation.Configuration;
 Import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
 Import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 

Import Java .util.Locale; 

// If you want to expand Springmvc official suggested that we do it this way: Do not add EnableWebMvc comment 
@Configuration
 // @EnableWebMvc EnableWebMvc import a class: DelegatingWebConfiguation, the role is to get all of WebConfig from the container 
public  class MyMvcConfig the implements WebMvcConfigurer { 

    // view jump 
    @Override
     public  void addViewControllers(ViewControllerRegistry registry){
        registry.addViewController("/kuang").setViewName("test");
    }


}

 

Guess you like

Origin www.cnblogs.com/lotus-wmm/p/12635758.html
Recommended