whyczh
2021-04-15 28e7d24ad81f9afe1037b72d8cfc3c27ba948f28
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package com.example.lxw.config;
 
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
 
/**
 * @author lxw
 * @create 2021-04-09 14:58
 */
@Configuration
public class MvcConfig extends WebMvcConfigurationSupport {
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        // 这里之所以多了一"/",是为了解决打jar时访问不到问题
        registry.addResourceHandler("/index.html").addResourceLocations("/index.html","classpath:/index.html");
        registry.addResourceHandler("/doc.html").addResourceLocations("/doc.html","classpath:/doc.html");
    }
}