Skip to content

Commit d53a1f4

Browse files
author
songjialin
committed
代理工厂
1 parent 2f16c6c commit d53a1f4

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

src/main/java/com/github/yungyu16/spring/stub/StubBeanPostProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public Object postProcessBeforeInstantiation(Class<?> type, String name) throws
2727
throw new BeanCreationNotAllowedException(name, type.getName() + " 不是Interface");
2828
}
2929
StubProxyFactory stubProxyFactory = getStubProxyFactory(proxyStub);
30-
return stubProxyFactory.proxy(type, proxyStub);
30+
return stubProxyFactory.createProxy(type, proxyStub);
3131
}
3232

3333
private StubProxyFactory getStubProxyFactory(ProxyStub proxyStub) {

src/main/java/com/github/yungyu16/spring/stub/proxy/DefaultStubProxyFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class DefaultStubProxyFactory implements StubProxyFactory, BeanFactoryAwa
2525

2626
@SuppressWarnings("rawtypes,unchecked")
2727
@Override
28-
public <T> T proxy(Class<T> stubInterface, ProxyStub stubAnnotation) {
28+
public <T> T createProxy(Class<T> stubInterface, ProxyStub stubAnnotation) {
2929
AbstractInvocationDispatcher invocationDispatcher = getInvocationDispatcher(stubInterface, stubAnnotation);
3030
Class annotationType = invocationDispatcher.getAnnotationType();
3131
Annotation annotation = AnnotationUtils.findAnnotation(stubInterface, annotationType);

src/main/java/com/github/yungyu16/spring/stub/proxy/StubProxyFactory.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
public interface StubProxyFactory {
1010

1111
default Class<?>[] collectProxyInterface(Class<?> interfaceType) {
12-
return new Class[]{interfaceType, StubLabel.class};
12+
return new Class[]{interfaceType, StubProxyLabel.class};
1313
}
1414

15-
<T> T proxy(Class<T> stubInterface, ProxyStub stubAnnotation);
15+
<T> T createProxy(Class<T> stubInterface, ProxyStub stubAnnotation);
1616
}

src/main/java/com/github/yungyu16/spring/stub/proxy/StubLabel.java renamed to src/main/java/com/github/yungyu16/spring/stub/proxy/StubProxyLabel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
* CreatedDate: 2020/11/24
66
* Author: songjialin
77
*/
8-
public interface StubLabel {
8+
public interface StubProxyLabel {
99
}

src/test/java/com/github/yungyu16/spring/stub/example/service/StubProxyFactory3.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
public class StubProxyFactory3 implements StubProxyFactory {
1717
@SuppressWarnings("unchecked")
1818
@Override
19-
public <T> T proxy(Class<T> stubInterface, ProxyStub stubAnnotation) {
19+
public <T> T createProxy(Class<T> stubInterface, ProxyStub stubAnnotation) {
2020
return (T) Proxy.newProxyInstance(ClassUtils.getDefaultClassLoader(), collectProxyInterface(stubInterface), (proxy, method, args) -> {
2121
if (ReflectionUtils.isToStringMethod(method)) {
2222
return "ProxyStub:" + ClassUtils.classNamesToString(stubInterface) + ":" + stubAnnotation;

0 commit comments

Comments
 (0)