| | |
| | | package com.ruoyi.framework.config;
|
| | |
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import com.ruoyi.common.constant.Constants;
|
| | | import com.ruoyi.framework.interceptor.RepeatSubmitInterceptor;
|
| | | import lombok.RequiredArgsConstructor;
|
| | | import org.springframework.context.annotation.Bean;
|
| | | import org.springframework.context.annotation.Configuration;
|
| | | import org.springframework.http.CacheControl;
|
| | | import org.springframework.web.cors.CorsConfiguration;
|
| | | import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
| | | import org.springframework.web.filter.CorsFilter;
|
| | | import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
| | | import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
| | | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
| | | import com.ruoyi.common.constant.Constants;
|
| | | import com.ruoyi.framework.interceptor.RepeatSubmitInterceptor;
|
| | |
|
| | | import java.util.concurrent.TimeUnit;
|
| | |
|
| | | /**
|
| | | * 通用配置
|
| | |
| | | * @author ruoyi
|
| | | */
|
| | | @Configuration
|
| | | @RequiredArgsConstructor
|
| | | public class ResourcesConfig implements WebMvcConfigurer
|
| | | {
|
| | | @Autowired
|
| | | private RepeatSubmitInterceptor repeatSubmitInterceptor;
|
| | | private final RepeatSubmitInterceptor repeatSubmitInterceptor;
|
| | |
|
| | | @Override
|
| | | public void addResourceHandlers(ResourceHandlerRegistry registry)
|
| | |
| | |
|
| | | /** swagger配置 */
|
| | | registry.addResourceHandler("/swagger-ui/**")
|
| | | .addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/");
|
| | | .addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/")
|
| | | .setCacheControl(CacheControl.maxAge(5, TimeUnit.HOURS).cachePublic());
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | // 返回新的CorsFilter
|
| | | return new CorsFilter(source);
|
| | | }
|
| | |
|
| | | }
|