SpringBoot- project RestfulCRUD (IX)

1. Default Access Home

@Configuration
public class MyMvcConfig implements WebMvcConfigurer {

    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/").setViewName("login");
        //   浏览器发送 / 请求来到 login
        registry.addViewController("/login.html").setViewName("login");
    }
}

The browser sends a request back to the login page, login page design, when we visited the site also needs to give him access to the default "/."

2. Introduction of a path change thymeleaf

    <link href="asserts/css/bootstrap.min.css" th:href="@{/webjars/bootstrap/4.3.1/css/bootstrap.css}" rel="stylesheet">
        <!-- Custom styles for this template -->
        <link href="asserts/css/signin.css" th:href="@{/asserts/css/signin.css}" rel="stylesheet">
    </head>

Default would visit th:. Href path tab will cover before.

Guess you like

Origin www.cnblogs.com/xiaoqiqistudy/p/11350799.html