Skip to content
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
wants to merge 32 commits into from
Closed
Show file tree
Hide file tree
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 Nov 6, 2017
926baab
Merge remote-tracking branch 'upstream/master'
mercyblitz Dec 26, 2017
562ce4f
Merge branch 'master' of https://github.com/mercyblitz/dubbo
mercyblitz Mar 12, 2018
4f34540
Manually merge pull request #1486, to make travis ci and codecov work…
chickenlj Mar 20, 2018
1e5b28f
Polish alibaba/dubbo#1306
mercyblitz Mar 30, 2018
24ebffc
Merge remote-tracking branch 'dubbo_remote/master'
mercyblitz Apr 15, 2018
4239a19
Merge branch 'master' into 2.5.x
mercyblitz Apr 15, 2018
0a570b7
Merge branch 'master' into 2.5.x
mercyblitz Apr 15, 2018
feac608
Merge pull request #21 from mercyblitz/2.5.x
mercyblitz Apr 15, 2018
93591f0
Optimize imports
mercyblitz Apr 15, 2018
d57343e
Optimize imports
mercyblitz Apr 15, 2018
d428f5f
Remove invalid JavaDoc
mercyblitz Apr 23, 2018
5d72ddf
Update DubboConfigBinder.java
mercyblitz Apr 23, 2018
a7d176f
Merge remote-tracking branch 'origin/master'
mercyblitz Apr 23, 2018
4d6b1fa
Merge remote-tracking branch 'upstream/master'
mercyblitz Apr 23, 2018
5bab141
Fix apache/incubator-dubbo#1653
mercyblitz Apr 23, 2018
677be3b
Merge remote-tracking branch 'upstream/master'
mercyblitz May 9, 2018
37293eb
Merge branch 'master' of https://github.com/alibaba/dubbo into 2.6.x
mercyblitz May 10, 2018
31acca8
Fixed apache/incubator-dubbo#1772
mercyblitz May 10, 2018
fd1c5f3
Merge branch 'master' of https://github.com/alibaba/dubbo into 2.6.x
mercyblitz May 15, 2018
43e6952
Merge remote-tracking branch 'upstream/master' into 2.6.x
mercyblitz May 18, 2018
d26978d
Merge remote-tracking branch 'dubbo_remote/2.6.x' into 2.6.x
mercyblitz Aug 10, 2018
185545e
Reactor ReferenceAnnotationBeanPostProcessor
mercyblitz Aug 13, 2018
3f99fe1
Fixed incubator-dubbo-spring-boot-project#243
Aug 13, 2018
b066ccf
Add ServiceBeanNameBuilder
Aug 13, 2018
80b6277
Polish apache/incubator-dubbo/#2235
mercyblitz Aug 13, 2018
cac7021
Polish incubator-dubbo#2251
mercyblitz Aug 14, 2018
a8f4f73
Update spring-context-supprt version to be release
mercyblitz Aug 14, 2018
593ce64
Rename ServiceBeanExportEvent to be ServiceBeanExportedEvent
mercyblitz Aug 14, 2018
c0928d8
Poblish apache/incubator-dubbo#2297
mercyblitz Aug 14, 2018
cba31b9
Polish apache/incubator-dubbo#2301
mercyblitz Aug 15, 2018
9d7fe24
Polish apache/incubator-dubbo#2315
mercyblitz Aug 17, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions dependencies-bom/pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
Expand Down Expand Up @@ -29,8 +30,8 @@
<url>https://github.com/apache/incubator-dubbo</url>
<connection>scm:git:https://github.com/apache/incubator-dubbo.git</connection>
<developerConnection>scm:git:https://github.com/apache/incubator-dubbo.git</developerConnection>
<tag>HEAD</tag>
</scm>
<tag>HEAD</tag>
</scm>
<mailingLists>
<mailingList>
<name>Development List</name>
Expand Down Expand Up @@ -101,6 +102,9 @@
<rs_api_version>2.0</rs_api_version>
<resteasy_version>3.0.19.Final</resteasy_version>
<tomcat_embed_version>8.5.31</tomcat_embed_version>

<!-- Alibaba Spring context support -->
<alibaba_spring_context_support_version>1.0.1</alibaba_spring_context_support_version>
<!-- Log libs -->
<slf4j_version>1.7.25</slf4j_version>
<jcl_version>1.2</jcl_version>
Expand Down Expand Up @@ -300,6 +304,14 @@
<artifactId>tomcat-embed-logging-juli</artifactId>
<version>${tomcat_embed_version}</version>
</dependency>

<!-- Spring Context Support -->
<dependency>
<groupId>com.alibaba.spring</groupId>
<artifactId>spring-context-support</artifactId>
<version>${alibaba_spring_context_support_version}</version>
</dependency>

<!-- Log libs -->
<dependency>
<groupId>org.slf4j</groupId>
Expand Down
4 changes: 4 additions & 0 deletions dubbo-config/dubbo-config-spring/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.alibaba.spring</groupId>
<artifactId>spring-context-support</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>dubbo-registry-default</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;

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 *

Copy link
Contributor Author

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.*;
Copy link
Member

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 * , same as @diecui1202 said.

import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.context.support.AbstractApplicationContext;

Expand All @@ -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;

Expand All @@ -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;
Expand Down Expand Up @@ -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.
Expand All @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

/**
* Abstract Configurable {@link Annotation} Bean Builder
*
* @since 2.5.7
*/
abstract class AbstractAnnotationConfigBeanBuilder<A extends Annotation, B extends AbstractInterfaceConfig> {
Expand Down Expand Up @@ -76,7 +77,7 @@ public final B build() throws Exception {
configureBean(bean);

if (logger.isInfoEnabled()) {
logger.info(bean + " has been built.");
logger.info("The bean[type:" + bean.getClass().getSimpleName() + "] has been built.");
}

return bean;
Expand Down
Loading