Skip to content

Commit

Permalink
ShadedHttpServiceProxyFactory add UriBuilderFactoryArgumentResolver
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielLiu1123 committed Nov 24, 2023
1 parent 165e819 commit 7847fa4
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
#!/usr/bin/env bash

./gradlew spotlessApply > /dev/null

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
push:
branches:
- main
- 3.2.x
- 3.1.x
jobs:
build:
runs-on: ubuntu-latest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ public class HttpExchangeProperties implements InitializingBean {
private Integer readTimeout;
/**
* Whether to check unused configuration, default {@code true}.
*
* @since 3.2.0
*/
private boolean warnUnusedConfig = true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import org.springframework.web.service.invoker.RequestHeaderArgumentResolver;
import org.springframework.web.service.invoker.RequestParamArgumentResolver;
import org.springframework.web.service.invoker.RequestPartArgumentResolver;
import org.springframework.web.service.invoker.UriBuilderFactoryArgumentResolver;
import org.springframework.web.service.invoker.UrlArgumentResolver;
import reactor.core.publisher.Mono;

Expand All @@ -64,10 +65,10 @@
* {@link Builder Builder}.
*
* @author Rossen Stoyanchev
* @since 6.0
* @see org.springframework.web.client.support.RestClientAdapter
* @see org.springframework.web.reactive.function.client.support.WebClientAdapter
* @see org.springframework.web.client.support.RestTemplateAdapter
* @since 6.0
*/
public final class ShadedHttpServiceProxyFactory {

Expand All @@ -91,8 +92,9 @@ private ShadedHttpServiceProxyFactory(
/**
* Return a proxy that implements the given HTTP service interface to perform
* HTTP requests and retrieve responses through an HTTP client.
*
* @param serviceType the HTTP service to create a proxy for
* @param <S> the HTTP service type
* @param <S> the HTTP service type
* @return the created proxy
*/
public <S> S createClient(Class<S> serviceType) {
Expand All @@ -119,6 +121,7 @@ private <S> ShadedHttpServiceMethod createHttpServiceMethod(Class<S> serviceType

/**
* Return a builder that's initialized with the given client.
*
* @since 6.1
*/
public static Builder builderFor(HttpExchangeAdapter exchangeAdapter) {
Expand All @@ -127,6 +130,7 @@ public static Builder builderFor(HttpExchangeAdapter exchangeAdapter) {

/**
* Return a builder that's initialized with the given client.
*
* @deprecated in favor of {@link #builderFor(HttpExchangeAdapter)};
* to be removed in 6.2.
*/
Expand All @@ -148,7 +152,7 @@ public static Builder builder() {
*/
public static final class Builder {

// @Nullable
@Nullable
private HttpExchangeAdapter exchangeAdapter;

private final List<HttpServiceArgumentResolver> customArgumentResolvers = new ArrayList<>();
Expand All @@ -163,6 +167,7 @@ private Builder() {}

/**
* Provide the HTTP client to perform requests through.
*
* @param adapter a client adapted to {@link HttpExchangeAdapter}
* @return this same builder instance
* @since 6.1
Expand All @@ -174,6 +179,7 @@ public Builder exchangeAdapter(HttpExchangeAdapter adapter) {

/**
* Provide the HTTP client to perform requests through.
*
* @param clientAdapter a client adapted to {@link HttpClientAdapter}
* @return this same builder instance
* @deprecated in favor of {@link #exchangeAdapter(HttpExchangeAdapter)};
Expand All @@ -188,6 +194,7 @@ public Builder clientAdapter(HttpClientAdapter clientAdapter) {

/**
* Register a custom argument resolver, invoked ahead of default resolvers.
*
* @param resolver the resolver to add
* @return this same builder instance
*/
Expand All @@ -200,6 +207,7 @@ public Builder customArgumentResolver(HttpServiceArgumentResolver resolver) {
* Set the {@link ConversionService} to use where input values need to
* be formatted as Strings.
* <p>By default this is {@link DefaultFormattingConversionService}.
*
* @return this same builder instance
*/
public Builder conversionService(ConversionService conversionService) {
Expand All @@ -210,6 +218,7 @@ public Builder conversionService(ConversionService conversionService) {
/**
* Set the {@link StringValueResolver} to use for resolving placeholders
* and expressions embedded in {@link HttpExchange#url()}.
*
* @param embeddedValueResolver the resolver to use
* @return this same builder instance
*/
Expand All @@ -222,6 +231,7 @@ public Builder embeddedValueResolver(StringValueResolver embeddedValueResolver)
* Set the {@link ReactiveAdapterRegistry} to use to support different
* asynchronous types for HTTP service method return values.
* <p>By default this is {@link ReactiveAdapterRegistry#getSharedInstance()}.
*
* @return this same builder instance
* @deprecated in favor of setting the same directly on the {@link HttpExchangeAdapter}
*/
Expand All @@ -240,6 +250,7 @@ public Builder reactiveAdapterRegistry(ReactiveAdapterRegistry registry) {
* connection and request timeout settings of the underlying HTTP client.
* We recommend configuring timeout values directly on the underlying HTTP
* client, which provides more control over such settings.
*
* @param blockTimeout the timeout value
* @return this same builder instance
* @deprecated in favor of setting the same directly on the {@link HttpExchangeAdapter}
Expand Down Expand Up @@ -285,6 +296,7 @@ private List<HttpServiceArgumentResolver> initArgumentResolvers() {

// Specific type
resolvers.add(new UrlArgumentResolver());
resolvers.add(new UriBuilderFactoryArgumentResolver());
resolvers.add(new HttpMethodArgumentResolver());

return resolvers;
Expand Down

0 comments on commit 7847fa4

Please sign in to comment.