일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- spring cloud zuul
- spring boot jks
- spring boot ssl verify skip
- kubernates
- sidecar
- spring boot ssl
- msa 4.0
- spring boot 2.0 ssl
- Distributed Tracing System
- tracing tool
- high availabillty
- spring boot http client
- <iframe src="http://erea.tistory.com/attachment/cfile21.uf@997995485B2F785A3292EE.svg"></iframe>
- intelij spring boot devtools
- Service Mesh
- Spring Cloud Config
- spring cloud load balancer
- Spring boot
- MySQL
- Spring Cloud Bus
- spring boot hot swapping
- intelij devtools
- redis cluster
- spring cloud api gateway
- java static resources
- <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>
- jpa auto increment
- redis ha
- sidecar patern
- Istio
- Today
- Total
erea
spring boot http client ssl 체크 패스하기 본문
내부 테스트서버나 로컬에서 ssl 통신을 할때 유용하다.
httpClientConfig.java
@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; } }
생성후 본문에
@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 |