Skip to content

Commit

Permalink
Polish /apache#5594 : Fixed test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
mercyblitz committed Feb 14, 2020
1 parent 253e4c7 commit b9c7a8b
Showing 1 changed file with 1 addition and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,14 @@
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;

import java.util.Objects;

/**
* ServiceFactoryBean
*
* @export
*/
public class ServiceBean<T> extends ServiceConfig<T> implements InitializingBean, DisposableBean,
ApplicationContextAware, BeanNameAware, ApplicationListener<ContextRefreshedEvent>,
ApplicationEventPublisherAware {
ApplicationContextAware, BeanNameAware, ApplicationEventPublisherAware {


private static final long serialVersionUID = 213195494150089726L;
Expand Down Expand Up @@ -149,23 +144,4 @@ protected Class getServiceClass(T ref) {
public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
this.applicationEventPublisher = applicationEventPublisher;
}

@Override
public void onApplicationEvent(ContextRefreshedEvent event) {

if (!isOriginEventSource(event)) {
return;
}

if (!isExported() && !isUnexported()) {
if (logger.isInfoEnabled()) {
logger.info("The service ready on spring started. service: " + getInterface());
}
export();
}
}

private boolean isOriginEventSource(ContextRefreshedEvent event) {
return Objects.equals(applicationContext, event.getApplicationContext());
}
}

0 comments on commit b9c7a8b

Please sign in to comment.