首页>代码>spring+spring boot+mybatis+shiro+thymeleaf实现社区党务后台管理系统>/PartyAffairs/Backstage/src/main/java/com/dai/party/config/BackstageDefaultView.java
package com.dai.party.config;

import com.dai.party.tool.uploader.Uploader;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
import org.springframework.core.Ordered;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 * @program: partyAffairs
 * @description: 项目后台默认视图配置
 * @author: Dai Yuanchuan
 * @create: 2019-01-11 00:21
 **/
@Configuration
@ImportResource(locations = {"classpath:spring-shiro.xml"})
@Slf4j
public class BackstageDefaultView extends WebMvcConfigurationSupport {

    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        // 默认页面
        registry.addViewController("/").setViewName("forward:/backstage/login");
        registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
        super.addViewControllers(registry);
    }

    /**
     * 继承 WebMvcConfigurationSupport 需要重写此方法 映射 路径
     *
     * @param registry
     */
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {

        // 静态文件
        registry.addResourceHandler("/**")
                .addResourceLocations("classpath:/static/");

        // 设置上传时文件路径
        Uploader.setPath(registry);
    }
}
最近下载更多
小温ggggg  LV6 2023年10月24日
爱吃鱼的猫Vital  LV6 2023年7月31日
suyuquan  LV2 2023年7月31日
happyMrLi  LV5 2023年7月31日
yunYUN123  LV1 2023年2月26日
taowufeng2  LV8 2022年12月9日
翰昌之杰2  LV6 2022年11月30日
1025490081  LV2 2022年11月9日
wylwylqq  LV6 2022年11月6日
wuying8208  LV15 2022年10月31日
最近浏览更多
刘孟飞  LV19 4月14日
泓鼎168  LV19 3月27日
wbw123  LV5 3月10日
try8023  LV18 1月22日
廖业贵  LV18 1月5日
WBelong  LV7 2023年12月27日
hhh12345  LV7 2023年12月23日
可乐123123  LV15 2023年12月20日
小芳同学  LV1 2023年12月8日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友