Skip to content

Instantly share code, notes, and snippets.

View benelog's full-sized avatar

Sanghyuk Jung benelog

View GitHub Profile
@benelog
benelog / mysql-options.adoc
Last active December 3, 2025 03:35
MySQL JDBC Configuration for High-Performance Batch Jobs

MySQL JDBC Configuration for High-Performance Batch Jobs

Using Server-Side Prepared Statements

PreparedStatement helps optimize repeated query execution. Instead of declaring the entire SQL string such as SELECT * FROM CITY WHERE COUNTRY = 'KOREA' AND POPULATION > 10000, it separates the static SQL structure SELECT * FROM CITY WHERE COUNTRY = ? AND POPULATION > ? from the dynamic parameters.

@benelog
benelog / spring-retry.adoc
Last active December 2, 2025 22:43
Spring retry
Note
Spring Retry는 Spring Batch, Spring Integration 내부에서 재시도를 위해 사용되던 모듈이었다. Spring framework 7.0 부터는 Spring Core 모듈로 흡수가 되었다. 현재 버전의 유요한 사용법은 Resilience Features을 참고할 수 있다. 이 글에 소개된 @Recover@CircuitBreaker는 Spring framework 7.0에서는 지원되지는 않는다.

스프링 리트라이로 하는 재시도

실습 프로젝트 초기 설정

@benelog
benelog / Application.java
Created May 28, 2025 21:39
Smart UI : Model1 by Spring Boot
public class Application implements WebMvcConfigurer {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/repos").setViewName("repos");
}
@benelog
benelog / DemoApplication.java
Last active January 15, 2024 22:16
GET + body by RestTemplate
package com.example.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@SpringBootApplication
@RestController("/")
@benelog
benelog / RemoteFileClient.java
Last active November 27, 2023 21:22
URL을 파일로 복사
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.file.Path;
import java.time.Duration;
public class RemoteFileClient {
private final HttpClient httpClient;
@benelog
benelog / head-first-design-pattern.md
Last active November 27, 2023 21:23
Head first design pattern 1,2판 차이
  • 페이지별 제목이 큰 흐름 맥락에서의 목적을 드러내는 방식으로 바뀌고 기존 제목은 작게 표시
    • 예: 바뀌는 부분을 찾아내봅시다 -> 최첨단 피자코드 만들기(바뀌는 부분을 찾아내봅시다)
    • 복습하거나 중간에 있는 내용을 찾아보기에는 더 편해진 느낌이다.
  • 낱말퀴즈가 전반적으로 바뀌어 있음.

2장 옵져버 패턴

  • java.util.Observer를 쓰던 예제가 2판에서는 직접 정의한 인터페이스를 쓰도록 변경
    • Java8이후에는 java.util.Observer 등이 거의 안 쓰인다는 설명도 추가 됨.

5장 싱글턴 패턴

@benelog
benelog / RestCall.kt
Last active April 18, 2019 19:38
RestTemplate 활용
private fun getResponse(disqusOauthUrl: String): ResponseEntity<String> {
val endpoint = URI.create(disqusOauthUrl)
val req = RequestEntity<Any>(HttpMethod.GET, endpoint)
val resType = object : ParameterizedTypeReference<String>() {}
return RestTemplate().exchange<String>(req, resType)
}
@benelog
benelog / AspectTest.java
Created April 9, 2019 19:56
spring aop order 테스트
package com.test.aop;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.aop.support.AopUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
@benelog
benelog / Test.jsh
Last active December 3, 2017 04:14
int count = 3; // main count1;
int count2 = 3; // main count2;
int count3 = 3; // main count3;
int count4 = 3; // main count4;
int causeCategoryCount = 3; // main count1;
I hope this edition captures my continued enthusiasm for the platform and helps make your use of the platform and its new features more effective and enjoyable.