*
- * ${{@link #rootPath}}/{serviceName}/{serviceInstanceId}
+ * ${{@link #rootPath}}/{serviceName}/{serviceInstanceId}.
*
* @see #rootPath
* @see #SERVICE_NAME_PATH_VARIABLE_NAME
@@ -330,7 +340,7 @@ public class DubboServiceDiscoveryAutoConfiguration {
private final String serviceInstancePathPattern;
/**
- * The {@link ThreadLocal} holds the processed service name
+ * The {@link ThreadLocal} holds the processed service name.
*/
private final ThreadLocal
* For example URL patterns, HTTP request methods, param expressions, etc.
- *
* @return a collection of objects, never {@code null}
*/
protected abstract Collection> getContent();
@@ -72,4 +72,5 @@ public abstract class AbstractHttpRequestMatcher implements HttpRequestMatcher {
builder.append("]");
return builder.toString();
}
+
}
diff --git a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/matcher/AbstractMediaTypeExpression.java b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/matcher/AbstractMediaTypeExpression.java
index 67b759570..b7a7ccf75 100644
--- a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/matcher/AbstractMediaTypeExpression.java
+++ b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/matcher/AbstractMediaTypeExpression.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,13 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.alibaba.cloud.dubbo.http.matcher;
import org.springframework.http.MediaType;
/**
* The some source code is scratched from
- * org.springframework.web.servlet.mvc.condition.AbstractMediaTypeExpression
+ * org.springframework.web.servlet.mvc.condition.AbstractMediaTypeExpression.
*
* @author Arjen Poutsma
* @author Rossen Stoyanchev
@@ -91,4 +92,5 @@ public class AbstractMediaTypeExpression
builder.append(this.mediaType.toString());
return builder.toString();
}
+
}
diff --git a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/matcher/AbstractNameValueExpression.java b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/matcher/AbstractNameValueExpression.java
index c5a6fc01e..611cd22dd 100644
--- a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/matcher/AbstractNameValueExpression.java
+++ b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/matcher/AbstractNameValueExpression.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,17 +13,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.alibaba.cloud.dubbo.http.matcher;
-import static org.springframework.util.StringUtils.trimWhitespace;
+package com.alibaba.cloud.dubbo.http.matcher;
import org.springframework.http.HttpRequest;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
+import static org.springframework.util.StringUtils.trimWhitespace;
+
/**
* The some source code is scratched from
- * org.springframework.web.servlet.mvc.condition.AbstractNameValueExpression
+ * org.springframework.web.servlet.mvc.condition.AbstractNameValueExpression.
*
* @author Rossen Stoyanchev
* @author Arjen Poutsma
@@ -63,9 +64,8 @@ abstract class AbstractNameValueExpression
* The source code is scratched from
- * org.springframework.web.servlet.mvc.condition.ConsumesRequestCondition.ConsumeMediaTypeExpression
+ * org.springframework.web.servlet.mvc.condition.ConsumesRequestCondition.ConsumeMediaTypeExpression.
*
* @author Rossen Stoyanchev
* @author Arjen Poutsma
@@ -40,4 +41,5 @@ class ConsumeMediaTypeExpression extends AbstractMediaTypeExpression {
boolean match = getMediaType().includes(contentType);
return (!isNegated() ? match : !match);
}
+
}
diff --git a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/matcher/HeaderExpression.java b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/matcher/HeaderExpression.java
index ce00f66e7..277a2591f 100644
--- a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/matcher/HeaderExpression.java
+++ b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/matcher/HeaderExpression.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.alibaba.cloud.dubbo.http.matcher;
import org.springframework.http.HttpHeaders;
@@ -23,7 +24,7 @@ import org.springframework.util.ObjectUtils;
* Parses and matches a single header expression to a request.
*
* The some source code is scratched from
- * org.springframework.web.servlet.mvc.condition.HeadersRequestCondition.HeaderExpression
+ * org.springframework.web.servlet.mvc.condition.HeadersRequestCondition.HeaderExpression.
*
* @author Arjen Poutsma
* @author Rossen Stoyanchev
@@ -57,4 +58,5 @@ class HeaderExpression extends AbstractNameValueExpression
* The some source code is scratched from
- * org.springframework.web.servlet.mvc.condition.NameValueExpression
+ * org.springframework.web.servlet.mvc.condition.NameValueExpression.
*
* @param
* The some source code is scratched from
- * org.springframework.web.servlet.mvc.condition.ParamsRequestCondition.ParamExpression
+ * org.springframework.web.servlet.mvc.condition.ParamsRequestCondition.ParamExpression.
*
* @author Arjen Poutsma
* @author Rossen Stoyanchev
@@ -59,4 +60,5 @@ class ParamExpression extends AbstractNameValueExpression
* The source code is scratched from
- * org.springframework.web.servlet.mvc.condition.ProducesRequestCondition.ProduceMediaTypeExpression
+ * org.springframework.web.servlet.mvc.condition.ProducesRequestCondition.ProduceMediaTypeExpression.
*
* @author Rossen Stoyanchev
* @author Arjen Poutsma
@@ -51,4 +52,5 @@ class ProduceMediaTypeExpression extends AbstractMediaTypeExpression {
}
return false;
}
+
}
diff --git a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/matcher/RequestMetadataMatcher.java b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/matcher/RequestMetadataMatcher.java
index 571173bbf..644e74b79 100644
--- a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/matcher/RequestMetadataMatcher.java
+++ b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/matcher/RequestMetadataMatcher.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,14 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.alibaba.cloud.dubbo.http.matcher;
-import static com.alibaba.cloud.dubbo.http.util.HttpUtils.toNameAndValues;
+package com.alibaba.cloud.dubbo.http.matcher;
import com.alibaba.cloud.dubbo.metadata.RequestMetadata;
+import static com.alibaba.cloud.dubbo.http.util.HttpUtils.toNameAndValues;
+
/**
- * {@link RequestMetadata} {@link HttpRequestMatcher} implementation
+ * {@link RequestMetadata} {@link HttpRequestMatcher} implementation.
*
* @author Mercy
*/
@@ -43,4 +44,5 @@ public class RequestMetadataMatcher extends CompositeHttpRequestMatcher {
new HttpRequestProducesMatcher(
metadata.getProduces().toArray(new String[0])));
}
+
}
diff --git a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/util/HttpMessageConverterResolver.java b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/util/HttpMessageConverterResolver.java
index 0d75a7c92..5798ffc2b 100644
--- a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/util/HttpMessageConverterResolver.java
+++ b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/util/HttpMessageConverterResolver.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,9 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.alibaba.cloud.dubbo.http.util;
-import static java.util.Collections.unmodifiableList;
+package com.alibaba.cloud.dubbo.http.util;
import java.util.ArrayList;
import java.util.Collections;
@@ -23,23 +22,22 @@ import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
-import org.springframework.core.MethodParameter;
+import com.alibaba.cloud.dubbo.http.converter.HttpMessageConverterHolder;
+import com.alibaba.cloud.dubbo.metadata.RequestMetadata;
+import com.alibaba.cloud.dubbo.metadata.RestMethodMetadata;
+
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpRequest;
import org.springframework.http.MediaType;
import org.springframework.http.converter.GenericHttpMessageConverter;
import org.springframework.http.converter.HttpMessageConverter;
-import org.springframework.http.server.ServletServerHttpRequest;
-import org.springframework.http.server.ServletServerHttpResponse;
import org.springframework.util.ClassUtils;
import org.springframework.util.CollectionUtils;
-import com.alibaba.cloud.dubbo.http.converter.HttpMessageConverterHolder;
-import com.alibaba.cloud.dubbo.metadata.RequestMetadata;
-import com.alibaba.cloud.dubbo.metadata.RestMethodMetadata;
+import static java.util.Collections.unmodifiableList;
/**
- * {@link HttpMessageConverter} Resolver
+ * {@link HttpMessageConverter} Resolver.
*
* @author Mercy
*/
@@ -96,11 +94,10 @@ public class HttpMessageConverterResolver {
}
/**
- * Resolve the most match {@link HttpMessageConverter} from {@link RequestMetadata}
- *
+ * Resolve the most match {@link HttpMessageConverter} from {@link RequestMetadata}.
* @param requestMetadata {@link RequestMetadata}
* @param restMethodMetadata {@link RestMethodMetadata}
- * @return
+ * @return instance of {@link HttpMessageConverterHolder}
*/
public HttpMessageConverterHolder resolve(RequestMetadata requestMetadata,
RestMethodMetadata restMethodMetadata) {
@@ -110,7 +107,7 @@ public class HttpMessageConverterResolver {
Class> returnValueClass = resolveReturnValueClass(restMethodMetadata);
/**
- * @see AbstractMessageConverterMethodProcessor#writeWithMessageConverters(Object,
+ * @see AbstractMessageConverterMethodProcessor#writeWithMessageConverters(T,
* MethodParameter, ServletServerHttpRequest, ServletServerHttpResponse)
*/
List
- *
* @param queryString The query string
* @return The query parameters
*/
@@ -103,7 +116,6 @@ public abstract class HttpUtils {
/**
* Get Parameters from the specified pairs of name-value.
*
- *
* @param pairs The pairs of name-value
* @return The query parameters
*/
@@ -124,7 +136,6 @@ public abstract class HttpUtils {
/**
* Get Parameters from the specified pairs of name-value.
*
- *
* @param pairs The pairs of name-value
* @return The query parameters
*/
@@ -163,8 +174,7 @@ public abstract class HttpUtils {
// }
/**
- * To the name and value line sets
- *
+ * To the name and value line sets.
* @param nameAndValuesMap {@link MultiValueMap} the map of name and values
* @return non-null
*/
@@ -187,8 +197,8 @@ public abstract class HttpUtils {
}
/**
- * Generate a string of query string from the specified request parameters {@link Map}
- *
+ * Generate a string of query string from the specified request parameters
+ * {@link Map}.
* @param params the specified request parameters {@link Map}
* @return non-null
*/
@@ -201,8 +211,7 @@ public abstract class HttpUtils {
}
/**
- * Decode value
- *
+ * Decode value.
* @param value the value requires to decode
* @return the decoded value
*/
@@ -220,8 +229,7 @@ public abstract class HttpUtils {
}
/**
- * encode value
- *
+ * encode value.
* @param value the value requires to encode
* @return the encoded value
*/
@@ -243,4 +251,5 @@ public abstract class HttpUtils {
}
paramsMap.add(trimAllWhitespace(name), paramValue);
}
+
}
diff --git a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/metadata/DubboProtocolConfigSupplier.java b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/metadata/DubboProtocolConfigSupplier.java
index 5904dc0fc..1dfb8e732 100644
--- a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/metadata/DubboProtocolConfigSupplier.java
+++ b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/metadata/DubboProtocolConfigSupplier.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,20 +13,22 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.alibaba.cloud.dubbo.metadata;
-import static org.apache.dubbo.common.constants.CommonConstants.DEFAULT_PROTOCOL;
-import static org.springframework.util.CollectionUtils.isEmpty;
+package com.alibaba.cloud.dubbo.metadata;
import java.util.Collection;
import java.util.Iterator;
import java.util.function.Supplier;
import org.apache.dubbo.config.ProtocolConfig;
+
import org.springframework.beans.factory.ObjectProvider;
+import static org.apache.dubbo.common.constants.CommonConstants.DEFAULT_PROTOCOL;
+import static org.springframework.util.CollectionUtils.isEmpty;
+
/**
- * Dubbo's {@link ProtocolConfig} {@link Supplier}
+ * Dubbo's {@link ProtocolConfig} {@link Supplier}.
*
* @author Mercy
*/
@@ -68,4 +70,5 @@ public class DubboProtocolConfigSupplier implements Supplier
* extract some code from
- * {@link Contract.BaseContract#parseAndValidatateMetadata(java.lang.Class)}
- *
- * @param targetType
+ * {@link Contract.BaseContract#parseAndValidatateMetadata(java.lang.Class)}.
+ * @param targetType class of type
* @return non-null
*/
private List
*
* @author Mercy
@@ -38,7 +39,6 @@ public class SubscribedServicesChangedEvent extends ApplicationEvent {
/**
* Create a new ApplicationEvent.
- *
* @param source the object on which the event initially occurred (never {@code null})
* @param oldSubscribedServices the subscribed services before changed
* @param newSubscribedServices the subscribed services after changed
@@ -62,4 +62,5 @@ public class SubscribedServicesChangedEvent extends ApplicationEvent {
public boolean isChanged() {
return changed;
}
+
}
diff --git a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/service/DubboGenericServiceExecutionContext.java b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/service/DubboGenericServiceExecutionContext.java
index 8be35973f..5e9d4877e 100644
--- a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/service/DubboGenericServiceExecutionContext.java
+++ b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/service/DubboGenericServiceExecutionContext.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,12 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.alibaba.cloud.dubbo.service;
import org.apache.dubbo.rpc.service.GenericService;
/**
- * Dubbo {@link GenericService} execution context
+ * Dubbo {@link GenericService} execution context.
*
* @author Mercy
*/
@@ -48,4 +49,5 @@ public class DubboGenericServiceExecutionContext {
public Object[] getParameters() {
return parameters;
}
+
}
diff --git a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/service/DubboGenericServiceExecutionContextFactory.java b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/service/DubboGenericServiceExecutionContextFactory.java
index 4d39fab7e..29017ce40 100644
--- a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/service/DubboGenericServiceExecutionContextFactory.java
+++ b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/service/DubboGenericServiceExecutionContextFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.alibaba.cloud.dubbo.service;
import java.util.Collections;
@@ -22,17 +23,17 @@ import java.util.Map;
import javax.annotation.PostConstruct;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.annotation.AnnotationAwareOrderComparator;
-
import com.alibaba.cloud.dubbo.http.HttpServerRequest;
import com.alibaba.cloud.dubbo.metadata.MethodMetadata;
import com.alibaba.cloud.dubbo.metadata.MethodParameterMetadata;
import com.alibaba.cloud.dubbo.metadata.RestMethodMetadata;
import com.alibaba.cloud.dubbo.service.parameter.DubboGenericServiceParameterResolver;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.annotation.AnnotationAwareOrderComparator;
+
/**
- * {@link DubboGenericServiceExecutionContext} Factory
+ * {@link DubboGenericServiceExecutionContext} Factory.
*
* @author Mercy
* @see DubboGenericServiceParameterResolver
@@ -154,4 +155,5 @@ public class DubboGenericServiceExecutionContextFactory {
return parameters;
}
+
}
diff --git a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/service/DubboGenericServiceFactory.java b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/service/DubboGenericServiceFactory.java
index 313abbef2..5fcf8100b 100644
--- a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/service/DubboGenericServiceFactory.java
+++ b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/service/DubboGenericServiceFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,12 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.alibaba.cloud.dubbo.service;
-import static java.util.Collections.emptyMap;
-import static org.apache.dubbo.common.constants.CommonConstants.GROUP_KEY;
-import static org.apache.dubbo.common.constants.CommonConstants.VERSION_KEY;
-import static org.springframework.util.StringUtils.commaDelimitedListToStringArray;
+package com.alibaba.cloud.dubbo.service;
import java.beans.PropertyEditorSupport;
import java.util.Collection;
@@ -30,6 +26,8 @@ import java.util.concurrent.ConcurrentMap;
import javax.annotation.PreDestroy;
+import com.alibaba.cloud.dubbo.metadata.DubboRestServiceMetadata;
+import com.alibaba.cloud.dubbo.metadata.ServiceRestMetadata;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.common.utils.CollectionUtils;
import org.apache.dubbo.config.RegistryConfig;
@@ -37,6 +35,7 @@ import org.apache.dubbo.config.spring.ReferenceBean;
import org.apache.dubbo.rpc.service.GenericService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
import org.springframework.beans.MutablePropertyValues;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.beans.factory.annotation.Autowired;
@@ -44,11 +43,13 @@ import org.springframework.beans.propertyeditors.StringTrimmerEditor;
import org.springframework.util.StringUtils;
import org.springframework.validation.DataBinder;
-import com.alibaba.cloud.dubbo.metadata.DubboRestServiceMetadata;
-import com.alibaba.cloud.dubbo.metadata.ServiceRestMetadata;
+import static java.util.Collections.emptyMap;
+import static org.apache.dubbo.common.constants.CommonConstants.GROUP_KEY;
+import static org.apache.dubbo.common.constants.CommonConstants.VERSION_KEY;
+import static org.springframework.util.StringUtils.commaDelimitedListToStringArray;
/**
- * Dubbo {@link GenericService} Factory
+ * Dubbo {@link GenericService} Factory.
*
* @author Mercy
*/
diff --git a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/service/DubboMetadataService.java b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/service/DubboMetadataService.java
index 56b884c8d..a6cb949ee 100644
--- a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/service/DubboMetadataService.java
+++ b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/service/DubboMetadataService.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,65 +13,62 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.alibaba.cloud.dubbo.service;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import com.alibaba.cloud.dubbo.metadata.ServiceRestMetadata;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.config.annotation.Service;
-import com.alibaba.cloud.dubbo.metadata.ServiceRestMetadata;
-
/**
* Dubbo Metadata Service is a core interface for service subscribers, it must keep the
* stable of structure in every evolution , makes sure all subscribers' compatibility.
*
* The interface contract's version must be {@link #VERSION} constant and group must be
- * current Dubbo application name
+ * current Dubbo application name.
*
* @author Mercy
*/
public interface DubboMetadataService {
/**
- * Current version of the interface contract
+ * Current version of the interface contract.
*/
String VERSION = "1.0.0";
/**
- * Get the json content of {@link ServiceRestMetadata} {@link Set}
- *
+ * Get the json content of {@link ServiceRestMetadata} {@link Set}.
* @return
* example feign client
*/
-@FeignClient(name = "service-provider", fallbackFactory = EchoServiceFallbackFactory.class)
+@FeignClient(name = "service-provider",
+ fallbackFactory = EchoServiceFallbackFactory.class)
public interface EchoService {
- /**
- * 调用服务提供方的输出接口
- *
- * @param str 用户输入
- * @return
- */
- @GetMapping(value = "/echo/{str}")
- String echo(@PathVariable("str") String str);
+ /**
+ * 调用服务提供方的输出接口
+ * @param str 用户输入
+ * @return
+ */
+ @GetMapping("/echo/{str}")
+ String echo(@PathVariable("str") String str);
+
}
diff --git a/spring-cloud-alibaba-examples/sentinel-example/sentinel-feign-example/sentinel-feign-provider-example/src/main/java/com/alibaba/cloud/examples/ProviderApplication.java b/spring-cloud-alibaba-examples/sentinel-example/sentinel-feign-example/sentinel-feign-provider-example/src/main/java/com/alibaba/cloud/examples/ProviderApplication.java
index cdc17dd81..e3ac3f96b 100644
--- a/spring-cloud-alibaba-examples/sentinel-example/sentinel-feign-example/sentinel-feign-provider-example/src/main/java/com/alibaba/cloud/examples/ProviderApplication.java
+++ b/spring-cloud-alibaba-examples/sentinel-example/sentinel-feign-example/sentinel-feign-provider-example/src/main/java/com/alibaba/cloud/examples/ProviderApplication.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2013-2018 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package com.alibaba.cloud.examples;
import org.springframework.boot.SpringApplication;
@@ -11,7 +27,8 @@ import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
@SpringBootApplication
public class ProviderApplication {
- public static void main(String[] args) {
- SpringApplication.run(ProviderApplication.class, args);
- }
+ public static void main(String[] args) {
+ SpringApplication.run(ProviderApplication.class, args);
+ }
+
}
diff --git a/spring-cloud-alibaba-examples/sentinel-example/sentinel-feign-example/sentinel-feign-provider-example/src/main/java/com/alibaba/cloud/examples/controller/EchoController.java b/spring-cloud-alibaba-examples/sentinel-example/sentinel-feign-example/sentinel-feign-provider-example/src/main/java/com/alibaba/cloud/examples/controller/EchoController.java
index 6d99f33dc..c74f7b48b 100644
--- a/spring-cloud-alibaba-examples/sentinel-example/sentinel-feign-example/sentinel-feign-provider-example/src/main/java/com/alibaba/cloud/examples/controller/EchoController.java
+++ b/spring-cloud-alibaba-examples/sentinel-example/sentinel-feign-example/sentinel-feign-provider-example/src/main/java/com/alibaba/cloud/examples/controller/EchoController.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2013-2018 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package com.alibaba.cloud.examples.controller;
import org.springframework.web.bind.annotation.GetMapping;
@@ -11,9 +27,9 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
public class EchoController {
- @GetMapping("/echo/{str}")
- public String echo(@PathVariable String str) {
- return "provider-" + str;
- }
+ @GetMapping("/echo/{str}")
+ public String echo(@PathVariable String str) {
+ return "provider-" + str;
+ }
}
diff --git a/spring-cloud-alibaba-examples/sentinel-example/sentinel-spring-cloud-gateway-example/src/main/java/com/alibaba/cloud/examples/MySCGConfiguration.java b/spring-cloud-alibaba-examples/sentinel-example/sentinel-spring-cloud-gateway-example/src/main/java/com/alibaba/cloud/examples/MySCGConfiguration.java
index 6ccf9130b..96a67ae79 100644
--- a/spring-cloud-alibaba-examples/sentinel-example/sentinel-spring-cloud-gateway-example/src/main/java/com/alibaba/cloud/examples/MySCGConfiguration.java
+++ b/spring-cloud-alibaba-examples/sentinel-example/sentinel-spring-cloud-gateway-example/src/main/java/com/alibaba/cloud/examples/MySCGConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,7 +16,8 @@
package com.alibaba.cloud.examples;
-import static org.springframework.web.reactive.function.BodyInserters.fromObject;
+import com.alibaba.csp.sentinel.adapter.gateway.sc.callback.BlockRequestHandler;
+import reactor.core.publisher.Mono;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -24,9 +25,7 @@ import org.springframework.http.MediaType;
import org.springframework.web.reactive.function.server.ServerResponse;
import org.springframework.web.server.ServerWebExchange;
-import com.alibaba.csp.sentinel.adapter.gateway.sc.callback.BlockRequestHandler;
-
-import reactor.core.publisher.Mono;
+import static org.springframework.web.reactive.function.BodyInserters.fromObject;
/**
* @author Jim
diff --git a/spring-cloud-alibaba-examples/sentinel-example/sentinel-spring-cloud-gateway-example/src/main/java/com/alibaba/cloud/examples/RulesWebFluxController.java b/spring-cloud-alibaba-examples/sentinel-example/sentinel-spring-cloud-gateway-example/src/main/java/com/alibaba/cloud/examples/RulesWebFluxController.java
index 8e2f4efc6..cdf1c8877 100644
--- a/spring-cloud-alibaba-examples/sentinel-example/sentinel-spring-cloud-gateway-example/src/main/java/com/alibaba/cloud/examples/RulesWebFluxController.java
+++ b/spring-cloud-alibaba-examples/sentinel-example/sentinel-spring-cloud-gateway-example/src/main/java/com/alibaba/cloud/examples/RulesWebFluxController.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,18 +19,17 @@ package com.alibaba.cloud.examples;
import java.util.List;
import java.util.Set;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RestController;
-
import com.alibaba.csp.sentinel.adapter.gateway.common.api.ApiDefinition;
import com.alibaba.csp.sentinel.adapter.gateway.common.api.GatewayApiDefinitionManager;
import com.alibaba.csp.sentinel.adapter.gateway.common.rule.GatewayFlowRule;
import com.alibaba.csp.sentinel.adapter.gateway.common.rule.GatewayRuleManager;
import com.alibaba.csp.sentinel.slots.block.flow.FlowRule;
import com.alibaba.csp.sentinel.slots.block.flow.FlowRuleManager;
-
import reactor.core.publisher.Mono;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
+
/**
* @author Jim
*/
diff --git a/spring-cloud-alibaba-examples/sentinel-example/sentinel-spring-cloud-gateway-example/src/main/java/com/alibaba/cloud/examples/SentinelSpringCloudGatewayApplication.java b/spring-cloud-alibaba-examples/sentinel-example/sentinel-spring-cloud-gateway-example/src/main/java/com/alibaba/cloud/examples/SentinelSpringCloudGatewayApplication.java
index 137c6e911..7e13e3f4b 100644
--- a/spring-cloud-alibaba-examples/sentinel-example/sentinel-spring-cloud-gateway-example/src/main/java/com/alibaba/cloud/examples/SentinelSpringCloudGatewayApplication.java
+++ b/spring-cloud-alibaba-examples/sentinel-example/sentinel-spring-cloud-gateway-example/src/main/java/com/alibaba/cloud/examples/SentinelSpringCloudGatewayApplication.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-cloud-alibaba-examples/sentinel-example/sentinel-webflux-example/src/main/java/com/alibaba/cloud/examples/MyConfiguration.java b/spring-cloud-alibaba-examples/sentinel-example/sentinel-webflux-example/src/main/java/com/alibaba/cloud/examples/MyConfiguration.java
index 4c0225ce5..6a8d271c7 100644
--- a/spring-cloud-alibaba-examples/sentinel-example/sentinel-webflux-example/src/main/java/com/alibaba/cloud/examples/MyConfiguration.java
+++ b/spring-cloud-alibaba-examples/sentinel-example/sentinel-webflux-example/src/main/java/com/alibaba/cloud/examples/MyConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,7 +16,8 @@
package com.alibaba.cloud.examples;
-import static org.springframework.web.reactive.function.BodyInserters.fromObject;
+import com.alibaba.csp.sentinel.adapter.spring.webflux.callback.BlockRequestHandler;
+import reactor.core.publisher.Mono;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -25,9 +26,7 @@ import org.springframework.http.MediaType;
import org.springframework.web.reactive.function.server.ServerResponse;
import org.springframework.web.server.ServerWebExchange;
-import com.alibaba.csp.sentinel.adapter.spring.webflux.callback.BlockRequestHandler;
-
-import reactor.core.publisher.Mono;
+import static org.springframework.web.reactive.function.BodyInserters.fromObject;
/**
* @author Jim
diff --git a/spring-cloud-alibaba-examples/sentinel-example/sentinel-webflux-example/src/main/java/com/alibaba/cloud/examples/SentinelWebFluxApplication.java b/spring-cloud-alibaba-examples/sentinel-example/sentinel-webflux-example/src/main/java/com/alibaba/cloud/examples/SentinelWebFluxApplication.java
index 353b8ba09..b933d56a4 100644
--- a/spring-cloud-alibaba-examples/sentinel-example/sentinel-webflux-example/src/main/java/com/alibaba/cloud/examples/SentinelWebFluxApplication.java
+++ b/spring-cloud-alibaba-examples/sentinel-example/sentinel-webflux-example/src/main/java/com/alibaba/cloud/examples/SentinelWebFluxApplication.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-cloud-alibaba-examples/sentinel-example/sentinel-webflux-example/src/main/java/com/alibaba/cloud/examples/SentinelWebFluxController.java b/spring-cloud-alibaba-examples/sentinel-example/sentinel-webflux-example/src/main/java/com/alibaba/cloud/examples/SentinelWebFluxController.java
index 2ad86f690..5bf963327 100644
--- a/spring-cloud-alibaba-examples/sentinel-example/sentinel-webflux-example/src/main/java/com/alibaba/cloud/examples/SentinelWebFluxController.java
+++ b/spring-cloud-alibaba-examples/sentinel-example/sentinel-webflux-example/src/main/java/com/alibaba/cloud/examples/SentinelWebFluxController.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,14 +16,13 @@
package com.alibaba.cloud.examples;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RestController;
-
import com.alibaba.csp.sentinel.adapter.reactor.SentinelReactorTransformer;
-
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
+
/**
* @author Jim
*/
@@ -37,12 +36,12 @@ public class SentinelWebFluxController {
.transform(new SentinelReactorTransformer<>("mono"));
}
- @GetMapping("/test")
- public Monofalse
forever
*/
@Bean
@@ -359,8 +368,7 @@ public class DubboServiceDiscoveryAutoConfiguration {
/**
* Handle on {@link InstanceRegisteredEvent} after
- * {@link ZookeeperServiceWatch#onApplicationEvent(InstanceRegisteredEvent)}
- *
+ * {@link ZookeeperServiceWatch#onApplicationEvent(InstanceRegisteredEvent)}.
* @param event {@link InstanceRegisteredEvent}
* @see #reattachTreeCacheListeners()
*/
@@ -370,7 +378,7 @@ public class DubboServiceDiscoveryAutoConfiguration {
}
/**
- * Re-attach the {@link TreeCacheListener TreeCacheListeners}
+ * Re-attach the {@link TreeCacheListener TreeCacheListeners}.
*/
private void reattachTreeCacheListeners() {
@@ -381,7 +389,7 @@ public class DubboServiceDiscoveryAutoConfiguration {
/**
* All registered TreeCacheListeners except {@link ZookeeperServiceWatch}.
* Usually, "otherListeners" will be empty because Spring Cloud Zookeeper only
- * adds "zookeeperServiceWatch" bean as {@link TreeCacheListener}
+ * adds "zookeeperServiceWatch" bean as {@link TreeCacheListener}.
*/
Listfalse
forever
*/
@Bean
@@ -547,5 +552,7 @@ public class DubboServiceDiscoveryAutoConfiguration {
}
}
}
+
}
+
}
diff --git a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/autoconfigure/DubboServiceRegistrationAutoConfiguration.java b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/autoconfigure/DubboServiceRegistrationAutoConfiguration.java
index 2a5c7afd5..855b43819 100644
--- a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/autoconfigure/DubboServiceRegistrationAutoConfiguration.java
+++ b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/autoconfigure/DubboServiceRegistrationAutoConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,23 +13,25 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.alibaba.cloud.dubbo.autoconfigure;
-import static com.alibaba.cloud.dubbo.autoconfigure.DubboServiceRegistrationAutoConfiguration.CONSUL_AUTO_SERVICE_AUTO_CONFIGURATION_CLASS_NAME;
-import static com.alibaba.cloud.dubbo.autoconfigure.DubboServiceRegistrationAutoConfiguration.EUREKA_CLIENT_AUTO_CONFIGURATION_CLASS_NAME;
-import static com.alibaba.cloud.dubbo.registry.SpringCloudRegistryFactory.ADDRESS;
-import static com.alibaba.cloud.dubbo.registry.SpringCloudRegistryFactory.PROTOCOL;
-import static org.springframework.util.ObjectUtils.isEmpty;
+package com.alibaba.cloud.dubbo.autoconfigure;
import java.util.Collection;
import java.util.List;
import java.util.Map;
+import com.alibaba.cloud.dubbo.autoconfigure.condition.MissingSpringCloudRegistryConfigPropertyCondition;
+import com.alibaba.cloud.dubbo.metadata.repository.DubboServiceMetadataRepository;
+import com.alibaba.cloud.dubbo.registry.DubboServiceRegistrationEventPublishingAspect;
+import com.alibaba.cloud.dubbo.registry.event.ServiceInstancePreRegisteredEvent;
+import com.ecwid.consul.v1.agent.model.NewService;
+import com.netflix.appinfo.InstanceInfo;
import org.apache.dubbo.config.RegistryConfig;
import org.apache.dubbo.config.spring.ServiceBean;
import org.aspectj.lang.annotation.Aspect;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
import org.springframework.aop.support.AopUtils;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.beans.factory.SmartInitializingSingleton;
@@ -51,34 +53,45 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.event.EventListener;
-import com.alibaba.cloud.dubbo.autoconfigure.condition.MissingSpringCloudRegistryConfigPropertyCondition;
-import com.alibaba.cloud.dubbo.metadata.repository.DubboServiceMetadataRepository;
-import com.alibaba.cloud.dubbo.registry.DubboServiceRegistrationEventPublishingAspect;
-import com.alibaba.cloud.dubbo.registry.event.ServiceInstancePreRegisteredEvent;
-
-import com.ecwid.consul.v1.agent.model.NewService;
-import com.netflix.appinfo.InstanceInfo;
+import static com.alibaba.cloud.dubbo.autoconfigure.DubboServiceRegistrationAutoConfiguration.CONSUL_AUTO_SERVICE_AUTO_CONFIGURATION_CLASS_NAME;
+import static com.alibaba.cloud.dubbo.autoconfigure.DubboServiceRegistrationAutoConfiguration.EUREKA_CLIENT_AUTO_CONFIGURATION_CLASS_NAME;
+import static com.alibaba.cloud.dubbo.registry.SpringCloudRegistryFactory.ADDRESS;
+import static com.alibaba.cloud.dubbo.registry.SpringCloudRegistryFactory.PROTOCOL;
+import static org.springframework.util.ObjectUtils.isEmpty;
/**
- * Dubbo Service Registration Auto-{@link Configuration}
+ * Dubbo Service Registration Auto-{@link Configuration}.
*
* @author Mercy
*/
@Configuration
@Import({ DubboServiceRegistrationEventPublishingAspect.class })
-@ConditionalOnProperty(value = "spring.cloud.service-registry.auto-registration.enabled", matchIfMissing = true)
+@ConditionalOnProperty(value = "spring.cloud.service-registry.auto-registration.enabled",
+ matchIfMissing = true)
@AutoConfigureAfter(name = { EUREKA_CLIENT_AUTO_CONFIGURATION_CLASS_NAME,
CONSUL_AUTO_SERVICE_AUTO_CONFIGURATION_CLASS_NAME,
- "org.springframework.cloud.client.serviceregistry.AutoServiceRegistrationAutoConfiguration" }, value = {
- DubboMetadataAutoConfiguration.class })
+ "org.springframework.cloud.client.serviceregistry.AutoServiceRegistrationAutoConfiguration" },
+ value = { DubboMetadataAutoConfiguration.class })
public class DubboServiceRegistrationAutoConfiguration {
+ /**
+ * EurekaClientAutoConfiguration.
+ */
public static final String EUREKA_CLIENT_AUTO_CONFIGURATION_CLASS_NAME = "org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration";
+ /**
+ * ConsulAutoServiceRegistrationAutoConfiguration.
+ */
public static final String CONSUL_AUTO_SERVICE_AUTO_CONFIGURATION_CLASS_NAME = "org.springframework.cloud.consul.serviceregistry.ConsulAutoServiceRegistrationAutoConfiguration";
+ /**
+ * ConsulAutoRegistration.
+ */
public static final String CONSUL_AUTO_SERVICE_AUTO_REGISTRATION_CLASS_NAME = "org.springframework.cloud.consul.serviceregistry.ConsulAutoRegistration";
+ /**
+ * ZookeeperAutoServiceRegistrationAutoConfiguration.
+ */
public static final String ZOOKEEPER_AUTO_SERVICE_AUTO_CONFIGURATION_CLASS_NAME = "org.springframework.cloud.zookeeper.serviceregistry.ZookeeperAutoServiceRegistrationAutoConfiguration";
private static final Logger logger = LoggerFactory
@@ -88,7 +101,7 @@ public class DubboServiceRegistrationAutoConfiguration {
private DubboServiceMetadataRepository dubboServiceMetadataRepository;
@Bean
- @Conditional(value = { MissingSpringCloudRegistryConfigPropertyCondition.class })
+ @Conditional({ MissingSpringCloudRegistryConfigPropertyCondition.class })
public RegistryConfig defaultSpringCloudRegistryConfig() {
return new RegistryConfig(ADDRESS, PROTOCOL);
}
@@ -150,6 +163,7 @@ public class DubboServiceRegistrationAutoConfiguration {
serviceBeans.forEach(ServiceBean::export);
}
}
+
}
@Configuration
@@ -158,8 +172,7 @@ public class DubboServiceRegistrationAutoConfiguration {
class ConsulConfiguration {
/**
- * Handle the pre-registered event of {@link ServiceInstance} for Consul
- *
+ * Handle the pre-registered event of {@link ServiceInstance} for Consul.
* @param event {@link ServiceInstancePreRegisteredEvent}
*/
@EventListener(ServiceInstancePreRegisteredEvent.class)
@@ -186,5 +199,7 @@ public class DubboServiceRegistrationAutoConfiguration {
}
}
}
+
}
-}
\ No newline at end of file
+
+}
diff --git a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/autoconfigure/DubboServiceRegistrationNonWebApplicationAutoConfiguration.java b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/autoconfigure/DubboServiceRegistrationNonWebApplicationAutoConfiguration.java
index 3eea3bc43..9c411506d 100644
--- a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/autoconfigure/DubboServiceRegistrationNonWebApplicationAutoConfiguration.java
+++ b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/autoconfigure/DubboServiceRegistrationNonWebApplicationAutoConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,18 +13,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.alibaba.cloud.dubbo.autoconfigure;
-import static com.alibaba.cloud.dubbo.autoconfigure.DubboServiceRegistrationAutoConfiguration.CONSUL_AUTO_SERVICE_AUTO_CONFIGURATION_CLASS_NAME;
-import static com.alibaba.cloud.dubbo.autoconfigure.DubboServiceRegistrationAutoConfiguration.ZOOKEEPER_AUTO_SERVICE_AUTO_CONFIGURATION_CLASS_NAME;
+package com.alibaba.cloud.dubbo.autoconfigure;
import java.util.List;
+import com.alibaba.cloud.dubbo.metadata.repository.DubboServiceMetadataRepository;
+import com.alibaba.cloud.dubbo.registry.event.ServiceInstancePreRegisteredEvent;
+import com.ecwid.consul.v1.agent.model.NewService;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.config.spring.ServiceBean;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
+
import org.springframework.beans.factory.SmartInitializingSingleton;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
@@ -41,19 +43,18 @@ import org.springframework.cloud.zookeeper.serviceregistry.ServiceInstanceRegist
import org.springframework.context.annotation.Configuration;
import org.springframework.context.event.EventListener;
-import com.alibaba.cloud.dubbo.metadata.repository.DubboServiceMetadataRepository;
-import com.alibaba.cloud.dubbo.registry.event.ServiceInstancePreRegisteredEvent;
-
-import com.ecwid.consul.v1.agent.model.NewService;
+import static com.alibaba.cloud.dubbo.autoconfigure.DubboServiceRegistrationAutoConfiguration.CONSUL_AUTO_SERVICE_AUTO_CONFIGURATION_CLASS_NAME;
+import static com.alibaba.cloud.dubbo.autoconfigure.DubboServiceRegistrationAutoConfiguration.ZOOKEEPER_AUTO_SERVICE_AUTO_CONFIGURATION_CLASS_NAME;
/**
- * Dubbo Service Registration Auto-{@link Configuration} for Non-Web application
+ * Dubbo Service Registration Auto-{@link Configuration} for Non-Web application.
*
* @author Mercy
*/
@Configuration
@ConditionalOnNotWebApplication
-@ConditionalOnProperty(value = "spring.cloud.service-registry.auto-registration.enabled", matchIfMissing = true)
+@ConditionalOnProperty(value = "spring.cloud.service-registry.auto-registration.enabled",
+ matchIfMissing = true)
@AutoConfigureAfter(DubboServiceRegistrationAutoConfiguration.class)
@Aspect
public class DubboServiceRegistrationNonWebApplicationAutoConfiguration {
@@ -134,6 +135,7 @@ public class DubboServiceRegistrationNonWebApplicationAutoConfiguration {
// before register
registration.getServiceInstance();
}
+
}
@Configuration
@@ -141,8 +143,7 @@ public class DubboServiceRegistrationNonWebApplicationAutoConfiguration {
class ConsulConfiguration {
/**
- * Handle the pre-registered event of {@link ServiceInstance} for Consul
- *
+ * Handle the pre-registered event of {@link ServiceInstance} for Consul.
* @param event {@link ServiceInstancePreRegisteredEvent}
*/
@EventListener(ServiceInstancePreRegisteredEvent.class)
@@ -154,8 +155,7 @@ public class DubboServiceRegistrationNonWebApplicationAutoConfiguration {
}
/**
- * Set port on Non-Web Application
- *
+ * Set port on Non-Web Application.
* @param consulRegistration {@link ConsulRegistration}
*/
private void setPort(ConsulAutoRegistration consulRegistration) {
@@ -165,6 +165,7 @@ public class DubboServiceRegistrationNonWebApplicationAutoConfiguration {
newService.setPort(port);
}
}
+
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/autoconfigure/condition/MissingSpringCloudRegistryConfigPropertyCondition.java b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/autoconfigure/condition/MissingSpringCloudRegistryConfigPropertyCondition.java
index b83d799d6..598904297 100644
--- a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/autoconfigure/condition/MissingSpringCloudRegistryConfigPropertyCondition.java
+++ b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/autoconfigure/condition/MissingSpringCloudRegistryConfigPropertyCondition.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,13 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.alibaba.cloud.dubbo.autoconfigure.condition;
-import static com.alibaba.cloud.dubbo.registry.SpringCloudRegistryFactory.PROTOCOL;
-import static org.apache.dubbo.config.spring.util.PropertySourcesUtils.getSubProperties;
+package com.alibaba.cloud.dubbo.autoconfigure.condition;
import java.util.Map;
+import com.alibaba.cloud.dubbo.registry.SpringCloudRegistry;
+
import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
import org.springframework.context.annotation.Condition;
@@ -28,10 +28,11 @@ import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.type.AnnotatedTypeMetadata;
import org.springframework.util.StringUtils;
-import com.alibaba.cloud.dubbo.registry.SpringCloudRegistry;
+import static com.alibaba.cloud.dubbo.registry.SpringCloudRegistryFactory.PROTOCOL;
+import static org.apache.dubbo.config.spring.util.PropertySourcesUtils.getSubProperties;
/**
- * Missing {@link SpringCloudRegistry} Property {@link Condition}
+ * Missing {@link SpringCloudRegistry} Property {@link Condition}.
*
* @author Mercy
* @see SpringCloudRegistry
@@ -76,4 +77,5 @@ public class MissingSpringCloudRegistryConfigPropertyCondition
"'spring-cloud' protocol was found in 'dubbo.registries.*'")
: ConditionOutcome.match();
}
+
}
diff --git a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/client/loadbalancer/DubboClientHttpResponse.java b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/client/loadbalancer/DubboClientHttpResponse.java
index f0b9e89dd..87513d0b8 100644
--- a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/client/loadbalancer/DubboClientHttpResponse.java
+++ b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/client/loadbalancer/DubboClientHttpResponse.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,18 +13,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.alibaba.cloud.dubbo.client.loadbalancer;
import java.io.IOException;
import java.io.InputStream;
import org.apache.dubbo.rpc.service.GenericException;
+
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.client.ClientHttpResponse;
/**
- * Dubbo {@link ClientHttpResponse} implementation
+ * Dubbo {@link ClientHttpResponse} implementation.
*
* @author Mercy
* @see DubboTransporterInterceptor
@@ -39,7 +41,7 @@ class DubboClientHttpResponse implements ClientHttpResponse {
private final DubboHttpOutputMessage httpOutputMessage;
- public DubboClientHttpResponse(DubboHttpOutputMessage httpOutputMessage,
+ DubboClientHttpResponse(DubboHttpOutputMessage httpOutputMessage,
GenericException exception) {
this.httpStatus = exception != null ? HttpStatus.INTERNAL_SERVER_ERROR
: HttpStatus.OK;
@@ -77,4 +79,5 @@ class DubboClientHttpResponse implements ClientHttpResponse {
public HttpHeaders getHeaders() {
return httpHeaders;
}
+
}
diff --git a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/client/loadbalancer/DubboClientHttpResponseFactory.java b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/client/loadbalancer/DubboClientHttpResponseFactory.java
index 6bec0ae20..110f388e0 100644
--- a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/client/loadbalancer/DubboClientHttpResponseFactory.java
+++ b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/client/loadbalancer/DubboClientHttpResponseFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,23 +13,24 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.alibaba.cloud.dubbo.client.loadbalancer;
import java.io.IOException;
import java.util.List;
-import org.apache.dubbo.rpc.service.GenericException;
-import org.springframework.http.MediaType;
-import org.springframework.http.client.ClientHttpResponse;
-import org.springframework.http.converter.HttpMessageConverter;
-
import com.alibaba.cloud.dubbo.http.converter.HttpMessageConverterHolder;
import com.alibaba.cloud.dubbo.http.util.HttpMessageConverterResolver;
import com.alibaba.cloud.dubbo.metadata.RequestMetadata;
import com.alibaba.cloud.dubbo.metadata.RestMethodMetadata;
+import org.apache.dubbo.rpc.service.GenericException;
+
+import org.springframework.http.MediaType;
+import org.springframework.http.client.ClientHttpResponse;
+import org.springframework.http.converter.HttpMessageConverter;
/**
- * Dubbo {@link ClientHttpResponse} Factory
+ * Dubbo {@link ClientHttpResponse} Factory.
*
* @author Mercy
*/
@@ -37,7 +38,7 @@ class DubboClientHttpResponseFactory {
private final HttpMessageConverterResolver httpMessageConverterResolver;
- public DubboClientHttpResponseFactory(Listtrue
, or false
.
*/
boolean match(HttpRequest request);
+
}
diff --git a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/matcher/HttpRequestMethodsMatcher.java b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/matcher/HttpRequestMethodsMatcher.java
index 030ed313f..3a9f0ed6b 100644
--- a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/matcher/HttpRequestMethodsMatcher.java
+++ b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/matcher/HttpRequestMethodsMatcher.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,9 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.alibaba.cloud.dubbo.http.matcher;
-import static org.springframework.http.HttpMethod.resolve;
+package com.alibaba.cloud.dubbo.http.matcher;
import java.util.Collection;
import java.util.LinkedHashSet;
@@ -25,8 +24,10 @@ import org.springframework.http.HttpMethod;
import org.springframework.http.HttpRequest;
import org.springframework.util.StringUtils;
+import static org.springframework.http.HttpMethod.resolve;
+
/**
- * {@link HttpRequest} {@link HttpMethod methods} {@link HttpRequestMatcher matcher}
+ * {@link HttpRequest} {@link HttpMethod methods} {@link HttpRequestMatcher matcher}.
*
* @author Mercy
*/
@@ -78,4 +79,5 @@ public class HttpRequestMethodsMatcher extends AbstractHttpRequestMatcher {
protected String getToStringInfix() {
return " || ";
}
+
}
diff --git a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/matcher/HttpRequestParamsMatcher.java b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/matcher/HttpRequestParamsMatcher.java
index d9c1e912d..159c8746e 100644
--- a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/matcher/HttpRequestParamsMatcher.java
+++ b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/matcher/HttpRequestParamsMatcher.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.alibaba.cloud.dubbo.http.matcher;
import java.util.Collection;
@@ -23,7 +24,7 @@ import org.springframework.http.HttpRequest;
import org.springframework.util.CollectionUtils;
/**
- * {@link HttpRequest} parameters {@link HttpRequestMatcher matcher}
+ * {@link HttpRequest} parameters {@link HttpRequestMatcher matcher}.
*
* @author Mercy
*/
@@ -72,4 +73,5 @@ public class HttpRequestParamsMatcher extends AbstractHttpRequestMatcher {
protected String getToStringInfix() {
return " && ";
}
+
}
diff --git a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/matcher/HttpRequestPathMatcher.java b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/matcher/HttpRequestPathMatcher.java
index 9d92654fa..0ce2e74a9 100644
--- a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/matcher/HttpRequestPathMatcher.java
+++ b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/matcher/HttpRequestPathMatcher.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.alibaba.cloud.dubbo.http.matcher;
import java.net.URI;
@@ -29,7 +30,7 @@ import org.springframework.util.PathMatcher;
import org.springframework.util.StringUtils;
/**
- * {@link HttpRequest} {@link URI} {@link HttpRequestMatcher matcher}
+ * {@link HttpRequest} {@link URI} {@link HttpRequestMatcher matcher}.
*
* @author Mercy
*/
@@ -113,4 +114,5 @@ public class HttpRequestPathMatcher extends AbstractHttpRequestMatcher {
protected String getToStringInfix() {
return " || ";
}
+
}
diff --git a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/matcher/HttpRequestProducesMatcher.java b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/matcher/HttpRequestProducesMatcher.java
index d35445f4d..a5d93e16e 100644
--- a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/matcher/HttpRequestProducesMatcher.java
+++ b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/matcher/HttpRequestProducesMatcher.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.alibaba.cloud.dubbo.http.matcher;
import java.util.ArrayList;
@@ -27,7 +28,7 @@ import org.springframework.http.HttpRequest;
import org.springframework.http.MediaType;
/**
- * {@link HttpRequest} 'Accept' header {@link HttpRequestMatcher matcher}
+ * {@link HttpRequest} 'Accept' header {@link HttpRequestMatcher matcher}.
*
* @author Arjen Poutsma
* @author Rossen Stoyanchev
@@ -40,7 +41,6 @@ public class HttpRequestProducesMatcher extends AbstractHttpRequestMatcher {
/**
* Creates a new instance from "produces" expressions. If 0 expressions are provided
* in total, this condition will match to any request.
- *
* @param produces produces expressions
*/
public HttpRequestProducesMatcher(String... produces) {
@@ -52,7 +52,6 @@ public class HttpRequestProducesMatcher extends AbstractHttpRequestMatcher {
* expressions where the header name is not 'Accept' or have no header value defined
* are ignored. If 0 expressions are provided in total, this condition will match to
* any request.
- *
* @param produces produces expressions
* @param headers headers expressions
*/
@@ -119,4 +118,5 @@ public class HttpRequestProducesMatcher extends AbstractHttpRequestMatcher {
protected String getToStringInfix() {
return " || ";
}
+
}
diff --git a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/matcher/MediaTypeExpression.java b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/matcher/MediaTypeExpression.java
index 5638614a5..34078a1a1 100644
--- a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/matcher/MediaTypeExpression.java
+++ b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/matcher/MediaTypeExpression.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.alibaba.cloud.dubbo.http.matcher;
import org.springframework.http.MediaType;
diff --git a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/matcher/NameValueExpression.java b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/matcher/NameValueExpression.java
index 644c49392..066c662bb 100644
--- a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/matcher/NameValueExpression.java
+++ b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/matcher/NameValueExpression.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.alibaba.cloud.dubbo.http.matcher;
/**
@@ -20,7 +21,7 @@ package com.alibaba.cloud.dubbo.http.matcher;
* parameters and request header in HTTP request
*
*
- *
* @param path path to be normalized
* @return a normalized path if required
*/
@@ -79,10 +94,9 @@ public abstract class HttpUtils {
}
/**
- * Get Parameters from the specified {@link HttpRequest request}
- *
+ * Get Parameters from the specified {@link HttpRequest request}.
* @param request the specified {@link HttpRequest request}
- * @return
+ * @return map of parameters
*/
public static MultiValueMapnull
@@ -270,4 +269,5 @@ public class RequestMetadata {
+ ", params=" + params + ", headers=" + headers + ", consumes=" + consumes
+ ", produces=" + produces + '}';
}
+
}
diff --git a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/metadata/RestMethodMetadata.java b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/metadata/RestMethodMetadata.java
index ee95a3fa6..71a4d45c0 100644
--- a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/metadata/RestMethodMetadata.java
+++ b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/metadata/RestMethodMetadata.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.alibaba.cloud.dubbo.metadata;
import java.lang.reflect.Type;
@@ -21,13 +22,13 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
-import org.springframework.core.ResolvableType;
-
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
+import org.springframework.core.ResolvableType;
+
/**
- * Method Request Metadata
+ * Method Request Metadata.
*
* @author Mercy
*/
@@ -229,4 +230,5 @@ public class RestMethodMetadata {
+ ", indexToName=" + indexToName + ", formParams=" + formParams
+ ", indexToEncoded=" + indexToEncoded + '}';
}
+
}
diff --git a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/metadata/ServiceRestMetadata.java b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/metadata/ServiceRestMetadata.java
index 07771bf1c..2f5e6a048 100644
--- a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/metadata/ServiceRestMetadata.java
+++ b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/metadata/ServiceRestMetadata.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.alibaba.cloud.dubbo.metadata;
import java.util.Objects;
@@ -21,7 +22,7 @@ import java.util.Set;
import com.fasterxml.jackson.annotation.JsonInclude;
/**
- * Service Rest Metadata
+ * Service Rest Metadata.
*
* @author Mercy
* @see RestMethodMetadata
@@ -65,4 +66,5 @@ public class ServiceRestMetadata {
public int hashCode() {
return Objects.hash(url, meta);
}
+
}
diff --git a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/metadata/repository/DubboServiceMetadataRepository.java b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/metadata/repository/DubboServiceMetadataRepository.java
index 3afea1caf..124989c3e 100644
--- a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/metadata/repository/DubboServiceMetadataRepository.java
+++ b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/metadata/repository/DubboServiceMetadataRepository.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,21 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.alibaba.cloud.dubbo.metadata.repository;
-import static com.alibaba.cloud.dubbo.env.DubboCloudProperties.ALL_DUBBO_SERVICES;
-import static com.alibaba.cloud.dubbo.http.DefaultHttpRequest.builder;
-import static java.lang.String.format;
-import static java.lang.String.valueOf;
-import static java.util.Collections.emptyList;
-import static java.util.Collections.emptySet;
-import static java.util.Collections.unmodifiableList;
-import static java.util.Collections.unmodifiableMap;
-import static java.util.Collections.unmodifiableSet;
-import static org.apache.dubbo.common.constants.CommonConstants.APPLICATION_KEY;
-import static org.apache.dubbo.common.constants.CommonConstants.VERSION_KEY;
-import static org.springframework.util.CollectionUtils.isEmpty;
-import static org.springframework.util.StringUtils.hasText;
+package com.alibaba.cloud.dubbo.metadata.repository;
import java.util.Collections;
import java.util.LinkedHashMap;
@@ -41,9 +28,22 @@ import java.util.stream.Stream;
import javax.annotation.PostConstruct;
+import com.alibaba.cloud.dubbo.env.DubboCloudProperties;
+import com.alibaba.cloud.dubbo.http.matcher.RequestMetadataMatcher;
+import com.alibaba.cloud.dubbo.metadata.DubboRestServiceMetadata;
+import com.alibaba.cloud.dubbo.metadata.RequestMetadata;
+import com.alibaba.cloud.dubbo.metadata.ServiceRestMetadata;
+import com.alibaba.cloud.dubbo.registry.event.SubscribedServicesChangedEvent;
+import com.alibaba.cloud.dubbo.service.DubboMetadataService;
+import com.alibaba.cloud.dubbo.service.DubboMetadataServiceExporter;
+import com.alibaba.cloud.dubbo.service.DubboMetadataServiceProxy;
+import com.alibaba.cloud.dubbo.util.JSONUtils;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.type.TypeFactory;
import org.apache.dubbo.common.URL;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
import org.springframework.beans.factory.SmartInitializingSingleton;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@@ -58,22 +58,22 @@ import org.springframework.stereotype.Repository;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
-import com.alibaba.cloud.dubbo.env.DubboCloudProperties;
-import com.alibaba.cloud.dubbo.http.matcher.RequestMetadataMatcher;
-import com.alibaba.cloud.dubbo.metadata.DubboRestServiceMetadata;
-import com.alibaba.cloud.dubbo.metadata.RequestMetadata;
-import com.alibaba.cloud.dubbo.metadata.ServiceRestMetadata;
-import com.alibaba.cloud.dubbo.registry.event.SubscribedServicesChangedEvent;
-import com.alibaba.cloud.dubbo.service.DubboMetadataService;
-import com.alibaba.cloud.dubbo.service.DubboMetadataServiceExporter;
-import com.alibaba.cloud.dubbo.service.DubboMetadataServiceProxy;
-import com.alibaba.cloud.dubbo.util.JSONUtils;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.type.TypeFactory;
+import static com.alibaba.cloud.dubbo.env.DubboCloudProperties.ALL_DUBBO_SERVICES;
+import static com.alibaba.cloud.dubbo.http.DefaultHttpRequest.builder;
+import static java.lang.String.format;
+import static java.lang.String.valueOf;
+import static java.util.Collections.emptyList;
+import static java.util.Collections.emptySet;
+import static java.util.Collections.unmodifiableList;
+import static java.util.Collections.unmodifiableMap;
+import static java.util.Collections.unmodifiableSet;
+import static org.apache.dubbo.common.constants.CommonConstants.APPLICATION_KEY;
+import static org.apache.dubbo.common.constants.CommonConstants.VERSION_KEY;
+import static org.springframework.util.CollectionUtils.isEmpty;
+import static org.springframework.util.StringUtils.hasText;
/**
- * Dubbo Service Metadata {@link Repository}
+ * Dubbo Service Metadata {@link Repository}.
*
* @author Mercy
*/
@@ -82,19 +82,19 @@ public class DubboServiceMetadataRepository
implements SmartInitializingSingleton, ApplicationEventPublisherAware {
/**
- * The prefix of {@link DubboMetadataService} : "dubbo.metadata-service."
+ * The prefix of {@link DubboMetadataService} : "dubbo.metadata-service.".
*/
public static final String DUBBO_METADATA_SERVICE_PREFIX = "dubbo.metadata-service.";
/**
* The {@link URL URLs} property name of {@link DubboMetadataService} :
- * "dubbo.metadata-service.urls"
+ * "dubbo.metadata-service.urls".
*/
public static final String DUBBO_METADATA_SERVICE_URLS_PROPERTY_NAME = DUBBO_METADATA_SERVICE_PREFIX
+ "urls";
/**
- * The {@link String#format(String, Object...) pattern} of dubbo protocols port
+ * The {@link String#format(String, Object...) pattern} of dubbo protocols port.
*/
public static final String DUBBO_PROTOCOLS_PORT_PROPERTY_NAME_PATTERN = "dubbo.protocols.%s.port";
@@ -103,17 +103,19 @@ public class DubboServiceMetadataRepository
private final ObjectMapper objectMapper = new ObjectMapper();
/**
- * Monitor object for synchronization
+ * Monitor object for synchronization.
*/
private final Object monitor = new Object();
+
/**
- * A {@link Set} of service names that had been initialized
+ * A {@link Set} of service names that had been initialized.
*/
private final Setnull
@@ -661,4 +654,5 @@ public class DubboServiceMetadataRepository
ApplicationEventPublisher applicationEventPublisher) {
this.applicationEventPublisher = applicationEventPublisher;
}
+
}
diff --git a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/metadata/repository/MetadataServiceInstanceSelector.java b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/metadata/repository/MetadataServiceInstanceSelector.java
index f42ba4f9c..821e3043b 100644
--- a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/metadata/repository/MetadataServiceInstanceSelector.java
+++ b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/metadata/repository/MetadataServiceInstanceSelector.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,16 +22,17 @@ import java.util.Optional;
import org.springframework.cloud.client.ServiceInstance;
/**
- * metadata service instance selector
+ * metadata service instance selector.
*
* @author liuxx
*/
public interface MetadataServiceInstanceSelector {
/**
- * choose a service instance to get metadata
+ * choose a service instance to get metadata.
* @param serviceInstances all service instance
* @return the service instance to get metadata
*/
Optionaltrue
, or false
*/
public boolean isProcessed() {
return processed;
}
-}
\ No newline at end of file
+
+}
diff --git a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/registry/event/SubscribedServicesChangedEvent.java b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/registry/event/SubscribedServicesChangedEvent.java
index ea66aad42..df8168c09 100644
--- a/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/registry/event/SubscribedServicesChangedEvent.java
+++ b/spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/registry/event/SubscribedServicesChangedEvent.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.alibaba.cloud.dubbo.registry.event;
import java.util.LinkedHashSet;
@@ -22,7 +23,7 @@ import java.util.Set;
import org.springframework.context.ApplicationEvent;
/**
- * {@link ApplicationEvent Event} raised when the subscribed services are changed
+ * {@link ApplicationEvent Event} raised when the subscribed services are changed.
* null
if present
*/
String getServiceRestMetadata();
/**
- * Get all exported {@link URL#getServiceKey() service keys}
- *
+ * Get all exported {@link URL#getServiceKey() service keys}.
* @return non-null read-only {@link Set}
*/
Set
" + result;
}
+
}
diff --git a/spring-cloud-alibaba-examples/ans-example/ans-consumer-feign-example/src/main/resources/application.properties b/spring-cloud-alibaba-examples/ans-example/ans-consumer-feign-example/src/main/resources/application.properties
index ac697b885..19219e43d 100644
--- a/spring-cloud-alibaba-examples/ans-example/ans-consumer-feign-example/src/main/resources/application.properties
+++ b/spring-cloud-alibaba-examples/ans-example/ans-consumer-feign-example/src/main/resources/application.properties
@@ -2,4 +2,4 @@ spring.application.name=feign-consumer
server.port=18083
# The following configuration can be omitted.
spring.cloud.alicloud.ans.server-list=127.0.0.1
-spring.cloud.alicloud.ans.server-port=8080
\ No newline at end of file
+spring.cloud.alicloud.ans.server-port=8080
diff --git a/spring-cloud-alibaba-examples/ans-example/ans-consumer-ribbon-example/src/main/java/com/alibaba/cloud/examples/ConsumerApplication.java b/spring-cloud-alibaba-examples/ans-example/ans-consumer-ribbon-example/src/main/java/com/alibaba/cloud/examples/ConsumerApplication.java
index 1d674cbe3..e83ba6114 100644
--- a/spring-cloud-alibaba-examples/ans-example/ans-consumer-ribbon-example/src/main/java/com/alibaba/cloud/examples/ConsumerApplication.java
+++ b/spring-cloud-alibaba-examples/ans-example/ans-consumer-ribbon-example/src/main/java/com/alibaba/cloud/examples/ConsumerApplication.java
@@ -1,11 +1,11 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
diff --git a/spring-cloud-alibaba-examples/ans-example/ans-consumer-ribbon-example/src/main/java/com/alibaba/cloud/examples/HomeController.java b/spring-cloud-alibaba-examples/ans-example/ans-consumer-ribbon-example/src/main/java/com/alibaba/cloud/examples/HomeController.java
index 26e1a08bd..a93c023d9 100644
--- a/spring-cloud-alibaba-examples/ans-example/ans-consumer-ribbon-example/src/main/java/com/alibaba/cloud/examples/HomeController.java
+++ b/spring-cloud-alibaba-examples/ans-example/ans-consumer-ribbon-example/src/main/java/com/alibaba/cloud/examples/HomeController.java
@@ -1,11 +1,11 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -18,10 +18,9 @@ package com.alibaba.cloud.examples;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
@@ -46,4 +45,5 @@ public class HomeController {
LOGGER.info("收到提供者响应:" + result);
return param + "
" + result;
}
+
}
diff --git a/spring-cloud-alibaba-examples/ans-example/ans-consumer-ribbon-example/src/main/resources/application.properties b/spring-cloud-alibaba-examples/ans-example/ans-consumer-ribbon-example/src/main/resources/application.properties
index 33a7e5aa5..c78563546 100644
--- a/spring-cloud-alibaba-examples/ans-example/ans-consumer-ribbon-example/src/main/resources/application.properties
+++ b/spring-cloud-alibaba-examples/ans-example/ans-consumer-ribbon-example/src/main/resources/application.properties
@@ -2,4 +2,4 @@ spring.application.name=ribbon-consumer
server.port=18082
# The following configuration can be omitted.
spring.cloud.alicloud.ans.server-list=127.0.0.1
-spring.cloud.alicloud.ans.server-port=8080
\ No newline at end of file
+spring.cloud.alicloud.ans.server-port=8080
diff --git a/spring-cloud-alibaba-examples/ans-example/ans-provider-example/src/main/java/com/alibaba/cloud/examples/EchoController.java b/spring-cloud-alibaba-examples/ans-example/ans-provider-example/src/main/java/com/alibaba/cloud/examples/EchoController.java
index 20bea9738..07744adff 100644
--- a/spring-cloud-alibaba-examples/ans-example/ans-provider-example/src/main/java/com/alibaba/cloud/examples/EchoController.java
+++ b/spring-cloud-alibaba-examples/ans-example/ans-provider-example/src/main/java/com/alibaba/cloud/examples/EchoController.java
@@ -1,11 +1,11 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -18,7 +18,10 @@ package com.alibaba.cloud.examples;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.web.bind.annotation.*;
+
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RestController;
/**
* @author xiaolongzuo
@@ -36,4 +39,5 @@ public class EchoController {
LOGGER.info("提供者返回结果:" + result);
return result;
}
+
}
diff --git a/spring-cloud-alibaba-examples/ans-example/ans-provider-example/src/main/java/com/alibaba/cloud/examples/ProviderApplication.java b/spring-cloud-alibaba-examples/ans-example/ans-provider-example/src/main/java/com/alibaba/cloud/examples/ProviderApplication.java
index 97c5592e3..cba3781e7 100644
--- a/spring-cloud-alibaba-examples/ans-example/ans-provider-example/src/main/java/com/alibaba/cloud/examples/ProviderApplication.java
+++ b/spring-cloud-alibaba-examples/ans-example/ans-provider-example/src/main/java/com/alibaba/cloud/examples/ProviderApplication.java
@@ -1,11 +1,11 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
diff --git a/spring-cloud-alibaba-examples/ans-example/ans-provider-example/src/main/resources/application.properties b/spring-cloud-alibaba-examples/ans-example/ans-provider-example/src/main/resources/application.properties
index e5f6cdef2..274235154 100644
--- a/spring-cloud-alibaba-examples/ans-example/ans-provider-example/src/main/resources/application.properties
+++ b/spring-cloud-alibaba-examples/ans-example/ans-provider-example/src/main/resources/application.properties
@@ -1,4 +1,4 @@
spring.application.name=ans-provider
server.port=18081
spring.cloud.alicloud.ans.server-list=127.0.0.1
-spring.cloud.alicloud.ans.server-port=8080
\ No newline at end of file
+spring.cloud.alicloud.ans.server-port=8080
diff --git a/spring-cloud-alibaba-examples/nacos-example/nacos-config-example/src/main/java/com/alibaba/cloud/examples/Application.java b/spring-cloud-alibaba-examples/nacos-example/nacos-config-example/src/main/java/com/alibaba/cloud/examples/Application.java
index a9cb91eb6..35cec8c38 100644
--- a/spring-cloud-alibaba-examples/nacos-example/nacos-config-example/src/main/java/com/alibaba/cloud/examples/Application.java
+++ b/spring-cloud-alibaba-examples/nacos-example/nacos-config-example/src/main/java/com/alibaba/cloud/examples/Application.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2013-2018 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package com.alibaba.cloud.examples;
import java.io.IOException;
@@ -6,6 +22,8 @@ import java.util.Properties;
import java.util.concurrent.Executor;
import com.alibaba.cloud.nacos.NacosConfigManager;
+import com.alibaba.nacos.api.config.listener.Listener;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments;
@@ -17,17 +35,16 @@ import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
-import com.alibaba.cloud.nacos.NacosConfigProperties;
-import com.alibaba.nacos.api.config.listener.Listener;
-
/**
* @author xiaojing, Jianwei Mao
*/
@SpringBootApplication
public class Application {
+
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
+
}
@Component
@@ -56,9 +73,8 @@ class SampleRunner implements ApplicationRunner {
* For example, config data in Nacos is:
*
* user.name=Nacos user.age=25
- *
* @param configInfo latest config data for specific dataId in Nacos
- * server
+ * server
*/
@Override
public void receiveConfigInfo(String configInfo) {
@@ -78,6 +94,7 @@ class SampleRunner implements ApplicationRunner {
}
});
}
+
}
@RestController
@@ -98,4 +115,5 @@ class SampleController {
return "Hello Nacos Config!" + "Hello " + userName + " " + age + "!"
+ nacosConfigManager.getConfigService();
}
-}
\ No newline at end of file
+
+}
diff --git a/spring-cloud-alibaba-examples/nacos-example/nacos-config-example/src/main/resources/application.properties b/spring-cloud-alibaba-examples/nacos-example/nacos-config-example/src/main/resources/application.properties
index c6e216ad7..de11d576c 100644
--- a/spring-cloud-alibaba-examples/nacos-example/nacos-config-example/src/main/resources/application.properties
+++ b/spring-cloud-alibaba-examples/nacos-example/nacos-config-example/src/main/resources/application.properties
@@ -1,2 +1,2 @@
server.port=18084
-management.endpoints.web.exposure.include=*
\ No newline at end of file
+management.endpoints.web.exposure.include=*
diff --git a/spring-cloud-alibaba-examples/nacos-example/nacos-config-example/src/main/resources/bootstrap.properties b/spring-cloud-alibaba-examples/nacos-example/nacos-config-example/src/main/resources/bootstrap.properties
index 375be66e9..d6906d1c9 100644
--- a/spring-cloud-alibaba-examples/nacos-example/nacos-config-example/src/main/resources/bootstrap.properties
+++ b/spring-cloud-alibaba-examples/nacos-example/nacos-config-example/src/main/resources/bootstrap.properties
@@ -1,4 +1,4 @@
spring.application.name=nacos-config-example
spring.cloud.nacos.config.server-addr=127.0.0.1:8848
spring.cloud.nacos.config.shared-data-ids=base-common.properties,common.properties
-spring.cloud.nacos.config.refreshable-dataids=common.properties
\ No newline at end of file
+spring.cloud.nacos.config.refreshable-dataids=common.properties
diff --git a/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-example/src/main/java/com/alibaba/cloud/examples/ConsumerApplication.java b/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-example/src/main/java/com/alibaba/cloud/examples/ConsumerApplication.java
index bed219b80..6f9c98909 100644
--- a/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-example/src/main/java/com/alibaba/cloud/examples/ConsumerApplication.java
+++ b/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-example/src/main/java/com/alibaba/cloud/examples/ConsumerApplication.java
@@ -1,5 +1,24 @@
+/*
+ * Copyright 2013-2018 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package com.alibaba.cloud.examples;
+import com.alibaba.cloud.examples.ConsumerApplication.EchoService;
+import com.alibaba.cloud.sentinel.annotation.SentinelRestTemplate;
+
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
@@ -7,12 +26,11 @@ import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.Bean;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.client.RestTemplate;
-import com.alibaba.cloud.examples.ConsumerApplication.EchoService;
-import com.alibaba.cloud.sentinel.annotation.SentinelRestTemplate;
-
/**
* @author xiaojing
*/
@@ -39,32 +57,38 @@ public class ConsumerApplication {
SpringApplication.run(ConsumerApplication.class, args);
}
- @FeignClient(name = "service-provider", fallback = EchoServiceFallback.class, configuration = FeignConfiguration.class)
+ @FeignClient(name = "service-provider", fallback = EchoServiceFallback.class,
+ configuration = FeignConfiguration.class)
public interface EchoService {
- @GetMapping(value = "/echo/{str}")
+
+ @GetMapping("/echo/{str}")
String echo(@PathVariable("str") String str);
- @GetMapping(value = "/divide")
+ @GetMapping("/divide")
String divide(@RequestParam("a") Integer a, @RequestParam("b") Integer b);
default String divide(Integer a) {
return divide(a, 0);
}
- @GetMapping(value = "/notFound")
+ @GetMapping("/notFound")
String notFound();
+
}
}
class FeignConfiguration {
+
@Bean
public EchoServiceFallback echoServiceFallback() {
return new EchoServiceFallback();
}
+
}
class EchoServiceFallback implements EchoService {
+
@Override
public String echo(@PathVariable("str") String str) {
return "echo fallback";
@@ -79,4 +103,5 @@ class EchoServiceFallback implements EchoService {
public String notFound() {
return "notFound fallback";
}
+
}
diff --git a/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-example/src/main/java/com/alibaba/cloud/examples/TestController.java b/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-example/src/main/java/com/alibaba/cloud/examples/TestController.java
index 9281e9fcf..3e9946c47 100644
--- a/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-example/src/main/java/com/alibaba/cloud/examples/TestController.java
+++ b/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-example/src/main/java/com/alibaba/cloud/examples/TestController.java
@@ -1,12 +1,31 @@
+/*
+ * Copyright 2013-2018 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package com.alibaba.cloud.examples;
+import com.alibaba.cloud.examples.ConsumerApplication.EchoService;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.discovery.DiscoveryClient;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
-import com.alibaba.cloud.examples.ConsumerApplication.EchoService;
-
/**
* @author xiaojing
*/
@@ -40,54 +59,55 @@ public class TestController {
// });
// }
- @GetMapping(value = "/echo-rest/{str}")
+ @GetMapping("/echo-rest/{str}")
public String rest(@PathVariable String str) {
return restTemplate.getForObject("http://service-provider/echo/" + str,
String.class);
}
- @GetMapping(value = "/index")
+ @GetMapping("/index")
public String index() {
return restTemplate1.getForObject("http://service-provider", String.class);
}
- @GetMapping(value = "/test")
+ @GetMapping("/test")
public String test() {
return restTemplate1.getForObject("http://service-provider/test", String.class);
}
- @GetMapping(value = "/sleep")
+ @GetMapping("/sleep")
public String sleep() {
return restTemplate1.getForObject("http://service-provider/sleep", String.class);
}
- @GetMapping(value = "/notFound-feign")
+ @GetMapping("/notFound-feign")
public String notFound() {
return echoService.notFound();
}
- @GetMapping(value = "/divide-feign")
+ @GetMapping("/divide-feign")
public String divide(@RequestParam Integer a, @RequestParam Integer b) {
return echoService.divide(a, b);
}
- @GetMapping(value = "/divide-feign2")
+ @GetMapping("/divide-feign2")
public String divide(@RequestParam Integer a) {
return echoService.divide(a);
}
- @GetMapping(value = "/echo-feign/{str}")
+ @GetMapping("/echo-feign/{str}")
public String feign(@PathVariable String str) {
return echoService.echo(str);
}
- @GetMapping(value = "/services/{service}")
+ @GetMapping("/services/{service}")
public Object client(@PathVariable String service) {
return discoveryClient.getInstances(service);
}
- @GetMapping(value = "/services")
+ @GetMapping("/services")
public Object services() {
return discoveryClient.getServices();
}
+
}
diff --git a/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-example/src/main/java/com/alibaba/cloud/examples/UrlCleaner.java b/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-example/src/main/java/com/alibaba/cloud/examples/UrlCleaner.java
index 68d65d0ba..e0c691af4 100644
--- a/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-example/src/main/java/com/alibaba/cloud/examples/UrlCleaner.java
+++ b/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-example/src/main/java/com/alibaba/cloud/examples/UrlCleaner.java
@@ -1,6 +1,23 @@
+/*
+ * Copyright 2013-2018 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package com.alibaba.cloud.examples;
public class UrlCleaner {
+
public static String clean(String url) {
System.out.println("enter urlCleaner");
if (url.matches(".*/echo/.*")) {
@@ -9,4 +26,5 @@ public class UrlCleaner {
}
return url;
}
+
}
diff --git a/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-example/src/main/resources/application.properties b/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-example/src/main/resources/application.properties
index 2d260cb2c..7f236aa9a 100644
--- a/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-example/src/main/resources/application.properties
+++ b/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-example/src/main/resources/application.properties
@@ -14,4 +14,4 @@ spring.cloud.sentinel.datasource.ds1.file.rule-type=flow
spring.cloud.sentinel.datasource.ds2.file.file=classpath: degraderule.json
spring.cloud.sentinel.datasource.ds2.file.data-type=json
-spring.cloud.sentinel.datasource.ds2.file.rule-type=degrade
\ No newline at end of file
+spring.cloud.sentinel.datasource.ds2.file.rule-type=degrade
diff --git a/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-provider-example/src/main/java/com/alibaba/cloud/examples/ProviderApplication.java b/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-provider-example/src/main/java/com/alibaba/cloud/examples/ProviderApplication.java
index 2be2adb42..94a842598 100644
--- a/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-provider-example/src/main/java/com/alibaba/cloud/examples/ProviderApplication.java
+++ b/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-provider-example/src/main/java/com/alibaba/cloud/examples/ProviderApplication.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2013-2018 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package com.alibaba.cloud.examples;
import org.springframework.boot.SpringApplication;
@@ -5,7 +21,10 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
/**
* @author xiaojing
@@ -21,17 +40,17 @@ public class ProviderApplication {
@RestController
class EchoController {
- @GetMapping(value = "/")
+ @GetMapping("/")
public ResponseEntity index() {
return new ResponseEntity("index error", HttpStatus.INTERNAL_SERVER_ERROR);
}
- @GetMapping(value = "/test")
+ @GetMapping("/test")
public ResponseEntity test() {
return new ResponseEntity("error", HttpStatus.INTERNAL_SERVER_ERROR);
}
- @GetMapping(value = "/sleep")
+ @GetMapping("/sleep")
public String sleep() {
try {
Thread.sleep(1000L);
@@ -42,14 +61,16 @@ public class ProviderApplication {
return "ok";
}
- @GetMapping(value = "/echo/{string}")
+ @GetMapping("/echo/{string}")
public String echo(@PathVariable String string) {
return "hello Nacos Discovery " + string;
}
- @GetMapping(value = "/divide")
+ @GetMapping("/divide")
public String divide(@RequestParam Integer a, @RequestParam Integer b) {
return String.valueOf(a / b);
}
+
}
+
}
diff --git a/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-provider-example/src/main/resources/application.properties b/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-provider-example/src/main/resources/application.properties
index 66100d79f..dee115b62 100644
--- a/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-provider-example/src/main/resources/application.properties
+++ b/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-provider-example/src/main/resources/application.properties
@@ -1,4 +1,4 @@
server.port=18082
spring.application.name=service-provider
spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848
-management.endpoints.web.exposure.include=*
\ No newline at end of file
+management.endpoints.web.exposure.include=*
diff --git a/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-spring-cloud-config-client/src/main/java/com/alibaba/cloud/examples/GetConfigController.java b/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-spring-cloud-config-client/src/main/java/com/alibaba/cloud/examples/GetConfigController.java
index 0fbd29850..32dfcff07 100644
--- a/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-spring-cloud-config-client/src/main/java/com/alibaba/cloud/examples/GetConfigController.java
+++ b/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-spring-cloud-config-client/src/main/java/com/alibaba/cloud/examples/GetConfigController.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,8 +18,6 @@ package com.alibaba.cloud.examples;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController
@@ -28,7 +26,7 @@ public class GetConfigController {
@Value("${config}")
private String config;
- @GetMapping(value = "/config")
+ @GetMapping("/config")
public String getConfig() {
return config;
}
diff --git a/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-spring-cloud-config-client/src/main/java/com/alibaba/cloud/examples/SpringCloudConfigClientApplication.java b/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-spring-cloud-config-client/src/main/java/com/alibaba/cloud/examples/SpringCloudConfigClientApplication.java
index 4968266c4..05bc6c5bb 100644
--- a/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-spring-cloud-config-client/src/main/java/com/alibaba/cloud/examples/SpringCloudConfigClientApplication.java
+++ b/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-spring-cloud-config-client/src/main/java/com/alibaba/cloud/examples/SpringCloudConfigClientApplication.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,4 +31,4 @@ public class SpringCloudConfigClientApplication {
SpringApplication.run(SpringCloudConfigClientApplication.class, args);
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-spring-cloud-config-server/src/main/java/com/alibaba/cloud/examples/SpringCloudConfigServerApplication.java b/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-spring-cloud-config-server/src/main/java/com/alibaba/cloud/examples/SpringCloudConfigServerApplication.java
index 680ab2ec8..a82bad8e8 100644
--- a/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-spring-cloud-config-server/src/main/java/com/alibaba/cloud/examples/SpringCloudConfigServerApplication.java
+++ b/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-spring-cloud-config-server/src/main/java/com/alibaba/cloud/examples/SpringCloudConfigServerApplication.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,4 +33,4 @@ public class SpringCloudConfigServerApplication {
SpringApplication.run(SpringCloudConfigServerApplication.class, args);
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-discovery-example/src/main/java/com/alibaba/cloud/examples/GatewayApplication.java b/spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-discovery-example/src/main/java/com/alibaba/cloud/examples/GatewayApplication.java
index a59a4168e..6767357ff 100644
--- a/spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-discovery-example/src/main/java/com/alibaba/cloud/examples/GatewayApplication.java
+++ b/spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-discovery-example/src/main/java/com/alibaba/cloud/examples/GatewayApplication.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2013-2018 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package com.alibaba.cloud.examples;
import org.springframework.boot.SpringApplication;
diff --git a/spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-discovery-example/src/main/resources/application.properties b/spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-discovery-example/src/main/resources/application.properties
index 613948914..276d85d10 100644
--- a/spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-discovery-example/src/main/resources/application.properties
+++ b/spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-discovery-example/src/main/resources/application.properties
@@ -8,4 +8,4 @@ spring.cloud.gateway.routes[0].id=nacos-route
spring.cloud.gateway.routes[0].uri=lb://service-gateway-provider
spring.cloud.gateway.routes[0].predicates[0].name=Path
spring.cloud.gateway.routes[0].predicates[0].args[pattern]=/nacos/**
-spring.cloud.gateway.routes[0].filters[0]=StripPrefix=1
\ No newline at end of file
+spring.cloud.gateway.routes[0].filters[0]=StripPrefix=1
diff --git a/spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-provider-example/src/main/java/com/alibaba/cloud/examples/ProviderApplication.java b/spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-provider-example/src/main/java/com/alibaba/cloud/examples/ProviderApplication.java
index 02a28892c..a28fd9430 100644
--- a/spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-provider-example/src/main/java/com/alibaba/cloud/examples/ProviderApplication.java
+++ b/spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-provider-example/src/main/java/com/alibaba/cloud/examples/ProviderApplication.java
@@ -1,9 +1,28 @@
+/*
+ * Copyright 2013-2018 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package com.alibaba.cloud.examples;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
/**
* @author xiaojing
@@ -18,14 +37,17 @@ public class ProviderApplication {
@RestController
class EchoController {
- @GetMapping(value = "/echo/{string}")
+
+ @GetMapping("/echo/{string}")
public String echo(@PathVariable String string) {
return "hello Nacos Discovery " + string;
}
- @GetMapping(value = "/divide")
+ @GetMapping("/divide")
public String divide(@RequestParam Integer a, @RequestParam Integer b) {
return String.valueOf(a / b);
}
+
}
+
}
diff --git a/spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-provider-example/src/main/resources/application.properties b/spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-provider-example/src/main/resources/application.properties
index 9a061092c..ab340ff8c 100644
--- a/spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-provider-example/src/main/resources/application.properties
+++ b/spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-provider-example/src/main/resources/application.properties
@@ -1,4 +1,4 @@
server.port=18086
spring.application.name=service-gateway-provider
spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848
-management.endpoints.web.exposure.include=*
\ No newline at end of file
+management.endpoints.web.exposure.include=*
diff --git a/spring-cloud-alibaba-examples/oss-example/src/main/java/com/alibaba/cloud/examples/OssApplication.java b/spring-cloud-alibaba-examples/oss-example/src/main/java/com/alibaba/cloud/examples/OssApplication.java
index 9dd6907f6..0e3f7b8a4 100644
--- a/spring-cloud-alibaba-examples/oss-example/src/main/java/com/alibaba/cloud/examples/OssApplication.java
+++ b/spring-cloud-alibaba-examples/oss-example/src/main/java/com/alibaba/cloud/examples/OssApplication.java
@@ -1,7 +1,25 @@
+/*
+ * Copyright 2013-2018 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package com.alibaba.cloud.examples;
import java.net.URISyntaxException;
+import com.aliyun.oss.OSS;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
@@ -9,10 +27,8 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
-import com.aliyun.oss.OSS;
-
/**
- * OSS Application
+ * OSS Application.
*
* @author Jim
*/
@@ -31,6 +47,7 @@ public class OssApplication {
}
class AppRunner implements ApplicationRunner {
+
@Autowired
private OSS ossClient;
@@ -46,6 +63,7 @@ public class OssApplication {
System.exit(-1);
}
}
+
}
}
diff --git a/spring-cloud-alibaba-examples/oss-example/src/main/java/com/alibaba/cloud/examples/OssController.java b/spring-cloud-alibaba-examples/oss-example/src/main/java/com/alibaba/cloud/examples/OssController.java
index 7dc364cb6..9628f9502 100644
--- a/spring-cloud-alibaba-examples/oss-example/src/main/java/com/alibaba/cloud/examples/OssController.java
+++ b/spring-cloud-alibaba-examples/oss-example/src/main/java/com/alibaba/cloud/examples/OssController.java
@@ -1,9 +1,30 @@
+/*
+ * Copyright 2013-2018 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package com.alibaba.cloud.examples;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.charset.Charset;
+
import com.aliyun.oss.OSS;
import com.aliyun.oss.common.utils.IOUtils;
import com.aliyun.oss.model.OSSObject;
import org.apache.commons.codec.CharEncoding;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
@@ -12,12 +33,8 @@ import org.springframework.util.StreamUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.nio.charset.Charset;
-
/**
- * OSS Controller
+ * OSS Controller.
*
* @author Jim
*/
diff --git a/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-consume-example/src/main/java/com/alibaba/cloud/examples/Foo.java b/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-consume-example/src/main/java/com/alibaba/cloud/examples/Foo.java
index 78dbf120f..c4127e7b1 100644
--- a/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-consume-example/src/main/java/com/alibaba/cloud/examples/Foo.java
+++ b/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-consume-example/src/main/java/com/alibaba/cloud/examples/Foo.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2013-2018 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package com.alibaba.cloud.examples;
/**
@@ -6,6 +22,7 @@ package com.alibaba.cloud.examples;
public class Foo {
private int id;
+
private String bar;
public Foo() {
@@ -36,4 +53,5 @@ public class Foo {
public String toString() {
return "Foo{" + "id=" + id + ", bar='" + bar + '\'' + '}';
}
+
}
diff --git a/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-consume-example/src/main/java/com/alibaba/cloud/examples/ReceiveService.java b/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-consume-example/src/main/java/com/alibaba/cloud/examples/ReceiveService.java
index 0544f6ae3..0754c91bd 100644
--- a/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-consume-example/src/main/java/com/alibaba/cloud/examples/ReceiveService.java
+++ b/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-consume-example/src/main/java/com/alibaba/cloud/examples/ReceiveService.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2013-2018 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package com.alibaba.cloud.examples;
import org.springframework.cloud.stream.annotation.StreamListener;
diff --git a/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-consume-example/src/main/java/com/alibaba/cloud/examples/RocketMQConsumerApplication.java b/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-consume-example/src/main/java/com/alibaba/cloud/examples/RocketMQConsumerApplication.java
index ddfcdbd5c..2bd73880e 100644
--- a/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-consume-example/src/main/java/com/alibaba/cloud/examples/RocketMQConsumerApplication.java
+++ b/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-consume-example/src/main/java/com/alibaba/cloud/examples/RocketMQConsumerApplication.java
@@ -1,5 +1,23 @@
+/*
+ * Copyright 2013-2018 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package com.alibaba.cloud.examples;
+import com.alibaba.cloud.examples.RocketMQConsumerApplication.MySink;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
@@ -11,8 +29,6 @@ import org.springframework.context.annotation.Bean;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.messaging.SubscribableChannel;
-import com.alibaba.cloud.examples.RocketMQConsumerApplication.MySink;
-
/**
* @author Jim
*/
@@ -20,6 +36,15 @@ import com.alibaba.cloud.examples.RocketMQConsumerApplication.MySink;
@EnableBinding({ MySink.class })
public class RocketMQConsumerApplication {
+ public static void main(String[] args) {
+ SpringApplication.run(RocketMQConsumerApplication.class, args);
+ }
+
+ @Bean
+ public ConsumerCustomRunner customRunner() {
+ return new ConsumerCustomRunner();
+ }
+
public interface MySink {
@Input("input1")
@@ -36,15 +61,7 @@ public class RocketMQConsumerApplication {
@Input("input5")
PollableMessageSource input5();
- }
-
- public static void main(String[] args) {
- SpringApplication.run(RocketMQConsumerApplication.class, args);
- }
- @Bean
- public ConsumerCustomRunner customRunner() {
- return new ConsumerCustomRunner();
}
public static class ConsumerCustomRunner implements CommandLineRunner {
@@ -63,6 +80,7 @@ public class RocketMQConsumerApplication {
Thread.sleep(2_000);
}
}
+
}
}
diff --git a/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-consume-example/src/main/resources/application.properties b/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-consume-example/src/main/resources/application.properties
index dd8bb6ef4..2779db522 100644
--- a/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-consume-example/src/main/resources/application.properties
+++ b/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-consume-example/src/main/resources/application.properties
@@ -33,4 +33,4 @@ spring.application.name=rocketmq-consume-example
server.port=28082
management.endpoints.web.exposure.include=*
-management.endpoint.health.show-details=always
\ No newline at end of file
+management.endpoint.health.show-details=always
diff --git a/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-produce-example/src/main/java/com/alibaba/cloud/examples/Foo.java b/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-produce-example/src/main/java/com/alibaba/cloud/examples/Foo.java
index 78dbf120f..c4127e7b1 100644
--- a/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-produce-example/src/main/java/com/alibaba/cloud/examples/Foo.java
+++ b/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-produce-example/src/main/java/com/alibaba/cloud/examples/Foo.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2013-2018 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package com.alibaba.cloud.examples;
/**
@@ -6,6 +22,7 @@ package com.alibaba.cloud.examples;
public class Foo {
private int id;
+
private String bar;
public Foo() {
@@ -36,4 +53,5 @@ public class Foo {
public String toString() {
return "Foo{" + "id=" + id + ", bar='" + bar + '\'' + '}';
}
+
}
diff --git a/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-produce-example/src/main/java/com/alibaba/cloud/examples/RocketMQProduceApplication.java b/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-produce-example/src/main/java/com/alibaba/cloud/examples/RocketMQProduceApplication.java
index 6a7ac9d41..eaf4b47ee 100644
--- a/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-produce-example/src/main/java/com/alibaba/cloud/examples/RocketMQProduceApplication.java
+++ b/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-produce-example/src/main/java/com/alibaba/cloud/examples/RocketMQProduceApplication.java
@@ -1,5 +1,23 @@
+/*
+ * Copyright 2013-2018 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package com.alibaba.cloud.examples;
+import com.alibaba.cloud.examples.RocketMQProduceApplication.MySource;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
@@ -10,8 +28,6 @@ import org.springframework.context.annotation.Bean;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.support.MessageBuilder;
-import com.alibaba.cloud.examples.RocketMQProduceApplication.MySource;
-
/**
* @author Jim
*/
@@ -19,17 +35,6 @@ import com.alibaba.cloud.examples.RocketMQProduceApplication.MySource;
@EnableBinding({ MySource.class })
public class RocketMQProduceApplication {
- public interface MySource {
- @Output("output1")
- MessageChannel output1();
-
- @Output("output2")
- MessageChannel output2();
-
- @Output("output3")
- MessageChannel output3();
- }
-
public static void main(String[] args) {
SpringApplication.run(RocketMQProduceApplication.class, args);
}
@@ -49,6 +54,19 @@ public class RocketMQProduceApplication {
return new CustomRunnerWithTransactional();
}
+ public interface MySource {
+
+ @Output("output1")
+ MessageChannel output1();
+
+ @Output("output2")
+ MessageChannel output2();
+
+ @Output("output3")
+ MessageChannel output3();
+
+ }
+
public static class CustomRunner implements CommandLineRunner {
private final String bindingName;
@@ -90,9 +108,11 @@ public class RocketMQProduceApplication {
}
}
+
}
public static class CustomRunnerWithTransactional implements CommandLineRunner {
+
@Autowired
private SenderService senderService;
@@ -107,6 +127,7 @@ public class RocketMQProduceApplication {
// COMMIT_MESSAGE message
senderService.sendTransactionalMsg("transactional-msg4", 4);
}
+
}
}
diff --git a/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-produce-example/src/main/java/com/alibaba/cloud/examples/SenderService.java b/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-produce-example/src/main/java/com/alibaba/cloud/examples/SenderService.java
index 79fec70e1..cd9e50939 100644
--- a/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-produce-example/src/main/java/com/alibaba/cloud/examples/SenderService.java
+++ b/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-produce-example/src/main/java/com/alibaba/cloud/examples/SenderService.java
@@ -1,10 +1,28 @@
+/*
+ * Copyright 2013-2018 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package com.alibaba.cloud.examples;
import java.util.stream.Collectors;
import java.util.stream.Stream;
+import com.alibaba.cloud.examples.RocketMQProduceApplication.MySource;
import org.apache.rocketmq.common.message.MessageConst;
import org.apache.rocketmq.spring.support.RocketMQHeaders;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHeaders;
@@ -12,8 +30,6 @@ import org.springframework.messaging.support.MessageBuilder;
import org.springframework.stereotype.Service;
import org.springframework.util.MimeTypeUtils;
-import com.alibaba.cloud.examples.RocketMQProduceApplication.MySource;
-
/**
* @author Jim
*/
diff --git a/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-produce-example/src/main/java/com/alibaba/cloud/examples/TransactionListenerImpl.java b/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-produce-example/src/main/java/com/alibaba/cloud/examples/TransactionListenerImpl.java
index f2b3b6b6d..e58beb221 100644
--- a/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-produce-example/src/main/java/com/alibaba/cloud/examples/TransactionListenerImpl.java
+++ b/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-produce-example/src/main/java/com/alibaba/cloud/examples/TransactionListenerImpl.java
@@ -1,11 +1,11 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -19,13 +19,16 @@ package com.alibaba.cloud.examples;
import org.apache.rocketmq.spring.annotation.RocketMQTransactionListener;
import org.apache.rocketmq.spring.core.RocketMQLocalTransactionListener;
import org.apache.rocketmq.spring.core.RocketMQLocalTransactionState;
+
import org.springframework.messaging.Message;
/**
* @author Jim
*/
-@RocketMQTransactionListener(txProducerGroup = "myTxProducerGroup", corePoolSize = 5, maximumPoolSize = 10)
+@RocketMQTransactionListener(txProducerGroup = "myTxProducerGroup", corePoolSize = 5,
+ maximumPoolSize = 10)
public class TransactionListenerImpl implements RocketMQLocalTransactionListener {
+
@Override
public RocketMQLocalTransactionState executeLocalTransaction(Message msg,
Object arg) {
@@ -51,4 +54,5 @@ public class TransactionListenerImpl implements RocketMQLocalTransactionListener
System.out.println("check: " + new String((byte[]) msg.getPayload()));
return RocketMQLocalTransactionState.COMMIT;
}
-}
\ No newline at end of file
+
+}
diff --git a/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-produce-example/src/main/resources/application.properties b/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-produce-example/src/main/resources/application.properties
index 562694922..772bf456e 100644
--- a/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-produce-example/src/main/resources/application.properties
+++ b/spring-cloud-alibaba-examples/rocketmq-example/rocketmq-produce-example/src/main/resources/application.properties
@@ -21,4 +21,4 @@ spring.application.name=rocketmq-produce-example
server.port=28081
management.endpoints.web.exposure.include=*
-management.endpoint.health.show-details=always
\ No newline at end of file
+management.endpoint.health.show-details=always
diff --git a/spring-cloud-alibaba-examples/schedulerx-example/schedulerx-simple-task-example/src/main/java/com/alibaba/cloud/examples/HelloController.java b/spring-cloud-alibaba-examples/schedulerx-example/schedulerx-simple-task-example/src/main/java/com/alibaba/cloud/examples/HelloController.java
index 564105025..106c23d0d 100644
--- a/spring-cloud-alibaba-examples/schedulerx-example/schedulerx-simple-task-example/src/main/java/com/alibaba/cloud/examples/HelloController.java
+++ b/spring-cloud-alibaba-examples/schedulerx-example/schedulerx-simple-task-example/src/main/java/com/alibaba/cloud/examples/HelloController.java
@@ -1,11 +1,11 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
diff --git a/spring-cloud-alibaba-examples/schedulerx-example/schedulerx-simple-task-example/src/main/java/com/alibaba/cloud/examples/ScxApplication.java b/spring-cloud-alibaba-examples/schedulerx-example/schedulerx-simple-task-example/src/main/java/com/alibaba/cloud/examples/ScxApplication.java
index fe3d43571..eac0aed11 100644
--- a/spring-cloud-alibaba-examples/schedulerx-example/schedulerx-simple-task-example/src/main/java/com/alibaba/cloud/examples/ScxApplication.java
+++ b/spring-cloud-alibaba-examples/schedulerx-example/schedulerx-simple-task-example/src/main/java/com/alibaba/cloud/examples/ScxApplication.java
@@ -1,11 +1,11 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
diff --git a/spring-cloud-alibaba-examples/schedulerx-example/schedulerx-simple-task-example/src/main/java/com/alibaba/cloud/examples/SimpleTask.java b/spring-cloud-alibaba-examples/schedulerx-example/schedulerx-simple-task-example/src/main/java/com/alibaba/cloud/examples/SimpleTask.java
index 31d0ffa26..720bb67c4 100644
--- a/spring-cloud-alibaba-examples/schedulerx-example/schedulerx-simple-task-example/src/main/java/com/alibaba/cloud/examples/SimpleTask.java
+++ b/spring-cloud-alibaba-examples/schedulerx-example/schedulerx-simple-task-example/src/main/java/com/alibaba/cloud/examples/SimpleTask.java
@@ -1,11 +1,11 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,12 +16,12 @@
package com.alibaba.cloud.examples;
-import org.springframework.beans.factory.annotation.Autowired;
-
import com.alibaba.edas.schedulerx.ProcessResult;
import com.alibaba.edas.schedulerx.ScxSimpleJobContext;
import com.alibaba.edas.schedulerx.ScxSimpleJobProcessor;
+import org.springframework.beans.factory.annotation.Autowired;
+
/**
* @author xiaolongzuo
*/
diff --git a/spring-cloud-alibaba-examples/schedulerx-example/schedulerx-simple-task-example/src/main/java/com/alibaba/cloud/examples/TestController.java b/spring-cloud-alibaba-examples/schedulerx-example/schedulerx-simple-task-example/src/main/java/com/alibaba/cloud/examples/TestController.java
index 3230e9b01..7e9291ce8 100644
--- a/spring-cloud-alibaba-examples/schedulerx-example/schedulerx-simple-task-example/src/main/java/com/alibaba/cloud/examples/TestController.java
+++ b/spring-cloud-alibaba-examples/schedulerx-example/schedulerx-simple-task-example/src/main/java/com/alibaba/cloud/examples/TestController.java
@@ -1,11 +1,11 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
diff --git a/spring-cloud-alibaba-examples/schedulerx-example/schedulerx-simple-task-example/src/main/java/com/alibaba/cloud/examples/TestService.java b/spring-cloud-alibaba-examples/schedulerx-example/schedulerx-simple-task-example/src/main/java/com/alibaba/cloud/examples/TestService.java
index 7681b3ada..78abd7921 100644
--- a/spring-cloud-alibaba-examples/schedulerx-example/schedulerx-simple-task-example/src/main/java/com/alibaba/cloud/examples/TestService.java
+++ b/spring-cloud-alibaba-examples/schedulerx-example/schedulerx-simple-task-example/src/main/java/com/alibaba/cloud/examples/TestService.java
@@ -1,11 +1,11 @@
/*
- * Copyright (C) 2018 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -27,4 +27,5 @@ public class TestService {
public void test() {
TestController.atomicInteger.incrementAndGet();
}
+
}
diff --git a/spring-cloud-alibaba-examples/seata-example/account-service/src/main/java/com/alibaba/cloud/examples/AccountApplication.java b/spring-cloud-alibaba-examples/seata-example/account-service/src/main/java/com/alibaba/cloud/examples/AccountApplication.java
index 7d52d74c8..b573b549d 100644
--- a/spring-cloud-alibaba-examples/seata-example/account-service/src/main/java/com/alibaba/cloud/examples/AccountApplication.java
+++ b/spring-cloud-alibaba-examples/seata-example/account-service/src/main/java/com/alibaba/cloud/examples/AccountApplication.java
@@ -1,11 +1,11 @@
/*
- * Copyright (C) 2019 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
diff --git a/spring-cloud-alibaba-examples/seata-example/account-service/src/main/java/com/alibaba/cloud/examples/AccountController.java b/spring-cloud-alibaba-examples/seata-example/account-service/src/main/java/com/alibaba/cloud/examples/AccountController.java
index dda69ec73..903b52f68 100644
--- a/spring-cloud-alibaba-examples/seata-example/account-service/src/main/java/com/alibaba/cloud/examples/AccountController.java
+++ b/spring-cloud-alibaba-examples/seata-example/account-service/src/main/java/com/alibaba/cloud/examples/AccountController.java
@@ -1,11 +1,11 @@
/*
- * Copyright (C) 2019 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -13,20 +13,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.alibaba.cloud.examples;
import java.util.Random;
+import io.seata.core.context.RootContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
-import io.seata.core.context.RootContext;
-
/**
* @author xiaojing
*/
@@ -36,9 +35,11 @@ public class AccountController {
private static final Logger LOGGER = LoggerFactory.getLogger(AccountController.class);
private static final String SUCCESS = "SUCCESS";
+
private static final String FAIL = "FAIL";
private final JdbcTemplate jdbcTemplate;
+
private Random random;
public AccountController(JdbcTemplate jdbcTemplate) {
diff --git a/spring-cloud-alibaba-examples/seata-example/account-service/src/main/java/com/alibaba/cloud/examples/DatabaseConfiguration.java b/spring-cloud-alibaba-examples/seata-example/account-service/src/main/java/com/alibaba/cloud/examples/DatabaseConfiguration.java
index f22071bbb..624bf47b8 100644
--- a/spring-cloud-alibaba-examples/seata-example/account-service/src/main/java/com/alibaba/cloud/examples/DatabaseConfiguration.java
+++ b/spring-cloud-alibaba-examples/seata-example/account-service/src/main/java/com/alibaba/cloud/examples/DatabaseConfiguration.java
@@ -1,11 +1,11 @@
/*
- * Copyright (C) 2019 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -13,20 +13,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.alibaba.cloud.examples;
import java.sql.SQLException;
+import com.alibaba.druid.pool.DruidDataSource;
+import io.seata.rm.datasource.DataSourceProxy;
+
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.jdbc.core.JdbcTemplate;
-import com.alibaba.druid.pool.DruidDataSource;
-
-import io.seata.rm.datasource.DataSourceProxy;
-
/**
* @author xiaojing
*/
diff --git a/spring-cloud-alibaba-examples/seata-example/account-service/src/main/resources/application.properties b/spring-cloud-alibaba-examples/seata-example/account-service/src/main/resources/application.properties
index 68b91d012..8884c924d 100644
--- a/spring-cloud-alibaba-examples/seata-example/account-service/src/main/resources/application.properties
+++ b/spring-cloud-alibaba-examples/seata-example/account-service/src/main/resources/application.properties
@@ -6,4 +6,4 @@ mysql.server.port=3306
mysql.db.name=demo
mysql.user.name=root
-mysql.user.password=123456
\ No newline at end of file
+mysql.user.password=123456
diff --git a/spring-cloud-alibaba-examples/seata-example/business-service/src/main/java/com/alibaba/cloud/examples/BusinessApplication.java b/spring-cloud-alibaba-examples/seata-example/business-service/src/main/java/com/alibaba/cloud/examples/BusinessApplication.java
index b79a530e3..b130d13d5 100644
--- a/spring-cloud-alibaba-examples/seata-example/business-service/src/main/java/com/alibaba/cloud/examples/BusinessApplication.java
+++ b/spring-cloud-alibaba-examples/seata-example/business-service/src/main/java/com/alibaba/cloud/examples/BusinessApplication.java
@@ -1,11 +1,11 @@
/*
- * Copyright (C) 2019 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -23,7 +23,6 @@ import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.client.RestTemplate;
@@ -61,4 +60,5 @@ public class BusinessApplication {
@RequestParam("orderCount") int orderCount);
}
+
}
diff --git a/spring-cloud-alibaba-examples/seata-example/business-service/src/main/java/com/alibaba/cloud/examples/HomeController.java b/spring-cloud-alibaba-examples/seata-example/business-service/src/main/java/com/alibaba/cloud/examples/HomeController.java
index 0aa32fa3a..2b671552a 100644
--- a/spring-cloud-alibaba-examples/seata-example/business-service/src/main/java/com/alibaba/cloud/examples/HomeController.java
+++ b/spring-cloud-alibaba-examples/seata-example/business-service/src/main/java/com/alibaba/cloud/examples/HomeController.java
@@ -1,11 +1,11 @@
/*
- * Copyright (C) 2019 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,8 +16,12 @@
package com.alibaba.cloud.examples;
+import com.alibaba.cloud.examples.BusinessApplication.OrderService;
+import com.alibaba.cloud.examples.BusinessApplication.StorageService;
+import io.seata.spring.annotation.GlobalTransactional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
@@ -25,16 +29,9 @@ import org.springframework.http.ResponseEntity;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
-import com.alibaba.cloud.examples.BusinessApplication.OrderService;
-import com.alibaba.cloud.examples.BusinessApplication.StorageService;
-
-import io.seata.spring.annotation.GlobalTransactional;
-
/**
* @author xiaojing
*/
@@ -44,13 +41,19 @@ public class HomeController {
private static final Logger LOGGER = LoggerFactory.getLogger(HomeController.class);
private static final String SUCCESS = "SUCCESS";
+
private static final String FAIL = "FAIL";
+
private static final String USER_ID = "U100001";
+
private static final String COMMODITY_CODE = "C00321";
+
private static final int ORDER_COUNT = 2;
private final RestTemplate restTemplate;
+
private final OrderService orderService;
+
private final StorageService storageService;
public HomeController(RestTemplate restTemplate, OrderService orderService,
diff --git a/spring-cloud-alibaba-examples/seata-example/business-service/src/main/java/com/alibaba/cloud/examples/Order.java b/spring-cloud-alibaba-examples/seata-example/business-service/src/main/java/com/alibaba/cloud/examples/Order.java
index 54ff8a0c1..06ecbde48 100644
--- a/spring-cloud-alibaba-examples/seata-example/business-service/src/main/java/com/alibaba/cloud/examples/Order.java
+++ b/spring-cloud-alibaba-examples/seata-example/business-service/src/main/java/com/alibaba/cloud/examples/Order.java
@@ -1,11 +1,11 @@
/*
- * Copyright (C) 2019 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -19,10 +19,15 @@ package com.alibaba.cloud.examples;
import java.io.Serializable;
public class Order implements Serializable {
+
public long id;
+
public String userId;
+
public String commodityCode;
+
public int count;
+
public int money;
@Override
@@ -30,4 +35,5 @@ public class Order implements Serializable {
return "Order{" + "id=" + id + ", userId='" + userId + '\'' + ", commodityCode='"
+ commodityCode + '\'' + ", count=" + count + ", money=" + money + '}';
}
+
}
diff --git a/spring-cloud-alibaba-examples/seata-example/business-service/src/main/resources/application.properties b/spring-cloud-alibaba-examples/seata-example/business-service/src/main/resources/application.properties
index 75ed92904..9ac7ad4d4 100644
--- a/spring-cloud-alibaba-examples/seata-example/business-service/src/main/resources/application.properties
+++ b/spring-cloud-alibaba-examples/seata-example/business-service/src/main/resources/application.properties
@@ -5,4 +5,4 @@ spring.application.name=business-service
#feign.hystrix.enabled=true
#feign.sentinel.enabled=true
-logging.level.io.seata=debug
\ No newline at end of file
+logging.level.io.seata=debug
diff --git a/spring-cloud-alibaba-examples/seata-example/order-service/src/main/java/com/alibaba/cloud/examples/DatabaseConfiguration.java b/spring-cloud-alibaba-examples/seata-example/order-service/src/main/java/com/alibaba/cloud/examples/DatabaseConfiguration.java
index e3a260e26..cd83beec6 100644
--- a/spring-cloud-alibaba-examples/seata-example/order-service/src/main/java/com/alibaba/cloud/examples/DatabaseConfiguration.java
+++ b/spring-cloud-alibaba-examples/seata-example/order-service/src/main/java/com/alibaba/cloud/examples/DatabaseConfiguration.java
@@ -1,11 +1,11 @@
/*
- * Copyright (C) 2019 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -13,20 +13,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.alibaba.cloud.examples;
import java.sql.SQLException;
+import com.alibaba.druid.pool.DruidDataSource;
+import io.seata.rm.datasource.DataSourceProxy;
+
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.jdbc.core.JdbcTemplate;
-import com.alibaba.druid.pool.DruidDataSource;
-
-import io.seata.rm.datasource.DataSourceProxy;
-
/**
* @author xiaojing
*/
diff --git a/spring-cloud-alibaba-examples/seata-example/order-service/src/main/java/com/alibaba/cloud/examples/OderApplication.java b/spring-cloud-alibaba-examples/seata-example/order-service/src/main/java/com/alibaba/cloud/examples/OderApplication.java
index 9bd64f514..b1233273f 100644
--- a/spring-cloud-alibaba-examples/seata-example/order-service/src/main/java/com/alibaba/cloud/examples/OderApplication.java
+++ b/spring-cloud-alibaba-examples/seata-example/order-service/src/main/java/com/alibaba/cloud/examples/OderApplication.java
@@ -1,11 +1,11 @@
/*
- * Copyright (C) 2019 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
diff --git a/spring-cloud-alibaba-examples/seata-example/order-service/src/main/java/com/alibaba/cloud/examples/Order.java b/spring-cloud-alibaba-examples/seata-example/order-service/src/main/java/com/alibaba/cloud/examples/Order.java
index 54ff8a0c1..06ecbde48 100644
--- a/spring-cloud-alibaba-examples/seata-example/order-service/src/main/java/com/alibaba/cloud/examples/Order.java
+++ b/spring-cloud-alibaba-examples/seata-example/order-service/src/main/java/com/alibaba/cloud/examples/Order.java
@@ -1,11 +1,11 @@
/*
- * Copyright (C) 2019 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -19,10 +19,15 @@ package com.alibaba.cloud.examples;
import java.io.Serializable;
public class Order implements Serializable {
+
public long id;
+
public String userId;
+
public String commodityCode;
+
public int count;
+
public int money;
@Override
@@ -30,4 +35,5 @@ public class Order implements Serializable {
return "Order{" + "id=" + id + ", userId='" + userId + '\'' + ", commodityCode='"
+ commodityCode + '\'' + ", count=" + count + ", money=" + money + '}';
}
+
}
diff --git a/spring-cloud-alibaba-examples/seata-example/order-service/src/main/java/com/alibaba/cloud/examples/OrderController.java b/spring-cloud-alibaba-examples/seata-example/order-service/src/main/java/com/alibaba/cloud/examples/OrderController.java
index d2cf5c398..1aba194da 100644
--- a/spring-cloud-alibaba-examples/seata-example/order-service/src/main/java/com/alibaba/cloud/examples/OrderController.java
+++ b/spring-cloud-alibaba-examples/seata-example/order-service/src/main/java/com/alibaba/cloud/examples/OrderController.java
@@ -1,11 +1,11 @@
/*
- * Copyright (C) 2019 the original author or authors.
+ * Copyright 2013-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -21,8 +21,10 @@ import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.Random;
+import io.seata.core.context.RootContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
@@ -34,13 +36,9 @@ import org.springframework.jdbc.support.KeyHolder;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
-import io.seata.core.context.RootContext;
-
/**
* @author xiaojing
*/
@@ -48,13 +46,19 @@ import io.seata.core.context.RootContext;
public class OrderController {
private static final Logger LOGGER = LoggerFactory.getLogger(OrderController.class);
+
private static final String SUCCESS = "SUCCESS";
+
private static final String FAIL = "FAIL";
+
private static final String USER_ID = "U100001";
+
private static final String COMMODITY_CODE = "C00321";
private final JdbcTemplate jdbcTemplate;
+
private final RestTemplate restTemplate;
+
private Random random;
public OrderController(JdbcTemplate jdbcTemplate, RestTemplate restTemplate) {
@@ -129,4 +133,5 @@ public class OrderController {
ResponseEntity>() {
});
}
+
}
diff --git a/spring-cloud-alibaba-examples/sentinel-example/sentinel-core-example/src/main/java/com/alibaba/cloud/examples/ServiceApplication.java b/spring-cloud-alibaba-examples/sentinel-example/sentinel-core-example/src/main/java/com/alibaba/cloud/examples/ServiceApplication.java
index 7dea70eef..17121bd9c 100644
--- a/spring-cloud-alibaba-examples/sentinel-example/sentinel-core-example/src/main/java/com/alibaba/cloud/examples/ServiceApplication.java
+++ b/spring-cloud-alibaba-examples/sentinel-example/sentinel-core-example/src/main/java/com/alibaba/cloud/examples/ServiceApplication.java
@@ -1,13 +1,29 @@
+/*
+ * Copyright 2013-2018 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package com.alibaba.cloud.examples;
+import com.alibaba.cloud.sentinel.annotation.SentinelRestTemplate;
+import com.alibaba.csp.sentinel.datasource.Converter;
+
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;
-import com.alibaba.cloud.sentinel.annotation.SentinelRestTemplate;
-import com.alibaba.csp.sentinel.datasource.Converter;
-
/**
* @author xiaojing
*/
@@ -15,7 +31,8 @@ import com.alibaba.csp.sentinel.datasource.Converter;
public class ServiceApplication {
@Bean
- @SentinelRestTemplate(blockHandler = "handleException", blockHandlerClass = ExceptionUtil.class)
+ @SentinelRestTemplate(blockHandler = "handleException",
+ blockHandlerClass = ExceptionUtil.class)
public RestTemplate restTemplate() {
return new RestTemplate();
}
diff --git a/spring-cloud-alibaba-examples/sentinel-example/sentinel-core-example/src/main/java/com/alibaba/cloud/examples/TestController.java b/spring-cloud-alibaba-examples/sentinel-example/sentinel-core-example/src/main/java/com/alibaba/cloud/examples/TestController.java
index 825fe6c89..1e7a909d9 100644
--- a/spring-cloud-alibaba-examples/sentinel-example/sentinel-core-example/src/main/java/com/alibaba/cloud/examples/TestController.java
+++ b/spring-cloud-alibaba-examples/sentinel-example/sentinel-core-example/src/main/java/com/alibaba/cloud/examples/TestController.java
@@ -1,14 +1,28 @@
+/*
+ * Copyright 2013-2018 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package com.alibaba.cloud.examples;
+import com.alibaba.csp.sentinel.annotation.SentinelResource;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
-import com.alibaba.csp.sentinel.annotation.SentinelResource;
-
/**
* @author xiaojing
*/
@@ -18,24 +32,24 @@ public class TestController {
@Autowired
private RestTemplate restTemplate;
- @GetMapping(value = "/hello")
+ @GetMapping("/hello")
@SentinelResource("resource")
public String hello() {
return "Hello";
}
- @GetMapping(value = "/aa")
+ @GetMapping("/aa")
@SentinelResource("aa")
public String aa(int b, int a) {
return "Hello test";
}
- @GetMapping(value = "/test")
+ @GetMapping("/test")
public String test1() {
return "Hello test";
}
- @GetMapping(value = "/template")
+ @GetMapping("/template")
public String client() {
return restTemplate.getForObject("http://www.taobao.com/test", String.class);
}
diff --git a/spring-cloud-alibaba-examples/sentinel-example/sentinel-dubbo-example/sentinel-dubbo-api/src/main/java/com/alibaba/cloud/examples/FooService.java b/spring-cloud-alibaba-examples/sentinel-example/sentinel-dubbo-example/sentinel-dubbo-api/src/main/java/com/alibaba/cloud/examples/FooService.java
index 65f71bb81..aa9006f6a 100644
--- a/spring-cloud-alibaba-examples/sentinel-example/sentinel-dubbo-example/sentinel-dubbo-api/src/main/java/com/alibaba/cloud/examples/FooService.java
+++ b/spring-cloud-alibaba-examples/sentinel-example/sentinel-dubbo-example/sentinel-dubbo-api/src/main/java/com/alibaba/cloud/examples/FooService.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2013-2018 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package com.alibaba.cloud.examples;
/**
diff --git a/spring-cloud-alibaba-examples/sentinel-example/sentinel-dubbo-example/sentinel-dubbo-consumer-example/src/main/java/com/alibaba/cloud/examples/FooServiceConsumer.java b/spring-cloud-alibaba-examples/sentinel-example/sentinel-dubbo-example/sentinel-dubbo-consumer-example/src/main/java/com/alibaba/cloud/examples/FooServiceConsumer.java
index 48c03b86a..c92f0bf10 100644
--- a/spring-cloud-alibaba-examples/sentinel-example/sentinel-dubbo-example/sentinel-dubbo-consumer-example/src/main/java/com/alibaba/cloud/examples/FooServiceConsumer.java
+++ b/spring-cloud-alibaba-examples/sentinel-example/sentinel-dubbo-example/sentinel-dubbo-consumer-example/src/main/java/com/alibaba/cloud/examples/FooServiceConsumer.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2013-2018 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package com.alibaba.cloud.examples;
import org.apache.dubbo.config.annotation.Reference;
@@ -7,7 +23,9 @@ import org.apache.dubbo.config.annotation.Reference;
*/
public class FooServiceConsumer {
- @Reference(version = "${foo.service.version}", application = "${dubbo.application.id}", url = "dubbo://localhost:12345?version=1.0.0", timeout = 30000)
+ @Reference(version = "${foo.service.version}",
+ application = "${dubbo.application.id}",
+ url = "dubbo://localhost:12345?version=1.0.0", timeout = 30000)
private FooService fooService;
public String hello(String name) {
diff --git a/spring-cloud-alibaba-examples/sentinel-example/sentinel-dubbo-example/sentinel-dubbo-consumer-example/src/main/java/com/alibaba/cloud/examples/SentinelDubboConsumerApp.java b/spring-cloud-alibaba-examples/sentinel-example/sentinel-dubbo-example/sentinel-dubbo-consumer-example/src/main/java/com/alibaba/cloud/examples/SentinelDubboConsumerApp.java
index bb62527f8..0c6c1932d 100644
--- a/spring-cloud-alibaba-examples/sentinel-example/sentinel-dubbo-example/sentinel-dubbo-consumer-example/src/main/java/com/alibaba/cloud/examples/SentinelDubboConsumerApp.java
+++ b/spring-cloud-alibaba-examples/sentinel-example/sentinel-dubbo-example/sentinel-dubbo-consumer-example/src/main/java/com/alibaba/cloud/examples/SentinelDubboConsumerApp.java
@@ -1,18 +1,34 @@
+/*
+ * Copyright 2013-2018 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package com.alibaba.cloud.examples;
import java.util.Collections;
+import com.alibaba.csp.sentinel.slots.block.RuleConstant;
+import com.alibaba.csp.sentinel.slots.block.SentinelRpcException;
+import com.alibaba.csp.sentinel.slots.block.flow.FlowRule;
+import com.alibaba.csp.sentinel.slots.block.flow.FlowRuleManager;
+
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
-import com.alibaba.csp.sentinel.slots.block.RuleConstant;
-import com.alibaba.csp.sentinel.slots.block.SentinelRpcException;
-import com.alibaba.csp.sentinel.slots.block.flow.FlowRule;
-import com.alibaba.csp.sentinel.slots.block.flow.FlowRuleManager;
-
/**
* @author fangjian
*/
@@ -27,7 +43,8 @@ public class SentinelDubboConsumerApp {
public static void main(String[] args) {
FlowRule flowRule = new FlowRule();
- flowRule.setResource("com.alibaba.cloud.examples.FooService:hello(java.lang.String)");
+ flowRule.setResource(
+ "com.alibaba.cloud.examples.FooService:hello(java.lang.String)");
flowRule.setCount(10);
flowRule.setGrade(RuleConstant.FLOW_GRADE_QPS);
flowRule.setLimitApp("default");
diff --git a/spring-cloud-alibaba-examples/sentinel-example/sentinel-dubbo-example/sentinel-dubbo-provider-example/src/main/java/com/alibaba/cloud/examples/FooServiceImpl.java b/spring-cloud-alibaba-examples/sentinel-example/sentinel-dubbo-example/sentinel-dubbo-provider-example/src/main/java/com/alibaba/cloud/examples/FooServiceImpl.java
index 041627d46..0d280ee8b 100644
--- a/spring-cloud-alibaba-examples/sentinel-example/sentinel-dubbo-example/sentinel-dubbo-provider-example/src/main/java/com/alibaba/cloud/examples/FooServiceImpl.java
+++ b/spring-cloud-alibaba-examples/sentinel-example/sentinel-dubbo-example/sentinel-dubbo-provider-example/src/main/java/com/alibaba/cloud/examples/FooServiceImpl.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2013-2018 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package com.alibaba.cloud.examples;
import org.apache.dubbo.config.annotation.Service;
@@ -5,11 +21,13 @@ import org.apache.dubbo.config.annotation.Service;
/**
* @author fangjian
*/
-@Service(version = "${foo.service.version}", application = "${dubbo.application.id}", protocol = "${dubbo.protocol.id}", registry = "${dubbo.registry.id}")
+@Service(version = "${foo.service.version}", application = "${dubbo.application.id}",
+ protocol = "${dubbo.protocol.id}", registry = "${dubbo.registry.id}")
public class FooServiceImpl implements FooService {
@Override
public String hello(String name) {
return "hello, " + name;
}
-}
\ No newline at end of file
+
+}
diff --git a/spring-cloud-alibaba-examples/sentinel-example/sentinel-dubbo-example/sentinel-dubbo-provider-example/src/main/java/com/alibaba/cloud/examples/SentinelDubboProviderApp.java b/spring-cloud-alibaba-examples/sentinel-example/sentinel-dubbo-example/sentinel-dubbo-provider-example/src/main/java/com/alibaba/cloud/examples/SentinelDubboProviderApp.java
index ac4f78381..a322601d0 100644
--- a/spring-cloud-alibaba-examples/sentinel-example/sentinel-dubbo-example/sentinel-dubbo-provider-example/src/main/java/com/alibaba/cloud/examples/SentinelDubboProviderApp.java
+++ b/spring-cloud-alibaba-examples/sentinel-example/sentinel-dubbo-example/sentinel-dubbo-provider-example/src/main/java/com/alibaba/cloud/examples/SentinelDubboProviderApp.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2013-2018 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package com.alibaba.cloud.examples;
import org.springframework.boot.WebApplicationType;
diff --git a/spring-cloud-alibaba-examples/sentinel-example/sentinel-feign-example/sentinel-feign-consumer-example/src/main/java/com/alibaba/cloud/examples/ConsumerApplication.java b/spring-cloud-alibaba-examples/sentinel-example/sentinel-feign-example/sentinel-feign-consumer-example/src/main/java/com/alibaba/cloud/examples/ConsumerApplication.java
index 952c38980..49b5b2950 100644
--- a/spring-cloud-alibaba-examples/sentinel-example/sentinel-feign-example/sentinel-feign-consumer-example/src/main/java/com/alibaba/cloud/examples/ConsumerApplication.java
+++ b/spring-cloud-alibaba-examples/sentinel-example/sentinel-feign-example/sentinel-feign-consumer-example/src/main/java/com/alibaba/cloud/examples/ConsumerApplication.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2013-2018 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package com.alibaba.cloud.examples;
import org.springframework.boot.SpringApplication;
diff --git a/spring-cloud-alibaba-examples/sentinel-example/sentinel-feign-example/sentinel-feign-consumer-example/src/main/java/com/alibaba/cloud/examples/controller/TestController.java b/spring-cloud-alibaba-examples/sentinel-example/sentinel-feign-example/sentinel-feign-consumer-example/src/main/java/com/alibaba/cloud/examples/controller/TestController.java
index f90fe1077..209439ab2 100644
--- a/spring-cloud-alibaba-examples/sentinel-example/sentinel-feign-example/sentinel-feign-consumer-example/src/main/java/com/alibaba/cloud/examples/controller/TestController.java
+++ b/spring-cloud-alibaba-examples/sentinel-example/sentinel-feign-example/sentinel-feign-consumer-example/src/main/java/com/alibaba/cloud/examples/controller/TestController.java
@@ -1,6 +1,23 @@
+/*
+ * Copyright 2013-2018 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package com.alibaba.cloud.examples.controller;
import com.alibaba.cloud.examples.service.EchoService;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@@ -12,12 +29,12 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
public class TestController {
- @Autowired
- private EchoService echoService;
+ @Autowired
+ private EchoService echoService;
- @GetMapping(value = "/echo-feign/{str}")
- public String feign(@PathVariable String str) {
- return echoService.echo(str);
- }
+ @GetMapping("/echo-feign/{str}")
+ public String feign(@PathVariable String str) {
+ return echoService.echo(str);
+ }
}
diff --git a/spring-cloud-alibaba-examples/sentinel-example/sentinel-feign-example/sentinel-feign-consumer-example/src/main/java/com/alibaba/cloud/examples/fallback/EchoServiceFallback.java b/spring-cloud-alibaba-examples/sentinel-example/sentinel-feign-example/sentinel-feign-consumer-example/src/main/java/com/alibaba/cloud/examples/fallback/EchoServiceFallback.java
index 6d4fd77de..3b3afc007 100644
--- a/spring-cloud-alibaba-examples/sentinel-example/sentinel-feign-example/sentinel-feign-consumer-example/src/main/java/com/alibaba/cloud/examples/fallback/EchoServiceFallback.java
+++ b/spring-cloud-alibaba-examples/sentinel-example/sentinel-feign-example/sentinel-feign-consumer-example/src/main/java/com/alibaba/cloud/examples/fallback/EchoServiceFallback.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2013-2018 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package com.alibaba.cloud.examples.fallback;
import com.alibaba.cloud.examples.service.EchoService;
@@ -9,20 +25,21 @@ import com.alibaba.cloud.examples.service.EchoService;
* sentinel 降级处理
*/
public class EchoServiceFallback implements EchoService {
- private Throwable throwable;
- EchoServiceFallback(Throwable throwable) {
- this.throwable = throwable;
- }
+ private Throwable throwable;
+
+ EchoServiceFallback(Throwable throwable) {
+ this.throwable = throwable;
+ }
+
+ /**
+ * 调用服务提供方的输出接口
+ * @param str 用户输入
+ * @return
+ */
+ @Override
+ public String echo(String str) {
+ return "consumer-fallback-default-str" + throwable.getMessage();
+ }
- /**
- * 调用服务提供方的输出接口
- *
- * @param str 用户输入
- * @return
- */
- @Override
- public String echo(String str) {
- return "consumer-fallback-default-str" + throwable.getMessage();
- }
}
diff --git a/spring-cloud-alibaba-examples/sentinel-example/sentinel-feign-example/sentinel-feign-consumer-example/src/main/java/com/alibaba/cloud/examples/fallback/EchoServiceFallbackFactory.java b/spring-cloud-alibaba-examples/sentinel-example/sentinel-feign-example/sentinel-feign-consumer-example/src/main/java/com/alibaba/cloud/examples/fallback/EchoServiceFallbackFactory.java
index 6d33d7136..94366678f 100644
--- a/spring-cloud-alibaba-examples/sentinel-example/sentinel-feign-example/sentinel-feign-consumer-example/src/main/java/com/alibaba/cloud/examples/fallback/EchoServiceFallbackFactory.java
+++ b/spring-cloud-alibaba-examples/sentinel-example/sentinel-feign-example/sentinel-feign-consumer-example/src/main/java/com/alibaba/cloud/examples/fallback/EchoServiceFallbackFactory.java
@@ -1,6 +1,23 @@
+/*
+ * Copyright 2013-2018 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package com.alibaba.cloud.examples.fallback;
import feign.hystrix.FallbackFactory;
+
import org.springframework.stereotype.Component;
/**
@@ -9,8 +26,10 @@ import org.springframework.stereotype.Component;
*/
@Component
public class EchoServiceFallbackFactory implements FallbackFactory
>(builder.build(), ruleKey, channel,
+ converter);
+ }
+
+ @Override
+ public Class> getObjectType() {
+ return RedisDataSource.class;
+ }
+
+ public Converter getConverter() {
+ return converter;
+ }
+
+ public void setConverter(Converter converter) {
+ this.converter = converter;
+ }
+
+ public String getHost() {
+ return host;
+ }
+
+ public void setHost(String host) {
+ this.host = host;
+ }
+
+ public int getPort() {
+ return port;
+ }
+
+ public void setPort(int port) {
+ this.port = port;
+ }
+
+ public String getRuleKey() {
+ return ruleKey;
+ }
+
+ public void setRuleKey(String ruleKey) {
+ this.ruleKey = ruleKey;
+ }
+
+ public String getChannel() {
+ return channel;
+ }
+
+ public void setChannel(String channel) {
+ this.channel = channel;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public int getDatabase() {
+ return database;
+ }
+
+ public void setDatabase(int database) {
+ this.database = database;
+ }
+
+ public Duration getTimeout() {
+ return timeout;
+ }
+
+ public void setTimeout(Duration timeout) {
+ this.timeout = timeout;
+ }
+
+ public List
>(builder.build(), ruleKey, channel, converter);
- }
-
- @Override
- public Class> getObjectType() {
- return RedisDataSource.class;
- }
-
- public Converter getConverter() {
- return converter;
- }
-
- public void setConverter(Converter converter) {
- this.converter = converter;
- }
-
- public String getHost() {
- return host;
- }
-
- public void setHost(String host) {
- this.host = host;
- }
-
- public int getPort() {
- return port;
- }
-
- public void setPort(int port) {
- this.port = port;
- }
-
- public String getRuleKey() {
- return ruleKey;
- }
-
- public void setRuleKey(String ruleKey) {
- this.ruleKey = ruleKey;
- }
-
- public String getChannel() {
- return channel;
- }
-
- public void setChannel(String channel) {
- this.channel = channel;
- }
-
- public String getPassword() {
- return password;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
-
- public int getDatabase() {
- return database;
- }
-
- public void setDatabase(int database) {
- this.database = database;
- }
-
- public Duration getTimeout() {
- return timeout;
- }
-
- public void setTimeout(Duration timeout) {
- this.timeout = timeout;
- }
-
- public List