package com.rongpan.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class WebConfigurer implements WebMvcConfigurer {
@Override
public void addViewControllers(ViewControllerRegistry registry) {
//默認地址(可以是頁面或後臺請求接口)
registry.addViewController("/").setViewName("forward:/upload.html");
//設置過濾優先級最高
registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
}
}
如何設置SpringBoot項目默認訪問頁面
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.