1
0
mirror of https://gitee.com/mirrors/Spring-Cloud-Alibaba.git synced 2021-06-26 13:25:11 +08:00

Polish spring-cloud-incubator/spring-cloud-alibaba#553 : Dubbo Spring Cloud service invocations failed without REST protocol

This commit is contained in:
mercyblitz
2019-04-15 15:22:31 +08:00
parent 0c73d6e6af
commit 2b5f7dc724
5 changed files with 158 additions and 1 deletions

View File

@@ -30,6 +30,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnNotWebApplication;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.event.ApplicationStartedEvent;
import org.springframework.cloud.alibaba.dubbo.registry.event.ServiceInstancePreRegisteredEvent;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.serviceregistry.Registration;
@@ -77,6 +78,10 @@ public class DubboServiceRegistrationNonWebApplicationAutoConfiguration {
@EventListener(ServiceBeanExportedEvent.class)
public void onServiceBeanExported(ServiceBeanExportedEvent event) {
setWebPort(event.getServiceBean());
}
@EventListener(ApplicationStartedEvent.class)
public void onApplicationStarted() {
register();
}