设置SpringBoot项目Web默认访问页面

摘要

package com.rongpan.config;

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);
    }
}

这是个神奇的广告位这是个神奇的广告位