From cd24a045bd9ee29505ddc9760d25f5d4037f4f0c Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期四, 05 九月 2024 21:55:28 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ycl-server/src/main/java/com/ycl/config/ResourcesConfig.java |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/ycl-server/src/main/java/com/ycl/config/ResourcesConfig.java b/ycl-server/src/main/java/com/ycl/config/ResourcesConfig.java
index 2531656..81afe43 100644
--- a/ycl-server/src/main/java/com/ycl/config/ResourcesConfig.java
+++ b/ycl-server/src/main/java/com/ycl/config/ResourcesConfig.java
@@ -1,26 +1,43 @@
 package com.ycl.config;
 
+import constant.Constants;
 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.LocaleResolver;
 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 org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
 import org.springframework.web.servlet.i18n.SessionLocaleResolver;
 
 import java.util.Locale;
+import java.util.concurrent.TimeUnit;
 
 /**
  * 閫氱敤閰嶇疆
- * 
+ *
  * @author ruoyi
  */
 @Configuration
 public class ResourcesConfig implements WebMvcConfigurer
 {
+
+    @Override
+    public void addResourceHandlers(ResourceHandlerRegistry registry)
+    {
+        /** 鏈湴鏂囦欢涓婁紶璺緞 */
+        registry.addResourceHandler(Constants.RESOURCE_PREFIX + "/**")
+                .addResourceLocations("file:" + PlatformConfig.getProfile() + "/");
+
+        /** swagger閰嶇疆 */
+        registry.addResourceHandler("/swagger-ui/**")
+                .addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/")
+                .setCacheControl(CacheControl.maxAge(5, TimeUnit.HOURS).cachePublic());;
+    }
 
     /**
      * 璺ㄥ煙閰嶇疆
@@ -80,4 +97,4 @@
         return localeResolver;
     }
 
-}
\ No newline at end of file
+}

--
Gitblit v1.8.0