templates下的文件

springboot2下的自定义试图映射

config下的文件

@Configuration
@EnableWebMvc
public class Mymvc implements WebMvcConfigurer {

    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/").setViewName("index");
    }
}

注意事项index是一个html文件的名字

官方推荐使用WebMvcConfigurer

springboot2下的自定义试图映射

官方地址:https://docs.spring.io/spring/docs/5.1.3.RELEASE/spring-framework-reference/web.html#mvc-config-interceptors

相关文章:

  • 2022-12-23
  • 2021-06-20
  • 2023-03-18
  • 2023-03-07
  • 2022-02-09
  • 2021-10-04
  • 2022-12-23
猜你喜欢
  • 2021-11-08
  • 2022-12-23
  • 2021-05-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案