본문 바로가기

spring36

spring transactional readOnly 성능 관련 정리 spring transactional readOnly 성능 관련 정리 org.springframework.transaction.annotation.Transactional 의 readOnly 에 대해서 찾아봤습니다. public abstract boolean readOnly A boolean flag that can be set to true if the transaction is effectively read-only, allowing for corresponding optimizations at runtime. Defaults to false. This just serves as a hint for the actual transaction subsystem; it will not necessarily.. 2021. 8. 23.
spring rest docs 정리 source 는 Github 에 있습니다. spring rest docs 정리 spring rest docs 은 test 를 작성하면서 동시에 document 를 작성하는 오픈소스입니다. Controller Api 부분만 빠르게 테스트 하기 위해 @WebMvcTest 로 테스트 환경을 만들었습니다. spring rest docs 특징 테스트가 성공해야 document 가 작성이 됩니다. learning cost 가 꽤 큽니다. ascii 문법을 새로 배워야 합니다. build.gradle 설정 source 중간 중간에 설명을 달아놨습니다. plugins { id 'org.springframework.boot' version '2.5.1' id 'io.spring.dependency-management' .. 2021. 8. 4.
[spring 4편] spring http message convert 설명 (RequestBody, ResponseBody) 목차는 spring series 목차 에 있습니다. spring http message convert 설명 spring 에서 client 와 server 간 데이터를 주고 받을 때, 데이터를 어떻게 주고 받는지에 대해서 공부했습니다. 아래 예시는 spring mvc + json 기준입니다. client 에서 server 로 request 를 보낼 때 메시지 변환 과정 client 에서 json 데이터를 네트워크를 통해 보낼 때, server 의 spring 엔진 에서는 데이터 header 부분의 'Content-type' 을 살펴봅니다. spring 은 'Content-type' 을 보고, HttpMessageConverter 구현체를 찾기 시작합니다. HttpMessageConverter 구현체는 cl.. 2021. 6. 12.
[spring 3편] spring @Transaction 동작 원리 목차는 spring series 목차 에 있습니다. 스프링 @Transaction 동작 원리 스프링 @Transactional 의 주된 개념은 AOP proxy 입니다. 여기서 AOP, Proxy 에 관련해서 자세히는 다루지 않겠습니다. 이 부분을 좀 더 상세화 해보면 Spring core 에서 @Transacational 이 붙은 메소드를 찾아서 (AOP mechanism) Proxy Object 를 만듭니다. Proxy object 를 통해 proxy mechanism 이 동작되고, 실제 호출하는 메소드를 감싸서 트랜잭션을 적용하게 됩니다. 정확히는 Proxy Object 은 TransactionInterceptor 를 호출하고, 여기서 트랜잭션 commit, rollback 등을 처리합니다. 스프링.. 2021. 5. 14.