1 package cn.home1.oss.environment.admin;
2
3 import org.springframework.context.annotation.Configuration;
4 import org.springframework.web.servlet.config.annotation.EnableWebMvc;
5 import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
6 import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
7
8
9
10
11 @Configuration
12 @EnableWebMvc
13 public class WebMvcConfiguration extends WebMvcConfigurerAdapter {
14
15 @Override
16 public void addResourceHandlers(ResourceHandlerRegistry registry) {
17 registry.addResourceHandler("/img/**").addResourceLocations("classpath:/static/img/");
18 registry.addResourceHandler("/css/**").addResourceLocations("classpath:/static/css/");
19 registry.addResourceHandler("/js/**").addResourceLocations("classpath:/static/js/");
20 registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
21 registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
22 super.addResourceHandlers(registry);
23 }
24 }