whyclxw
2021-04-15 b40ac12d6231f261581fb4281c905819530e934d
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");
    }
}