Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- intelij devtools
- intelij spring boot devtools
- spring boot 2.0 ssl
- spring cloud api gateway
- redis cluster
- spring boot http client
- sidecar patern
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <rect x="10" y="10" height="100" width="100" style="stroke:#ff0000; fill: #0000ff"/> </svg>
- kubernates
- spring boot ssl verify skip
- spring boot hot swapping
- java static resources
- jpa auto increment
- high availabillty
- Spring Cloud Config
- spring cloud load balancer
- Spring Cloud Bus
- tracing tool
- spring boot ssl
- Spring boot
- sidecar
- Distributed Tracing System
- MySQL
- Istio
- <iframe src="http://erea.tistory.com/attachment/cfile21.uf@997995485B2F785A3292EE.svg"></iframe>
- spring boot jks
- spring cloud zuul
- redis ha
- Service Mesh
- msa 4.0
Archives
- Today
- Total
erea
spring boot http client ssl 체크 패스하기 본문
내부 테스트서버나 로컬에서 ssl 통신을 할때 유용하다.
httpClientConfig.java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | <p> @Configuration public class HttpClientConfig { @Bean public RestTemplate restTemplate() throws KeyStoreException, NoSuchAlgorithmException, KeyManagementException { TrustStrategy acceptingTrustStrategy = (X509Certificate[] chain, String authType) -> true ; SSLContext sslContext = org.apache.http.ssl.SSLContexts.custom() .loadTrustMaterial( null , acceptingTrustStrategy) .build(); SSLConnectionSocketFactory csf = new SSLConnectionSocketFactory(sslContext); CloseableHttpClient httpClient = HttpClients.custom() .setSSLSocketFactory(csf) .build(); HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(); requestFactory.setHttpClient(httpClient); RestTemplate restTemplate = new RestTemplate(requestFactory); return restTemplate; } } </p> |
생성후 본문에
1 2 3 4 | @Autowire HttpClientConfig httpClientConfig< URI uri = URI.create(Url+ "/api/articles" ); String responseString = httpClientConfig.getForObject(uri, String. class ); |
'dev > spring boot' 카테고리의 다른 글
spring boot ssl (1) | 2019.01.02 |
---|---|
Spring boot devtools hot swapping by intelij (0) | 2018.07.05 |
Setter DI vs. Constructor DI in Spring (0) | 2018.06.25 |
spring boot 2.0 hibernate 5 mysql auto increment (0) | 2018.06.25 |
spring boot (0) | 2018.06.24 |