From 73199eab12518a5c4921263e5d050442017a651d Mon Sep 17 00:00:00 2001 From: mjkhan21 Date: Fri, 30 Jun 2023 17:33:45 +0900 Subject: [PATCH] =?UTF-8?q?=EC=99=B8=EB=B6=80=20static=20resource=20?= =?UTF-8?q?=EC=84=9C=EB=B9=84=EC=8A=A4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cokr/xit/foundation/boot/MvcConfig.java | 16 +++++- .../xit/foundation/boot/ServletConfig.java | 26 +++++---- .../foundation/boot/StaticResourceConfig.java | 55 +++++++++++++++++++ 3 files changed, 84 insertions(+), 13 deletions(-) create mode 100644 src/main/java/cokr/xit/foundation/boot/StaticResourceConfig.java diff --git a/src/main/java/cokr/xit/foundation/boot/MvcConfig.java b/src/main/java/cokr/xit/foundation/boot/MvcConfig.java index 72c4dda..378728e 100644 --- a/src/main/java/cokr/xit/foundation/boot/MvcConfig.java +++ b/src/main/java/cokr/xit/foundation/boot/MvcConfig.java @@ -1,6 +1,9 @@ package cokr.xit.foundation.boot; +import javax.annotation.Resource; + import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.multipart.commons.CommonsMultipartResolver; @@ -24,6 +27,8 @@ import cokr.xit.foundation.web.AccessInitializer; @Configuration public class MvcConfig implements WebMvcConfigurer { protected static String[] URL_PATTERNS = {"/", "/**/*.do"}; + @Resource(name = "staticResource") + private StaticResourceConfig staticResource; /**AccessInitializer를 반환한다. * @return AccessInitializer @@ -33,6 +38,9 @@ public class MvcConfig implements WebMvcConfigurer { return new AccessInitializer(); } + @Value("${spring.web.resources.static-locations}") + private String staticLocations; + /**정적 파일 자원 접근에 대한 설정을 추가한다. *