-
Notifications
You must be signed in to change notification settings - Fork 8.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bugfix: can't integrate dubbo with spring #6015
Changes from 15 commits
69c1714
fd0a404
3e2bd44
f3793c2
39391d0
b3f1002
1eca9c2
f1c85a1
16481d2
432b7bf
ea47722
b699d93
50f5a3b
4b97db7
be75f7b
dc70321
770b77d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,6 +75,13 @@ protected void initRemotingParser() { | |
} | ||
} | ||
|
||
/** | ||
* register custom remoting parser | ||
* @param remotingParser | ||
*/ | ||
public void registerRemotingParser(RemotingParser remotingParser) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 注册方法最好加锁(因为可以牵扯到并发注册),或者使用copyOnwrite的方式 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
allRemotingParsers.add(remotingParser); | ||
} | ||
/** | ||
* is remoting bean ? | ||
* | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,11 @@ | |
*/ | ||
public class RemotingFactoryBeanParser extends AbstractedRemotingParser { | ||
|
||
public static ApplicationContext applicationContext; | ||
public ApplicationContext applicationContext; | ||
|
||
public RemotingFactoryBeanParser(ApplicationContext applicationContext) { | ||
this.applicationContext = applicationContext; | ||
} | ||
|
||
/** | ||
* if it is proxy bean, check if the FactoryBean is Remoting bean | ||
|
@@ -36,7 +40,7 @@ public class RemotingFactoryBeanParser extends AbstractedRemotingParser { | |
* @param beanName the bean name | ||
* @return boolean boolean | ||
*/ | ||
protected static Object getRemotingFactoryBean(Object bean, String beanName) { | ||
protected Object getRemotingFactoryBean(Object bean, String beanName) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 我们是不是在构造方法里面加一个applicationContext!=null的check(防止一些spring异常场景,applicationContext没set进去),那么getRemotingFactoryBean里面的applicationContext!=null是可以去除掉的。 另外factoryBeanName的构建落在多个方法里面,是否能够抽出一个统一的方法 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
if (!SpringProxyUtils.isProxy(bean)) { | ||
return null; | ||
} | ||
|
@@ -55,7 +59,8 @@ public boolean isReference(Object bean, String beanName) { | |
if (factoryBean == null) { | ||
return false; | ||
} | ||
return DefaultRemotingParser.get().isReference(bean, beanName); | ||
String factoryBeanName = "&" + beanName; | ||
return DefaultRemotingParser.get().isReference(factoryBean, factoryBeanName); | ||
} | ||
|
||
@Override | ||
|
@@ -64,7 +69,8 @@ public boolean isService(Object bean, String beanName) { | |
if (factoryBean == null) { | ||
return false; | ||
} | ||
return DefaultRemotingParser.get().isReference(bean, beanName); | ||
String factoryBeanName = "&" + beanName; | ||
return DefaultRemotingParser.get().isService(factoryBean, factoryBeanName); | ||
} | ||
|
||
@Override | ||
|
@@ -73,12 +79,13 @@ public RemotingDesc getServiceDesc(Object bean, String beanName) throws Framewor | |
if (factoryBean == null) { | ||
return null; | ||
} | ||
return DefaultRemotingParser.get().getServiceDesc(bean, beanName); | ||
String factoryBeanName = "&" + beanName; | ||
return DefaultRemotingParser.get().getServiceDesc(factoryBean, factoryBeanName); | ||
} | ||
|
||
|
||
@Override | ||
public short getProtocol() { | ||
return 0; | ||
} | ||
|
||
} |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2.x 目前和spring解耦的,beanName是spring的定义。我们这里设置成objectName是不是更好,在spring的场景下:objectName = beanName
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done