Add ProxyFactoryCustomizer

Allows manipulating the `ProxyFactory` before the proxy is created

See gh-36225

Signed-off-by: Đặng Minh Dũng <dungdm93@live.com>
This commit is contained in:
Đặng Minh Dũng
2026-01-29 11:31:52 +07:00
committed by rstoyanchev
parent f1c86b1bbc
commit f2d3da3f32
2 changed files with 50 additions and 4 deletions
@@ -16,9 +16,9 @@
package org.springframework.web.service.invoker;
import org.aopalliance.intercept.MethodInterceptor;
import org.jspecify.annotations.Nullable;
import org.junit.jupiter.api.Test;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.web.service.annotation.GetExchange;
@@ -44,6 +44,18 @@ public class HttpServiceProxyFactoryTests {
}
@Test
void proxyFactoryCustomizer() {
var mi = (MethodInterceptor) invocation -> "intercepted";
var factory = HttpServiceProxyFactory.builderFor(mock(HttpExchangeAdapter.class))
.proxyCustomizer((fact, serviceType) -> {
fact.addAdvice(0, mi);
}).build();
var service = factory.createClient(Service.class);
assertThat(service.execute()).isEqualTo("intercepted");
}
private interface Service {
@GetExchange