Skip to content

Commit

Permalink
feat : use OOTB http client settings
Browse files Browse the repository at this point in the history
  • Loading branch information
rajadilipkolli authored Dec 12, 2024
1 parent 35bd6fb commit e0bb1fd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion retail-store-webapp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
<importOrder />
<removeUnusedImports />
<palantirJavaFormat>
<version>2.47.0</version>
<version>2.50.0</version>
</palantirJavaFormat>
<formatAnnotations />
</java>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
import com.example.retailstore.webapp.clients.order.OrderServiceClient;
import com.example.retailstore.webapp.config.ApplicationProperties;
import io.micrometer.observation.ObservationRegistry;
import java.time.Duration;
import org.springframework.boot.web.client.ClientHttpRequestFactories;
import org.springframework.boot.web.client.ClientHttpRequestFactorySettings;
import org.springframework.boot.web.client.RestClientCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand All @@ -29,9 +26,6 @@ class ClientsConfig {
@Bean
RestClientCustomizer restClientCustomizer(ObservationRegistry observationRegistry) {
return restClientBuilder -> restClientBuilder
.requestFactory(ClientHttpRequestFactories.get(ClientHttpRequestFactorySettings.DEFAULTS
.withConnectTimeout(Duration.ofSeconds(5))
.withReadTimeout(Duration.ofSeconds(5))))
.defaultHeaders(httpHeaders -> {
httpHeaders.add(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE);
httpHeaders.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ REALM_URL=${OAUTH2_SERVER_URL}/realms/retailstore
spring.security.oauth2.client.registration.retailstore-webapp.client-id=retailstore-webapp
spring.security.oauth2.client.registration.retailstore-webapp.client-secret=P1sibsIrELBhmvK18BOzw1bUl96DcP2z
spring.security.oauth2.client.registration.retailstore-webapp.authorization-grant-type=authorization_code
spring.security.oauth2.client.registration.retailstore-webapp.scope=openid, profile
spring.security.oauth2.client.registration.retailstore-webapp.scope=openid, profile
spring.threads.virtual.enabled=true
spring.security.oauth2.client.registration.retailstore-webapp.redirect-uri={baseUrl}/login/oauth2/code/retailstore-webapp

Expand All @@ -30,3 +30,7 @@ spring.security.oauth2.client.provider.retailstore-webapp.issuer-uri=${REALM_URL
#spring.security.oauth2.client.provider.retailstore-webapp.token-uri=${REALM_URL}/protocol/openid-connect/token
#spring.security.oauth2.client.provider.retailstore-webapp.jwk-set-uri=${REALM_URL}/protocol/openid-connect/certs
#spring.security.oauth2.client.provider.retailstore-webapp.user-info-uri=${REALM_URL}/protocol/openid-connect/userinfo

#### Http Client Settings
spring.http.client.read-timeout=PT10S
spring.http.client.connect-timeout=PT5S

0 comments on commit e0bb1fd

Please sign in to comment.