diff --git a/spring-cloud-alibaba-nacos-discovery/src/main/java/com/alibaba/cloud/nacos/registry/NacosServiceRegistry.java b/spring-cloud-alibaba-nacos-discovery/src/main/java/com/alibaba/cloud/nacos/registry/NacosServiceRegistry.java index af81f0ac..b0974a55 100644 --- a/spring-cloud-alibaba-nacos-discovery/src/main/java/com/alibaba/cloud/nacos/registry/NacosServiceRegistry.java +++ b/spring-cloud-alibaba-nacos-discovery/src/main/java/com/alibaba/cloud/nacos/registry/NacosServiceRegistry.java @@ -28,6 +28,8 @@ import org.springframework.cloud.client.serviceregistry.Registration; import org.springframework.cloud.client.serviceregistry.ServiceRegistry; import org.springframework.util.StringUtils; +import static org.springframework.util.ReflectionUtils.rethrowRuntimeException; + /** * @author xiaojing * @author Mercy @@ -66,6 +68,9 @@ public class NacosServiceRegistry implements ServiceRegistry { catch (Exception e) { log.error("nacos registry, {} register failed...{},", serviceId, registration.toString(), e); + // rethrow a RuntimeException if the registration is failed. + // issue : https://github.com/alibaba/spring-cloud-alibaba/issues/1132 + rethrowRuntimeException(e); } }