사용자 도구

사이트 도구


springframework:springboot

차이

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

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
다음 판 양쪽 다음 판
springframework:springboot [2018/06/14 10:40]
kwon37xi
springframework:springboot [2019/04/22 14:21]
kwon37xi [Server / Tomcat 설정]
줄 3: 줄 3:
   * [[http://start.spring.io/|Spring Initializr]]   * [[http://start.spring.io/|Spring Initializr]]
   * [[http://www.baeldung.com/spring-boot|Learn Spring Boot | Baeldung]]   * [[http://www.baeldung.com/spring-boot|Learn Spring Boot | Baeldung]]
 +  * [[springframework:springboot:devtools|SpringBoot DevTools]]
 +  * [[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]]
  
-===== 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 =====
줄 46: 줄 38:
 </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 서빙 경로 ====
 +
 +  * ''/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>
 +
 +===== Server / Tomcat 설정 =====
 +  * [[https://wordpress-264548-822440.cloudwaysapps.com/spring-boot-configure-tomcat|How to Configure Spring Boot Tomcat]]
 +<code>
 +server.address= # Network address to which the server should bind.
 +server.compression.enabled=false # Whether response compression is enabled.
 +server.compression.excluded-user-agents= # Comma-separated list of user agents for which responses should not be compressed.
 +server.compression.mime-types=text/html,text/xml,text/plain,text/css,text/javascript,application/javascript,application/json,application/xml # Comma-separated list of MIME types that should be compressed.
 +server.compression.min-response-size=2KB # Minimum "Content-Length" value that is required for compression to be performed.
 +server.connection-timeout= # Time that connectors wait for another HTTP request before closing the connection. When not set, the connector's container-specific default is used. Use a value of -1 to indicate no (that is, an infinite) timeout.
 +server.error.include-exception=false # Include the "exception" attribute.
 +server.error.include-stacktrace=never # When to include a "stacktrace" attribute.
 +server.error.path=/error # Path of the error controller.
 +server.error.whitelabel.enabled=true # Whether to enable the default error page displayed in browsers in case of a server error.
 +server.http2.enabled=false # Whether to enable HTTP/2 support, if the current environment supports it.
 +server.max-http-header-size=8KB # Maximum size of the HTTP message header.
 +server.port=8080 # Server HTTP port.
 +server.server-header= # Value to use for the Server response header (if empty, no header is sent).
 +server.use-forward-headers= # Whether X-Forwarded-* headers should be applied to the HttpRequest.
 +server.servlet.context-parameters.*= # Servlet context init parameters.
 +server.servlet.context-path= # Context path of the application.
 +server.servlet.application-display-name=application # Display name of the application.
 +server.servlet.jsp.class-name=org.apache.jasper.servlet.JspServlet # Class name of the servlet to use for JSPs.
 +server.servlet.jsp.init-parameters.*= # Init parameters used to configure the JSP servlet.
 +server.servlet.jsp.registered=true # Whether the JSP servlet is registered.
 +server.servlet.session.cookie.comment= # Comment for the session cookie.
 +server.servlet.session.cookie.domain= # Domain for the session cookie.
 +server.servlet.session.cookie.http-only= # Whether to use "HttpOnly" cookies for session cookies.
 +server.servlet.session.cookie.max-age= # Maximum age of the session cookie. If a duration suffix is not specified, seconds will be used.
 +server.servlet.session.cookie.name= # Session cookie name.
 +server.servlet.session.cookie.path= # Path of the session cookie.
 +server.servlet.session.cookie.secure= # Whether to always mark the session cookie as secure.
 +server.servlet.session.persistent=false # Whether to persist session data between restarts.
 +server.servlet.session.store-dir= # Directory used to store session data.
 +server.servlet.session.timeout=30m # Session timeout. If a duration suffix is not specified, seconds will be used.
 +server.servlet.session.tracking-modes= # Session tracking modes.
 +server.ssl.ciphers= # Supported SSL ciphers.
 +server.ssl.client-auth= # Client authentication mode.
 +server.ssl.enabled=true # Whether to enable SSL support.
 +server.ssl.enabled-protocols= # Enabled SSL protocols.
 +server.ssl.key-alias= # Alias that identifies the key in the key store.
 +server.ssl.key-password= # Password used to access the key in the key store.
 +server.ssl.key-store= # Path to the key store that holds the SSL certificate (typically a jks file).
 +server.ssl.key-store-password= # Password used to access the key store.
 +server.ssl.key-store-provider= # Provider for the key store.
 +server.ssl.key-store-type= # Type of the key store.
 +server.ssl.protocol=TLS # SSL protocol to use.
 +server.ssl.trust-store= # Trust store that holds SSL certificates.
 +server.ssl.trust-store-password= # Password used to access the trust store.
 +server.ssl.trust-store-provider= # Provider for the trust store.
 +server.ssl.trust-store-type= # Type of the trust store.
 +server.tomcat.accept-count=100 # Maximum queue length for incoming connection requests when all possible request processing threads are in use.
 +server.tomcat.accesslog.buffered=true # Whether to buffer output such that it is flushed only periodically.
 +server.tomcat.accesslog.directory=logs # Directory in which log files are created. Can be absolute or relative to the Tomcat base dir.
 +server.tomcat.accesslog.enabled=false # Enable access log.
 +server.tomcat.accesslog.file-date-format=.yyyy-MM-dd # Date format to place in the log file name.
 +server.tomcat.accesslog.pattern=common # Format pattern for access logs.
 +server.tomcat.accesslog.prefix=access_log # Log file name prefix.
 +server.tomcat.accesslog.rename-on-rotate=false # Whether to defer inclusion of the date stamp in the file name until rotate time.
 +server.tomcat.accesslog.request-attributes-enabled=false # Set request attributes for the IP address, Hostname, protocol, and port used for the request.
 +server.tomcat.accesslog.rotate=true # Whether to enable access log rotation.
 +server.tomcat.accesslog.suffix=.log # Log file name suffix.
 +server.tomcat.additional-tld-skip-patterns= # Comma-separated list of additional patterns that match jars to ignore for TLD scanning.
 +server.tomcat.background-processor-delay=10s # Delay between the invocation of backgroundProcess methods. If a duration suffix is not specified, seconds will be used.
 +server.tomcat.basedir= # Tomcat base directory. If not specified, a temporary directory is used.
 +server.tomcat.internal-proxies=10\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}|\\
 + 192\\.168\\.\\d{1,3}\\.\\d{1,3}|\\
 + 169\\.254\\.\\d{1,3}\\.\\d{1,3}|\\
 + 127\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}|\\
 + 172\\.1[6-9]{1}\\.\\d{1,3}\\.\\d{1,3}|\\
 + 172\\.2[0-9]{1}\\.\\d{1,3}\\.\\d{1,3}|\\
 + 172\\.3[0-1]{1}\\.\\d{1,3}\\.\\d{1,3}\\
 + 0:0:0:0:0:0:0:1\\
 + ::1 # Regular expression that matches proxies that are to be trusted.
 +server.tomcat.max-connections=10000 # Maximum number of connections that the server accepts and processes at any given time.
 +server.tomcat.max-http-post-size=2MB # Maximum size of the HTTP post content.
 +server.tomcat.max-swallow-size=2MB # Maximum amount of request body to swallow.
 +server.tomcat.max-threads=200 # Maximum amount of worker threads.
 +server.tomcat.min-spare-threads=10 # Minimum amount of worker threads.
 +server.tomcat.port-header=X-Forwarded-Port # Name of the HTTP header used to override the original port value.
 +server.tomcat.protocol-header= # Header that holds the incoming protocol, usually named "X-Forwarded-Proto".
 +server.tomcat.protocol-header-https-value=https # Value of the protocol header indicating whether the incoming request uses SSL.
 +server.tomcat.redirect-context-root=true # Whether requests to the context root should be redirected by appending a / to the path.
 +server.tomcat.remote-ip-header= # Name of the HTTP header from which the remote IP is extracted. For instance, `X-FORWARDED-FOR`.
 +server.tomcat.resource.allow-caching=true # Whether static resource caching is permitted for this web application.
 +server.tomcat.resource.cache-ttl= # Time-to-live of the static resource cache.
 +server.tomcat.uri-encoding=UTF-8 # Character encoding to use to decode the URI.
 +server.tomcat.use-relative-redirects= # Whether HTTP 1.1 and later location headers generated by a call to sendRedirect will use relative or absolute redirects.
 +</code>
  
 ===== 참고 ===== ===== 참고 =====
줄 51: 줄 160:
   * [[http://www.infoq.com/presentations/spring-boot-devops|Spring Boot for DevOps]]   * [[http://www.infoq.com/presentations/spring-boot-devops|Spring Boot for DevOps]]
   * [[https://examples.javacodegeeks.com/enterprise-java/spring/boot/spring-boot-tutorial-beginners/|Spring Boot Tutorial for beginners]]   * [[https://examples.javacodegeeks.com/enterprise-java/spring/boot/spring-boot-tutorial-beginners/|Spring Boot Tutorial for beginners]]
-  * [[http://www.javabeat.net/spring-boot-devtools/|Ultimate guide to SpringBoot devtools]] 
   * [[https://examples.javacodegeeks.com/enterprise-java/spring/boot/spring-boot-configuration-tutorial/|Spring Boot Configuration Tutorial]]   * [[https://examples.javacodegeeks.com/enterprise-java/spring/boot/spring-boot-configuration-tutorial/|Spring Boot Configuration Tutorial]]
   * [[http://jojoldu.tistory.com/226|SpringBoot @MockBean, @SpyBean 소개]]   * [[http://jojoldu.tistory.com/226|SpringBoot @MockBean, @SpyBean 소개]]
   * [[http://www.baeldung.com/spring-boot-shutdown|Shutdown a Spring Boot Application | Baeldung]]   * [[http://www.baeldung.com/spring-boot-shutdown|Shutdown a Spring Boot Application | Baeldung]]
   * [[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]]
springframework/springboot.txt · 마지막으로 수정됨: 2022/10/26 10:14 저자 kwon37xi