1. If the rendering engine, JSP and other VIEW rendering technologies are used, it can be solved by the method of addViewController.
which is:
@Configuration
public class DefaultView extends WebMvcConfigurerAdapter {
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/Blog").setViewName("forward:index.jsp");
registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
super.addViewControllers(registry);
}
}
or
@Controller
@RequestMapping("/")
public class IndexController {
@RequestMapping("/Blog")
public String index() {
return "forward:index.html";
}
}
2. If the front-end and back-end separation modes are completely adopted, that is, all resources at the front end are placed in the path configured by addresourceHandler