사용자 도구

사이트 도구


springframework:springboot

차이

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

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
springframework:springboot [2018/07/12 08:37]
kwon37xi
springframework:springboot [2022/10/26 10:14] (현재)
kwon37xi
줄 5: 줄 5:
   * [[springframework:springboot:devtools|SpringBoot DevTools]]   * [[springframework:springboot:devtools|SpringBoot DevTools]]
   * [[springframework:springboot:properties|SpringBoot Properties]]   * [[springframework:springboot:properties|SpringBoot Properties]]
 +  * [[springframework:springboot:jpa|Spring Boot And JPA]]
 +  * [[springframework:springboot:mvc|SpringBoot and Spring MVC]]
 +  * [[springframework:springboot:json|SpringBoot and JSON]]
 +  * [[springframework:springboot:batch|SpringBoot와 SpringBatch]]
 +  * [[springframework:springboot:springboot_admin|SpringBoot Admin]]
 +  * [[springframework:springboot:gradle|SpringBoot and Gradle]]
 +  * [[springframework:springboot:test|SpringBoot Test]]
 +  * [[springframework:springboot:springboot_cli|SpringBoot CLI]]
 +  * [[springframework:springboot:startup|SpringBoot startup 최적화 / optimization]]
 +  * [[https://docs.spring.io/spring-boot/docs/current/reference/html/appendix-dependency-versions.html|Dependency versions]] 여기서 의존 라이브러리 버전과 프라퍼티명 확인
  
-===== Dependency Version Override ===== +===== @EnableAutoConfiguration ===== 
-의존 라이브러리의 버전을 다른 것으로 바꾸고자 한다면 property를 변경하면 된다. +  * [[https://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/autoconfigure/EnableAutoConfiguration.html|@EnableAutoConfiguration]] 
-<code groovy> +  * 특정 Auto Configuration 방지<code java
-// 하이버네이트 버전 +@EnableAutoConfiguration(exclude = { 
-ext['hibernate.version'] = '5.2.14.Final' +    DataSourceAutoConfiguration.class, 
-</code> +    DataSourceTransactionManagerAutoConfiguration.class, 
- +    HibernateJpaAutoConfiguration.class})
-  * [[https://github.com/spring-projects/spring-boot/blob/master/spring-boot-project/spring-boot-dependencies/pom.xml|spring boot dependencies pom.xml]] 여기서 버전 프라퍼티 목록을 알 수 있다. +
- +
-===== With JPA ===== +
-  * 현재 Spring boot 버전에 [[http://stackoverflow.com/questions/25283198/spring-boot-jpa-column-name-annotation-ignored|@Column(name="")이 안먹는 버그]]가 존재하는 것으로 보임. +
-  * [[https://github.com/spring-projects/spring-boot/issues/2129| @Column with name attribute not working property on entities]] +
-  * 해결책은 naming strategy를 직접 정해 줄 것<code> +
-// 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+
 </code> </code>
 +  * [[https://www.baeldung.com/spring-boot-custom-auto-configuration|A Custom Auto-Configuration with Spring Boot | Baeldung]]
  
 ===== JRebel SpringBoot / Gradle ===== ===== JRebel SpringBoot / Gradle =====
   * [[https://www.javacodegeeks.com/2018/02/jrebel-gradle-spring-boot-app.html|JRebel for a Gradle Spring Boot App | Java Code Geeks - 2018]]   * [[https://www.javacodegeeks.com/2018/02/jrebel-gradle-spring-boot-app.html|JRebel for a Gradle Spring Boot App | Java Code Geeks - 2018]]
- 
- 
-===== Date/Time Format ===== 
-  * [[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 날짜/시간 표현 정하기]] 
-  * [[http://javacan.tistory.com/478|자바캔(Java Can Do IT) :: 스프링 부트 2.0과 1.5의 Jackson JSON 날짜 타입 포맷 설정]] 
-  * 1.x와 2.x 에서 동일 결과를 낼 수 있는 방식 지정할 것. 
  
 ===== DataSource ===== ===== DataSource =====
줄 48: 줄 40:
 </code> </code>
   * 위 예에서 설정값은 ''my.datasource.*''로 구성한다. [[java:database:hikaricp|HikariCP]] 등 다른 구현체를 사용할 수도 있다.   * 위 예에서 설정값은 ''my.datasource.*''로 구성한다. [[java:database:hikaricp|HikariCP]] 등 다른 구현체를 사용할 수도 있다.
 +
 +==== SpringApplicationRunListener ====
 +  * [[https://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/SpringApplicationRunListener.html|SpringApplicationRunListener]]
 +  * SpringBoot 로딩중 이벤트를 받아 처리한다.
 +
 +===== SpringBoot WebMVC 정적 리소스(static resource) =====
 +==== static resource 서빙 경로 ====
 +  * ''spring.resources.static-locations=classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/'' 이 프라퍼티에 의해 결정됨. 기본값 참고.
 +  * 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 관련 프라퍼티 ====
 +  * [[https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html|Appendix A. Common application properties]] 에서 ''spring.mvc.*'' 와 ''spring.resources.*'' 참조
 +<code>
 +spring.mvc.static-path-pattern=/** # 정적 resource url 패턴
 +
 +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>
 +
  
 ===== 참고 ===== ===== 참고 =====
줄 58: 줄 82:
   * [[http://www.baeldung.com/spring-boot-thin-jar|Thin JARs with Spring Boot | Baeldung]]   * [[http://www.baeldung.com/spring-boot-thin-jar|Thin JARs with Spring Boot | Baeldung]]
   * [[https://dzone.com/articles/graceful-shutdown-spring-boot-applications|Graceful Shutdown Spring Boot Applications - DZone Java]]   * [[https://dzone.com/articles/graceful-shutdown-spring-boot-applications|Graceful Shutdown Spring Boot Applications - DZone Java]]
 +  * [[https://www.sourcecodeexamples.net/p/free-spring-boot-projects.html|무료 SpringBoot 예제 모음]] 
 +  * [[https://www.javaguides.net/p/spring-boot-tutorial.html|Spring Boot Tutorial]]
springframework/springboot.1531352248.txt.gz · 마지막으로 수정됨: 2018/07/12 08:37 저자 kwon37xi