Table of Contents
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.
Table of Contents
|
Note
|
Spring Retry는 Spring Batch, Spring Integration 내부에서 재시도를 위해 사용되던 모듈이었다. Spring framework 7.0 부터는 Spring Core 모듈로 흡수가 되었다.
현재 버전의 유요한 사용법은 Resilience Features을 참고할 수 있다. 이 글에 소개된 @Recover와 @CircuitBreaker는 Spring framework 7.0에서는 지원되지는 않는다.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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"); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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("/") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; |
NewerOlder