mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
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:
committed by
rstoyanchev
parent
f1c86b1bbc
commit
f2d3da3f32
+13
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user