문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판 이전 판 다음 판 | 이전 판 다음 판 양쪽 다음 판 | ||
springframework:springboot [2018/04/06 08:54] kwon37xi |
springframework:springboot [2019/04/05 15:33] kwon37xi [SpringBoot WebMVC 정적 리소스(static resource)] |
||
---|---|---|---|
줄 2: | 줄 2: | ||
* [[http:// | * [[http:// | ||
* [[http:// | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[springframework: | ||
+ | * [[springframework: | ||
+ | * [[springframework: | ||
+ | * [[springframework: | ||
+ | * [[springframework: | ||
+ | * [[springframework: | ||
+ | * [[springframework: | ||
+ | * [[springframework: | ||
+ | * [[springframework: | ||
+ | * [[springframework: | ||
- | ===== Dependency Version Override | + | ===== @EnableAutoConfiguration |
- | 의존 라이브러리의 버전을 다른 것으로 바꾸고자 한다면 property를 변경하면 된다. | + | * [[https://docs.spring.io/ |
- | <code groovy> | + | * 특정 Auto Configuration 방지< |
- | // 하이버네이트 버전 | + | @EnableAutoConfiguration(exclude = { |
- | ext[' | + | |
- | </ | + | |
- | + | | |
- | * [[https://github.com/spring-projects/ | + | |
- | + | ||
- | ===== With JPA ===== | + | |
- | * 현재 Spring boot 버전에 [[http:// | + | |
- | * [[https://github.com/ | + | |
- | * 해결책은 naming strategy를 직접 | + | |
- | // Hibernate 4 | + | |
- | spring.jpa.hibernate.naming_strategy=org.hibernate.cfg.EJB3NamingStrategy | + | |
- | // or | + | |
- | spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.DefaultNamingStrategy | + | |
- | + | ||
- | // Hibernate 5 | + | |
- | spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl | + | |
</ | </ | ||
+ | * [[https:// | ||
===== JRebel SpringBoot / Gradle ===== | ===== JRebel SpringBoot / Gradle ===== | ||
* [[https:// | * [[https:// | ||
+ | ===== DataSource ===== | ||
+ | * Default 말고 직접 '' | ||
+ | <code java> | ||
+ | import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder; | ||
+ | @Bean | ||
+ | @ConfigurationProperties(prefix = " | ||
+ | public DataSource rubyDataSource() { | ||
+ | return DataSourceBuilder.create().type(org.apache.tomcat.jdbc.pool.DataSource.class).build(); | ||
+ | } | ||
+ | </ | ||
+ | * 위 예에서 설정값은 '' | ||
- | ===== Date/Time Format ===== | + | ==== SpringApplicationRunListener |
- | * [[http://www.popit.kr/rest-api-%eb%82%a0%ec%a7%9c%ec%8b%9c%ea%b0%84-%ed%91%9c%ed%98%84-%ec%a0%95%ed%95%98%ea%b8%b0/|REST API 날짜/시간 표현 정하기]] | + | * [[https://docs.spring.io/spring-boot/ |
- | * [[http://javacan.tistory.com/ | + | * SpringBoot 로딩중 이벤트를 받아 처리한다. |
- | * 1.x와 2.x 에서 동일 결과를 낼 수 있는 방식 지정할 것. | + | |
+ | ===== SpringBoot WebMVC 정적 리소스(static resource) ===== | ||
+ | * '' | ||
+ | * jar 애플리케이션을 실행한 디렉토리 하위의 '' | ||
+ | * '' | ||
+ | @Configuration | ||
+ | public class StaticResourceConfig extends WebMvcConfigurerAdapter { | ||
+ | @Override | ||
+ | public void addResourceHandlers(ResourceHandlerRegistry registry) { | ||
+ | registry.addResourceHandler("/ | ||
+ | .addResourceLocations(" | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | ==== static resource 관련 | ||
+ | < | ||
+ | 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 | ||
+ | </ | ||
===== 참고 ===== | ===== 참고 ===== | ||
* [[http:// | * [[http:// | ||
* [[http:// | * [[http:// | ||
* [[https:// | * [[https:// | ||
- | * [[http:// | ||
* [[https:// | * [[https:// | ||
* [[http:// | * [[http:// | ||
* [[http:// | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[https:// |