Revert "Introduce ProxyHints.registerJdkProxy(String...)"

This reverses commit b560c10d4c.

See gh-28781
This commit is contained in:
Sam Brannen 2022-07-11 17:09:27 +02:00
parent 49dfcad447
commit d8003e326d
3 changed files with 2 additions and 42 deletions

View File

@ -29,7 +29,6 @@ import org.springframework.lang.Nullable;
* *
* @author Stephane Nicoll * @author Stephane Nicoll
* @author Brian Clozel * @author Brian Clozel
* @author Sam Brannen
* @since 6.0 * @since 6.0
*/ */
public final class JdkProxyHint implements ConditionalHint { public final class JdkProxyHint implements ConditionalHint {
@ -131,17 +130,6 @@ public final class JdkProxyHint implements ConditionalHint {
return this; return this;
} }
/**
* Add the specified interfaces that the proxy should implement.
* @param proxiedInterfaces the fully qualified class names of interfaces
* the proxy should implement
* @return {@code this}, to facilitate method chaining
*/
public Builder proxiedInterfaces(String... proxiedInterfaces) {
this.proxiedInterfaces.addAll(toTypeReferences(proxiedInterfaces));
return this;
}
/** /**
* Make this hint conditional on the fact that the specified type * Make this hint conditional on the fact that the specified type
* can be resolved. * can be resolved.
@ -171,10 +159,6 @@ public final class JdkProxyHint implements ConditionalHint {
return Arrays.stream(proxiedInterfaces).map(TypeReference::of).toList(); return Arrays.stream(proxiedInterfaces).map(TypeReference::of).toList();
} }
private static List<TypeReference> toTypeReferences(String... proxiedInterfaces) {
return Arrays.stream(proxiedInterfaces).map(TypeReference::of).toList();
}
} }
} }

View File

@ -27,7 +27,6 @@ import org.springframework.aot.hint.ClassProxyHint.Builder;
* Gather the need for using proxies at runtime. * Gather the need for using proxies at runtime.
* *
* @author Stephane Nicoll * @author Stephane Nicoll
* @author Sam Brannen
* @since 6.0 * @since 6.0
*/ */
public class ProxyHints { public class ProxyHints {
@ -91,21 +90,6 @@ public class ProxyHints {
jdkProxyHint.proxiedInterfaces(proxiedInterfaces)); jdkProxyHint.proxiedInterfaces(proxiedInterfaces));
} }
/**
* Register that a JDK proxy implementing the specified interfaces is
* required.
* <p>When registering a JDK proxy for Spring AOP, consider using
* {@link org.springframework.aop.framework.AopProxyUtils#completeJdkProxyInterfaces(String...)
* AopProxyUtils.completeJdkProxyInterfaces()} for convenience.
* @param proxiedInterfaces the fully qualified class names of interfaces the
* proxy should implement
* @return {@code this}, to facilitate method chaining
*/
public ProxyHints registerJdkProxy(String... proxiedInterfaces) {
return registerJdkProxy(jdkProxyHint ->
jdkProxyHint.proxiedInterfaces(proxiedInterfaces));
}
/** /**
* Register that a class proxy is required for the class defined by the * Register that a class proxy is required for the class defined by the
* specified {@link TypeReference}. * specified {@link TypeReference}.

View File

@ -32,7 +32,6 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
* Tests for {@link ProxyHints}. * Tests for {@link ProxyHints}.
* *
* @author Stephane Nicoll * @author Stephane Nicoll
* @author Sam Brannen
*/ */
class ProxyHintsTests { class ProxyHintsTests {
@ -53,17 +52,10 @@ class ProxyHintsTests {
@Test @Test
void registerJdkProxyWithInterfaceClassNames() { void registerJdkProxyWithInterfaceClassNames() {
this.proxyHints.registerJdkProxy(Function.class.getName(), "com.example.Advised");
assertThat(this.proxyHints.jdkProxies()).singleElement()
.satisfies(proxiedInterfaces(Function.class.getName(), "com.example.Advised"));
}
@Test
void registerJdkProxyWithTypeReferences() {
this.proxyHints.registerJdkProxy(TypeReference.of(Function.class), this.proxyHints.registerJdkProxy(TypeReference.of(Function.class),
TypeReference.of("com.example.Advised")); TypeReference.of("com.example.Advised"));
assertThat(this.proxyHints.jdkProxies()).singleElement() assertThat(this.proxyHints.jdkProxies()).singleElement().satisfies(proxiedInterfaces(
.satisfies(proxiedInterfaces(Function.class.getName(), "com.example.Advised")); Function.class.getName(), "com.example.Advised"));
} }
@Test @Test