package com.fzzy.conf;
|
|
import org.springframework.context.annotation.Configuration;
|
import org.springframework.core.Ordered;
|
import org.springframework.util.ResourceUtils;
|
import org.springframework.web.servlet.config.annotation.*;
|
|
/**
|
* @author: andy.jia
|
* @description: MVC的一些配置
|
**/
|
@Configuration
|
public class WebMvcConfig extends WebMvcConfigurationSupport {
|
|
/**
|
* 配置项目进入的默认路径为登录界面
|
*
|
* @param registry
|
*/
|
@Override
|
public void addViewControllers(ViewControllerRegistry registry) {
|
registry.addViewController("/").setViewName("forward:/home");
|
registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
|
super.addViewControllers(registry);
|
}
|
|
|
/**
|
* 出现404的问题进行配置
|
*
|
* @param registry
|
*/
|
@Override
|
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
registry.addResourceHandler("/static/**")
|
.addResourceLocations("classpath:/static/")
|
.addResourceLocations(ResourceUtils.CLASSPATH_URL_PREFIX + "/templates/")
|
.addResourceLocations(ResourceUtils.CLASSPATH_URL_PREFIX + "/static/");
|
|
|
}
|
}
|