parent
4bddbd30c4
commit
bb44c0e13a
|
|
@ -26,6 +26,7 @@ import org.springframework.core.annotation.AliasFor;
|
|||
|
||||
|
||||
/**
|
||||
* Shortcut for {@link HttpRequest} for HTTP GET requests.
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 6.0
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import java.lang.annotation.Target;
|
|||
import org.springframework.core.annotation.AliasFor;
|
||||
|
||||
/**
|
||||
* Shortcut for {@link HttpRequest} for HTTP POST requests.
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 6.0
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import java.lang.annotation.Target;
|
|||
import org.springframework.core.annotation.AliasFor;
|
||||
|
||||
/**
|
||||
* Shortcut for {@link HttpRequest} for HTTP PUT requests.
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 6.0
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ import org.reactivestreams.Publisher;
|
|||
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.core.ResolvableType;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.HttpRequest;
|
||||
|
|
@ -56,7 +55,7 @@ public class HttpRequestDefinition {
|
|||
|
||||
@Nullable
|
||||
private URI uri;
|
||||
|
||||
|
||||
@Nullable
|
||||
private String uriTemplate;
|
||||
|
||||
|
|
@ -80,7 +79,7 @@ public class HttpRequestDefinition {
|
|||
|
||||
@Nullable
|
||||
private Publisher<?> bodyPublisher;
|
||||
|
||||
|
||||
@Nullable
|
||||
private ParameterizedTypeReference<?> bodyPublisherElementType;
|
||||
|
||||
|
|
|
|||
|
|
@ -24,8 +24,6 @@ import java.util.Map;
|
|||
|
||||
import org.aopalliance.intercept.MethodInterceptor;
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.framework.ProxyFactory;
|
||||
import org.springframework.core.MethodIntrospector;
|
||||
|
|
@ -91,7 +89,7 @@ public class HttpServiceProxyFactory {
|
|||
|
||||
|
||||
/**
|
||||
*
|
||||
* {@link MethodInterceptor} that invokes an {@link HttpServiceMethod}.
|
||||
*/
|
||||
private static final class HttpServiceMethodInterceptor implements MethodInterceptor {
|
||||
|
||||
|
|
@ -101,9 +99,8 @@ public class HttpServiceProxyFactory {
|
|||
methods.forEach(serviceMethod -> this.serviceMethodMap.put(serviceMethod.getMethod(), serviceMethod));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Object invoke(@NotNull MethodInvocation invocation) throws Throwable {
|
||||
public Object invoke(MethodInvocation invocation) throws Throwable {
|
||||
Method method = invocation.getMethod();
|
||||
HttpServiceMethod httpServiceMethod = this.serviceMethodMap.get(method);
|
||||
return httpServiceMethod.invoke(invocation.getArguments());
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
/**
|
||||
*
|
||||
* Support to create a client proxy for an HTTP service annotated with
|
||||
* {@link org.springframework.web.service.annotation.HttpRequest} methods.
|
||||
*/
|
||||
@NonNullApi
|
||||
@NonNullFields
|
||||
|
|
|
|||
|
|
@ -37,13 +37,13 @@ public class HttpMethodArgumentResolverTests {
|
|||
|
||||
private final Service service = this.clientAdapter.createService(Service.class, new HttpMethodArgumentResolver());
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
void shouldResolveRequestMethodFromArgument() {
|
||||
this.service.execute(HttpMethod.GET);
|
||||
assertThat(getActualMethod()).isEqualTo(HttpMethod.GET);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
void shouldIgnoreArgumentsNotMatchingType() {
|
||||
this.service.execute("test");
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ package org.springframework.web.service.invoker;
|
|||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.core.convert.support.DefaultConversionService;
|
||||
|
|
@ -143,7 +142,6 @@ class PathVariableArgumentResolverTests {
|
|||
assertThat(getActualUriVariables().get(name)).isEqualTo(expectedValue);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private Map<String, String> getActualUriVariables() {
|
||||
return this.clientAdapter.getRequestDefinition().getUriVariables();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue