import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class DefaultView implements WebMvcConfigurer {
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/").setViewName("forward:index.jsp");
WebMvcConfigurer.super.addViewControllers(registry);
}
}
index.jsp 路徑:resource/static/index.jsp
WebMvcConfigurerAdapter 已經過期,雖然可以用,但是看起來感覺很不爽。
如果使用 WebMvcConfigurationSupport 又會導致 自配配置失效
https://www.cnblogs.com/deng720/p/8989388.html