After Springboot default start page modify access

  2019-06-29: clearly, slowly and calmly analyze share of programming internal organs Heart

  Development colleagues encountered a problem, I helped find the solution (Springboot start of the project to modify the default access page index.html); the answer to this question would have been relatively easy to solve simple and uniform, I found a direct reference to the blog to learn from colleagues. A moment later, his colleagues are still trying to search for information on different solutions, in fact, this problem is fixed answer mode, I know that might not deal with the problem, then I personally try to resolve according to the blog post, although the article does not comply with no access The current project usage, but overall not much difference. Under slightly adapted to conform to the current version of the project to use the following code:

  

  public class WebMvcConfig implements WebMvcConfigurer {


    @Override
    public void addViewControllers(ViewControllerRegistry registry) {

    registry.addViewController("/").setViewName("forward:/login.html");

    registry.setOrder(Ordered.HIGHEST_PRECEDENCE);

    WebMvcConfigurer.super.addViewControllers(registry);
    }
  }

  Approach is to create a view class WebMVConfig method may be implemented WebMvcConfigurer then overwrites the class inside. So I do not think of programming the curing of thinking can not copy the code to be calm analysis clearly source relational problem becomes clear up.

Guess you like

Origin www.cnblogs.com/luoning/p/11106544.html