사용자 도구

사이트 도구


springframework:springboot

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
다음 판 양쪽 다음 판
springframework:springboot [2018/11/29 12:30]
kwon37xi
springframework:springboot [2019/04/05 15:33]
kwon37xi [SpringBoot WebMVC 정적 리소스(static resource)]
줄 12: 줄 12:
   * [[springframework:springboot:gradle|SpringBoot and Gradle]]   * [[springframework:springboot:gradle|SpringBoot and Gradle]]
   * [[springframework:springboot:test|SpringBoot Test]]   * [[springframework:springboot:test|SpringBoot Test]]
 +  * [[springframework:springboot:springboot_cli|SpringBoot CLI]]
  
 ===== @EnableAutoConfiguration ===== ===== @EnableAutoConfiguration =====
줄 42: 줄 43:
   * SpringBoot 로딩중 이벤트를 받아 처리한다.   * SpringBoot 로딩중 이벤트를 받아 처리한다.
  
 +===== SpringBoot WebMVC 정적 리소스(static resource) =====
 +==== static resource 서빙 경로 ====
 +
 +  * ''/src/main/META-INF/resources''
 +  * jar 애플리케이션을 실행한 디렉토리 하위의 ''public/'' 디렉토리
 +  * ''WebMvcConfigurerAdapter.addResourceHandlers'' 오버라이드하여 직접 지정<code java>
 +@Configuration
 +public class StaticResourceConfig extends WebMvcConfigurerAdapter {
 +    @Override
 +    public void addResourceHandlers(ResourceHandlerRegistry registry) {
 +        registry.addResourceHandler("/static/**")
 +            .addResourceLocations("file:/var/www/html");
 +    }
 +}
 +</code>
 +==== static resource 관련 프라퍼티 ====
 +<code>
 +server.compression.enabled=true
 +spring.resources.chain.cache=true
 +server.compression.min-response-size=2048
 +spring.resources.chain.enabled=true
 +spring.resources.cache-period=3600
 +</code>
 ===== 참고 ===== ===== 참고 =====
   * [[http://andromedarabbit.net/wp/spring-boot%ec%97%90%ec%84%9c-spring-framework-%eb%b2%84%ec%a0%84-%ec%a7%80%ec%a0%95%ed%95%98%ea%b8%b0/|Spring Boot에서 Spring Framework 버전 지정하기]]   * [[http://andromedarabbit.net/wp/spring-boot%ec%97%90%ec%84%9c-spring-framework-%eb%b2%84%ec%a0%84-%ec%a7%80%ec%a0%95%ed%95%98%ea%b8%b0/|Spring Boot에서 Spring Framework 버전 지정하기]]
springframework/springboot.txt · 마지막으로 수정됨: 2022/10/26 10:14 저자 kwon37xi