-
Notifications
You must be signed in to change notification settings - Fork 26.4k
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
2.6.x Spring Event & Bugfix #2256
Closed
Closed
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
562a126
Merge pull request #15 from alibaba/master
mercyblitz 926baab
Merge remote-tracking branch 'upstream/master'
mercyblitz 562ce4f
Merge branch 'master' of https://github.com/mercyblitz/dubbo
mercyblitz 4f34540
Manually merge pull request #1486, to make travis ci and codecov work…
chickenlj 1e5b28f
Polish alibaba/dubbo#1306
mercyblitz 24ebffc
Merge remote-tracking branch 'dubbo_remote/master'
mercyblitz 4239a19
Merge branch 'master' into 2.5.x
mercyblitz 0a570b7
Merge branch 'master' into 2.5.x
mercyblitz feac608
Merge pull request #21 from mercyblitz/2.5.x
mercyblitz 93591f0
Optimize imports
mercyblitz d57343e
Optimize imports
mercyblitz d428f5f
Remove invalid JavaDoc
mercyblitz 5d72ddf
Update DubboConfigBinder.java
mercyblitz a7d176f
Merge remote-tracking branch 'origin/master'
mercyblitz 4d6b1fa
Merge remote-tracking branch 'upstream/master'
mercyblitz 5bab141
Fix apache/incubator-dubbo#1653
mercyblitz 677be3b
Merge remote-tracking branch 'upstream/master'
mercyblitz 37293eb
Merge branch 'master' of https://github.com/alibaba/dubbo into 2.6.x
mercyblitz 31acca8
Fixed apache/incubator-dubbo#1772
mercyblitz fd1c5f3
Merge branch 'master' of https://github.com/alibaba/dubbo into 2.6.x
mercyblitz 43e6952
Merge remote-tracking branch 'upstream/master' into 2.6.x
mercyblitz d26978d
Merge remote-tracking branch 'dubbo_remote/2.6.x' into 2.6.x
mercyblitz 185545e
Reactor ReferenceAnnotationBeanPostProcessor
mercyblitz 3f99fe1
Fixed incubator-dubbo-spring-boot-project#243
b066ccf
Add ServiceBeanNameBuilder
80b6277
Polish apache/incubator-dubbo/#2235
mercyblitz cac7021
Polish incubator-dubbo#2251
mercyblitz a8f4f73
Update spring-context-supprt version to be release
mercyblitz 593ce64
Rename ServiceBeanExportEvent to be ServiceBeanExportedEvent
mercyblitz c0928d8
Poblish apache/incubator-dubbo#2297
mercyblitz cba31b9
Polish apache/incubator-dubbo#2301
mercyblitz 9d7fe24
Polish apache/incubator-dubbo#2315
mercyblitz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,23 +16,16 @@ | |
*/ | ||
package com.alibaba.dubbo.config.spring; | ||
|
||
import com.alibaba.dubbo.config.ApplicationConfig; | ||
import com.alibaba.dubbo.config.ModuleConfig; | ||
import com.alibaba.dubbo.config.MonitorConfig; | ||
import com.alibaba.dubbo.config.ProtocolConfig; | ||
import com.alibaba.dubbo.config.ProviderConfig; | ||
import com.alibaba.dubbo.config.RegistryConfig; | ||
import com.alibaba.dubbo.config.ServiceConfig; | ||
import com.alibaba.dubbo.config.*; | ||
import com.alibaba.dubbo.config.annotation.Service; | ||
import com.alibaba.dubbo.config.spring.context.event.ServiceBeanExportedEvent; | ||
import com.alibaba.dubbo.config.spring.extension.SpringExtensionFactory; | ||
import org.springframework.aop.support.AopUtils; | ||
import org.springframework.beans.factory.BeanFactoryUtils; | ||
import org.springframework.beans.factory.BeanNameAware; | ||
import org.springframework.beans.factory.DisposableBean; | ||
import org.springframework.beans.factory.InitializingBean; | ||
import org.springframework.context.ApplicationContext; | ||
import org.springframework.context.ApplicationContextAware; | ||
import org.springframework.context.ApplicationListener; | ||
import org.springframework.context.*; | ||
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. make sure not add import * , same as @diecui1202 said. |
||
import org.springframework.context.event.ContextRefreshedEvent; | ||
import org.springframework.context.support.AbstractApplicationContext; | ||
|
||
|
@@ -46,7 +39,9 @@ | |
* | ||
* @export | ||
*/ | ||
public class ServiceBean<T> extends ServiceConfig<T> implements InitializingBean, DisposableBean, ApplicationContextAware, ApplicationListener<ContextRefreshedEvent>, BeanNameAware { | ||
public class ServiceBean<T> extends ServiceConfig<T> implements InitializingBean, DisposableBean, | ||
ApplicationContextAware, ApplicationListener<ContextRefreshedEvent>, BeanNameAware, | ||
ApplicationEventPublisherAware { | ||
|
||
private static final long serialVersionUID = 213195494150089726L; | ||
|
||
|
@@ -60,6 +55,8 @@ public class ServiceBean<T> extends ServiceConfig<T> implements InitializingBean | |
|
||
private transient boolean supportedApplicationListener; | ||
|
||
private ApplicationEventPublisher applicationEventPublisher; | ||
|
||
public ServiceBean() { | ||
super(); | ||
this.service = null; | ||
|
@@ -265,6 +262,34 @@ && getInterface() != null && getInterface().length() > 0 | |
} | ||
} | ||
|
||
/** | ||
* Get the name of {@link ServiceBean} | ||
* | ||
* @return {@link ServiceBean}'s name | ||
* @since 2.6.4 | ||
*/ | ||
public String getBeanName() { | ||
return this.beanName; | ||
} | ||
|
||
/** | ||
* @since 2.6.4 | ||
*/ | ||
@Override | ||
public void export() { | ||
super.export(); | ||
// Publish ServiceBeanExportedEvent | ||
publishExportEvent(); | ||
} | ||
|
||
/** | ||
* @since 2.6.4 | ||
*/ | ||
private void publishExportEvent() { | ||
ServiceBeanExportedEvent exportEvent = new ServiceBeanExportedEvent(this); | ||
applicationEventPublisher.publishEvent(exportEvent); | ||
} | ||
|
||
@Override | ||
public void destroy() throws Exception { | ||
// This will only be called for singleton scope bean, and expected to be called by spring shutdown hook when BeanFactory/ApplicationContext destroys. | ||
|
@@ -280,4 +305,13 @@ protected Class getServiceClass(T ref) { | |
} | ||
return super.getServiceClass(ref); | ||
} | ||
|
||
/** | ||
* @param applicationEventPublisher | ||
* @since 2.6.4 | ||
*/ | ||
@Override | ||
public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) { | ||
this.applicationEventPublisher = applicationEventPublisher; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
make sure not add import *
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.
Ok, it requires change IDEA Template
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.
Code style template: https://github.com/apache/incubator-dubbo/blob/master/codestyle/dubbo_codestyle_for_idea.xml