본문 바로가기
728x90
반응형
SMALL

IT/JAVA45

Rest API QueryString Parsing for MyBatis REST API 를 만들다 보면 상세한 검색조건을 처리해야 하는 일이 발생하는데 URI 에 포함된 querystring 을 어떻게 처리해야 좋을지 고민 된다. JPA, QueryDSL 등과 같은 ORM 에 대해서는 찾아보면 많은 라이브러리, Framework 들이 존재하기 때문에 적당한 녀석을 찾아서 사용하면 된다. ex. https://docs.spring.io/spring-data/rest/docs/current/reference/html/#repository-resources.query-method-resource ex. https://www.baeldung.com/rest-api-search-querydsl-web-in-spring-data-jpa ex. https://www.baeldung.co.. 2019. 9. 24.
Gson LocalDateTime 처리(BEGIN_OBJECT but was STRING) Date 와 관련된 값들은 Java8 부터 지원하는 LocalDateTime 을 주로 사용한다. API 를 통해 객체 정보를 요청하고 수신할때 serialize, deserialize 하게 되는데 이때 google의 Gson을 많이 사용한다. 그런데 Gson 은 LocalDateTime 을 알지 못하기 때문에 LocalDateTime 에 대한 구문 분석을 하지 못한다. Expected BEGIN_OBJECT but was STRING .... 18:05 ERROR o.a.c.c.C.[.[.[.[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [/decide7] threw exception .. 2019. 9. 18.
ConcurrentModificationException 데이터를 순회하면서 특정 data를 조작(삭제)하고 싶을 때 발생한다. Iterator it = map.entrySet().iterator(); while (it.hasNext()) { Entry entry = it.next(); if (entry != null && entry.getValue().compareTo(actualExpiredTime) < 0) { map.remove(entry.getKey()); } } Java 공식 문서를 보면 Iterator 의 remove를 이용하는 것이 Collection을 순회하면서 element를 삭제하는 유일하게 안전한 방법이라고 가이드 하고 있다. 그래서 소스코드를 바꿔본다. Iterator it = map.entrySet().iterator(); while .. 2019. 5. 21.
Ehcache 옵션 정리 Ehcache 에 대해서는 이전글 참고 :2013/12/24 - [IT/Spring] - ehcachediskExpiryThreadIntervalSeconds: 디스크에 저장된 캐시들에 대해 만료된 항목를 제거하기 위한 쓰레드를 실행 할 주기 설정diskSpoolBufferSizeMB: 디스크 캐시에 쓰기 모드로 들어갈때, 사용될 비동기 모드의 스폴 버퍼 크기 설정, OutOfMemory 에러가 발생 시 수치를 낮추도록 한다. diskPersistent: VM이 재기동 할때 캐싱된 객체들을 디스크에 계속 유지 할지 여부 diskAccessStripes: 디스크 퍼포먼스를 조정하기 위한 스트라핑 설정 eternal: 시간설정에 대한 무시 설정 (boolean), true 면 모든 timeout 설정은 모두.. 2018. 9. 12.
728x90
반응형
LIST