Little rookie Learn Spring boot--take over the web configuration of Spring boot

Source: Internet
Author: User

Rookie new to the big God do not spray, a little Daigo, grateful. Because I always pretend to be humorous, because I want to make myself happy.

    • Spring MVC, which is provided by the spring boot, does not meet its own requirements, and it can write a control class plus @EnableWebMvc annotations to control the MVC configuration itself.
    • Spring MVC provides a webmvcconfigureadapter that can be customized without the need to use ENABLEWEBMVC annotations when it is necessary to retain and add its own configuration.

  

 1   @Configuration  2  public  class  webconfig Span style= "COLOR: #0000ff" >extends   webmvcconfigureradapter{ 3   @Override  4  
   
    public  
    void  
     Addviewcontrollers (Viewcontrollerregistry registry) { 
    5  Registry.addvie Wcontroller ("/xx"). Setviewname ("/xx" 
     6  }  7  }
   

The Addviewcontrollers method here does not overwrite the Addviewcontrollers method in Webmvcautoconfiguration, which means that we can use it at the same time.

Little rookie Learn Spring boot--take over the web configuration of Spring boot

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.