전체 글323 response null 인경우 생략 1. DTO 마다 직접 적용 하는 경우 원하는 property 에 @JsonInclude(JsonInclude.Include.NON_NULL) 를 적용한다. 만약 @JsonInclude(JsonInclude.Include.NON_EMPTY) 를 적용하면 빈 문자열도 생략한다. import com.fasterxml.jackson.annotation.JsonInclude; import java.io.Serializable; @Getter @Setter public class Demo implements Serializable { private Long id; @JsonInclude(JsonInclude.Include.NON_NULL) private String name; } 2. 전역 설정 하는 경우 직접 .. 2023. 2. 28. bucket4j ehcache 를 사용하여 Bucket Sort Algorithm 을 사용하려 한다. Refil 기본적으로 gready 는 정해진 시간 마다 지속적으로 리필을 해주는 형식이다. 반면에 intervally 는 한번에 리필을 해준다. public class Bucket { Refill refill = Refill.greedy(10, Duration.ofSeconds(1)); Refill refill = Refill.intervally(10, Duration.ofSeconds(1)); }Bandwidth 버킷의 총량을 설정해 준다. simple 의 경우 greedy 를 사용하게 구현되어있다. classic 의 경우 Refill 의 구현체를 직접 사용한다. import java.time.Duration; pub.. 2023. 2. 28. 2023-01-18-aop 사용한 로깅 layout : post title : "aop 사용한 로깅" category : Spring aop 를 활용한 로그를 남기려 한다. %green(%d{yyyy-MM-dd HH:mm:ss.SSS}) [%thread] %highlight(%-5level) %cyan(%logger{36}) - %msg%n point cut 으로 get post put delete 어노테이션이 있는 메서드들에 대해서 작동하도록 한다. @Component @Aspect @Slf4j @RequiredArgsConstructor public class ApiLog { @Pointcut("@annotation(org.springframework.web.bind.annotation.GetMapping) ||" + "@annotatio.. 2023. 2. 28. spring batch 5.0 layout : post title : "spring batch 5.0" category : Spring spring boot 3.0에서 spring batch 5.0이 추가되었다. spring batch 5.0 에서 기존에 아래와 같이 사용하던 방법이 deprecated 되었다. 1. 기존 @Configuration @RequiredArgsConstructor @Slf4j public class MemberBatchJobConfig { private final JobBuilderFactory jobBuilderFactory; private final StepBuilderFactory stepBuilderFactory; private final MemberService memberService; @Val.. 2023. 2. 28. 이전 1 ··· 4 5 6 7 8 9 10 ··· 81 다음