@Configuration public class WebMvcConfig the implements WebMvcConfigurer { @Override public void addViewControllers (ViewControllerRegistry Registry) { // set the system to access the default home page registry.addViewController ( "/") setViewName ( "the redirect: /app/login.html." ); } }
Remarks:
(1) redirect can change your browser's address;
(2) forward does not change the browser address.