-
Notifications
You must be signed in to change notification settings - Fork 26.5k
DubboNamespaceHandler 注册监听方法 registerApplicationListeners #6275
Copy link
Copy link
Closed
Milestone
Description
- I have searched the issues of this repository and believe that this is not a duplicate.
- I have checked the FAQ of this repository and believe that this is not a duplicate.
Environment
- Dubbo version: 2.7.7
- Operating System version: macOS Mojave
- Java version: 1.8
@Override
public BeanDefinition parse(Element element, ParserContext parserContext) {
...
registerApplicationListeners(registry);
...
private void registerApplicationListeners(BeanDefinitionRegistry registry) {
registerBeans(registry, DubboLifecycleComponentApplicationListener.class);
registerBeans(registry, DubboBootstrapApplicationListener.class);
}
解析每一个element节点都会调用registerApplicationListeners方法,虽然在registerBeans中是有判断
bean是否已经注册过了,如果注册就忽略,但是可以在registerApplicationListeners方法中判断下,如果已经存在了就不再调用registerBeans方法了
private void registerApplicationListeners(BeanDefinitionRegistry registry) {
if (!isPresentBean(registry, DubboLifecycleComponentApplicationListener.class)) {
registerBeans(registry, DubboLifecycleComponentApplicationListener.class);
}
if (!isPresentBean(registry, DubboBootstrapApplicationListener.class)) {
registerBeans(registry, DubboBootstrapApplicationListener.class);
}
}
Just put your stack trace here!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Fields
Give feedbackNo fields configured for issues without a type.