전체 글
-
HTTP Request와 ResponseWeb관련 2020. 6. 17. 12:58
(HTTP request와 response에 대해 참고할만한 글) [HTTP Request] HTTP Request는 통신을 위해 client에서 server로 전송되는 binary data packet입니다. HTTP Reqeust는 다음과 같은 요소를 포함하고 있습니다. 1. Request Line Request Line은 GET, PUT 등과 같은 Method Token 뒤에 Request URI와 사용중인 HTTP Protocol을 지정합니다. 2. Header(header는 request 안에 없는 경우도 있습니다.) Request Body 이전까지가 Request Header입니다. 3.Request Body (request body는 request 안에 없는 경우도 있습니다.) Reqeust..
-
[11] Spring Web MVC: HttpMessageConvertersSpring/Spring boot 2020. 6. 17. 08:51
[HttpMessageConverters] HttpMessageConverters에 대한 reference site는 다음과 같습니다. docs.spring.io/spring/docs/5.0.7.RELEASE/spring-framework-reference/web.html#mv%20c-config-message-converters HttpMessageConverters는 Spring framework에서 제공하는 interface이고 Spring MVC의 일부분입니다. Http request body를 객체로 변환하거나, 객체를 Http response body로 변환할 때 사용합니다. (HTTP reqeust, response 참고) HttpMessageConverters를 사용하기 위한 annotat..
-
[10] Spring Web MVC: IntroductionSpring/Spring boot 2020. 6. 15. 13:18
Spring boot MVC reference site : https://docs.spring.io/spring/docs/5.0.7.RELEASE/spring-framework-reference/web.html#spring-web Web on Servlet Stack This part of the reference documentation covers support for Servlet stack, WebSocket messaging that includes raw WebSocket interactions, WebSocket emulation via SockJS, and pub-sub messaging via STOMP as a sub-protocol over WebSocket. 4.1. Introduc..
-
[09] TestSpring/Spring boot 2020. 6. 10. 19:18
[Test를 하는 이유] 개발에 관심이 있는 분들은 TDD(Test Driven Development)를 들어보셨을 겁니다. TDD는 우선 code에 대한 Test를 작성 후 Test를 수행함에 따라 발생한 오류의 수정과 중복된 code를 제거하는 refactoring을 진행해 유지보수가 용이한 simple한 code를 얻기 위한 개발 방법입니다. 완벽한 TDD를 도입하지 않더라도 Test code를 추가하면 유지보수에 따른 오류를 미연에 방지할 수 있으며 개발자는 자신의 code에 대한 확신을 가질 수 있게 됩니다. Spring boot는 test를 위한 의존성 하나만 추가하면 test에 필요한 여러 도구들을 사용할 수 있게 되어 매우 편리합니다. [Test관련 의존성 추가] Test를 위해 proje..
-
[08] Spring boot loggingSpring/Spring boot 2020. 6. 5. 08:55
[Logging facade] Commons Logging, SLF4j(Simple Logging Facade for Java). logger API를 추상화 한 interface들입니다. framework 개발자들이 주로 사용합니다. logging facade를 사용하면 logger를 변경할 수 있습니다. Spring boot 개발 당시 logging facade로 Commons Logging을 사용했습니다. 하지만 Commons Logging은 여러 가지 문제점을 내포합니다. Commons Logging의 문제점을 해결하기 위해 새롭게 등장한 logging facade가 SLF4j이며 이를 사용하기 위해 spring boot 1.x대에서는 pom.xml에서 Common Logging관련 의존성을 ex..
-
[07] ProfileSpring/Spring boot 2020. 6. 3. 21:27
profile을 사용하면 적용된 profile에 따라 bean의 등록을 달리하거나 특정 logic을 실행할 수 있도록 하여 환경에 따라 application을 유연하게 실행할 수 있습니다. (profile에 대한 자세한 예) profile을 사용하는 간단한 예제를 살펴보도록 합시다. 먼저 서로다른 profile을 적용할 bean 설정 file을 두개 준비합니다. 각각의 bean 설정 file 내용은 다음과 같습니다. @Profile("base")//① @Configuration//② public class BaseConfiguration { @Bean//③ public String printConfiguration() { return "Base Configuration"; } } ① @Profile an..
-
[06] 외부 설정 file (Property)Spring/Spring boot 2020. 6. 1. 11:52
[외부 설정의 file 종류와 우선순위] 외부 설정 file은 application에서 사용하는 여러 가지 properties를 담아놓은 file로 application 내부 또는 외부에 위치할 수 있습니다. 외부 설정 file은 다음과 같은 것들이 있습니다. properties (application.properties) YAML 환경변수 (environment variable) Command line arguments Properties는 여러 군데 산재할 수 있으며 각각의 다른 외부 설정에 동일한 property key가 존재할 경우 우선순위에 따라 property에 해당되는 value를 선택하게 됩니다. property의 우선순위는 다음과 같습니다. home directory에 있는 spring-..
-
[05] Spring ApplicationSpring/Spring boot 2020. 5. 28. 08:53
[Spring boot log에 debug log 출력하기] Ctrl + Shift + A로 검색창을 열어 edit configurations 라고 입력 후 enter를 누르면 Run/Debug Configurations 메뉴가 열립니다. VM option 또는 Program arguments를 설정해서 Spring boot 실행창에 debug log를 찍을 수 있습니다. 각각의 설정할 값은 다음과 같습니다. Debug log 내용에는 각각의 자동설정이 포함 또는 제외된 원인이 포함됩니다. VM option : -Ddebug program argument : --debug [FailureAnalyzer] Application error 발생 시 message를 보기 좋게 출력해주는 기능입니다. Sprin..