본문 바로가기

분류 전체보기

[Kotlin] json string to List<Class> by jackson jacksonObjectMapper().readValue(jsonString, SomeClass::class.java) 위와 같이 json 형태의 문자열을 특정 데이터 클래스로 변환할 수 있다. 그러나 가끔씩 최상위 키 대신 다짜고짜 리스트로 시작하는 경우가 있다. //보통의 key-value 예제 "{"name":"injuk", "age":"99"}" //리스트로 시작하는 예제 "[{"name":"injuk", "age":"99"}]" 리스트로 시작할 때에 위 방식으로 파싱 시도 시 에러가 떨어진다. someClass::class.java 자리에 억지로 List 등과 같이 끼워넣으면 컴파일조차 되지 않는다. 해결법은 아래와 같다. jacksonObjectMapper().readValue(response.. 더보기
[Docker] Mac OS 도커 데스크톱 없이 docker daemon 실행하기 https://itnext.io/replace-docker-desktop-with-lima-88ec6f9d6a19 Replace Docker Desktop with lima It's finally here, the day we have to abandon this update-hungry tool named Docker Desktop. itnext.io https://github.com/rancher-sandbox/rancher-desktop/releases Releases · rancher-sandbox/rancher-desktop Container Management and Kubernetes on the Desktop - rancher-sandbox/rancher-desktop github.com .. 더보기
[jooq] jooq batch 활용하기 (+upsert) 업무 간 PostgreSQL + jooq 로 batch upsert 작업을 해야할 일이 생겼다. 처음엔 작업량을 고려하지 못하고 일일히 커넥션이 발생하는 형태였으나 아래 링크를 참고하여 해결하였다. https://stackoverflow.com/questions/62870572/how-to-batch-update-using-jooq How to batch update using jooq Using the following way to update using jOOQ. for (Balance balance : balances) { dslContext.update(BALANCE) .set(BALANCE.AMOUNT, balance.getAmount()) .where( stackoverflow.com @Tra.. 더보기
[PostgreSQL] delete from 절 join https://www.postgresqltutorial.com/postgresql-delete-join/ PostgreSQL DELETE JOIN - How to Emulate it Correctly Summary: in this tutorial, you will learn how to use the PostgreSQL DELETE statement to emulate delete join operations. Introduction to PostgreSQL DELETE statement with USING clause PostgreSQL doesn’t support the DELETE JOIN statement. However, it does s www.postgresqltutorial.com post.. 더보기
[PostgreSQL] pgAdmin 활용하여 데이터 이관(dump & restore)하기 새로 스테이징 환경에 배포를 진행하며 DB 구성부터 새로 진행하였다. DDL을 따로 관리하고 있었기에 테이블 구성은 간단하였으나 기존 사용하던 데이터를 이관해야 하는 일이 있었다. pgAdmin4를 활용하였으며 진행했던 방법은 아래와 같음 그리고 백업 버튼을 누르면 금방 파일로 저장된다. 저장 후에 새로운 데이터베이스에 위와 같은 사양의 테이블을 만들고 테이블 우클릭 > Restore 후 위와 같은 순서로 진행하면 된다. 더보기
[kotlin] webclient basic auth 설정 val clientId = "clientId" val clientSecret = "clientSecret" try { val result = webClient .mutate() .build() .post() .uri(myUrl) .headers { it.setBasicAuth(clientId, clientSecret) } .retrieve() .awaitBody() } catch (ex: Exception) { return null }​ 또는 val clientId = "clientId" val clientSecret = "clientSecret" val basicAuthHeader = "basic " + Base64Utils.encodeToString(("$clientId:$clientSecret")... 더보기
Spring quartz와 application context Spring quartz의 life-cycle은 Spring과 별개의 level에서 동작하기에 spring context를 읽을 수 없다. 즉, Annotation 기반의 Dependency Injection이 안된다는 의미. (Job 한정인지 찾아보기) 이를 해결하기 위한 험난한 과정이 펼쳐지게 되는데.. (내용 추가 예정) 참고 링크 https://www.candidjava.com/spring-boot/quartz-example/ Spring boot quartz scheduler example | Candidjava Spring boot quartz scheduler example offers several conveniences for working with the Quartz scheduler,.. 더보기
Postgresql 콘솔 종료하는 법 psql -h 127.0.0.1 -U postgres 명령어로 postgresql 콘솔에 접근하고 용건을 마친 후 종료만이 남은 상황. exit, quit, ctrl+C, qq, :q! 등 종료에 관한 경험을 총 동원하였으나 놀랍게도 종료가 되지 않았다. 찾아본 결과 종료에 필요한 명령어는 '\q' 였다. 왜..? 더보기