본문 바로가기

2021/086

[spring 6편] spring request 관련 정리 목차는 spring series 목차 에 있습니다. spring request annotation 정리 @RequestParam Http 요청 파라미터를 받기 위해서 spring 에서 사용하는 annotation 입니다. @RequestParam 은 값이 반드시 있어야 하며, 값이 없으면 400 Error 가 발생합니다. 값을 반드시 받지 않아도 되는 옵션이 있습니다 (required = false) 예를 들면, http://localhost:8080?page=2&size=10 get 방식으로 요청한다고 가정을 합니다. 위와 같은 url 이 있을 때 RequestParam 을 사용하면 값을 가져올 수 있습니다. // http://localhost:8080?page=2&size=10 @GetMapping(.. 2021. 8. 24.
Lombok annotation 정리 Lombok Annotation 정리 생성자 관련 @NoArgsConstructor 파라미터가 없는 기본생성자를 만들어줍니다. // before @NoArgsConstructor public class NoArgsConstructorTestClass { } // after public class NoArgsConstructorTestClass { public NoArgsConstructorTestClass() {} }@AllArgsConstructor 클래스에 선언된 모든 필드 값에 대한 생성자를 만들어줍니다. // before @AllArgsConstructor public class AllArgsConstructorTestClass { private String name; private int age.. 2021. 8. 24.
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 batch partitioner 정리 source 는 Github 에 있습니다. spring batch partitioner 정리 partitioner 개념 partitioner 는 하나의 jvm 내에서 멀티 스레드로 처리하는 방법입니다. partitioner 에서 데이터를 나누고 각 스텝에 나눈 데이터를 분배하여, 스텝에서는 분배받은 데이터를 가지고 프로그램을 수행합니다. 스레드 측면에서 보면 partitioner 라는 스레드가 데이터를 나눠서 각 스텝에 나눠주는데, 이 스텝들은 별도의 스레드에서 동작하게 됩니다. 즉, ItemReader, ItemWriter 가 thread-safe 하지 않아도 됩니다. Multi thread step 의 경우 ItemReader, ItemWriter 는 thread-safe 해야 합니다. Multi t.. 2021. 8. 18.