fabric8 configuration
diff --git a/pom.xml b/pom.xml
index d644b72..64cc54c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -25,7 +25,7 @@
<tomcat.version>7.0.59</tomcat.version>
<docker.assemblyDescriptorRef>artifact</docker.assemblyDescriptorRef>
<docker.from>docker.io/fabric8/java-jboss-openjdk8-jdk:1.0.10</docker.from>
- <docker.image>weipeng2k/${project.artifactId}:${project.version}</docker.image>
+ <docker.image>dubboteam/${project.artifactId}:${project.version}</docker.image>
<docker.port.container.http>8080</docker.port.container.http>
<docker.port.container.jolokia>8778</docker.port.container.jolokia>
<fabric8.iconRef>icons/spring-boot</fabric8.iconRef>
@@ -54,7 +54,7 @@
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>dubbo</artifactId>
- <version>2.5.5</version>
+ <version>2.5.6-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>org.javassist</groupId>
@@ -82,9 +82,42 @@
<artifactId>tomcat-juli</artifactId>
<version>${tomcat.version}</version>
</dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.12</version>
+ </dependency>
</dependencies>
+ <profiles>
+ <profile>
+ <id>f8-build</id>
+ <build>
+ <defaultGoal>clean install docker:build fabric8:json</defaultGoal>
+ </build>
+ </profile>
+ <profile>
+ <id>f8-deploy</id>
+ <build>
+ <defaultGoal>clean install docker:build docker:push fabric8:json fabric8:apply</defaultGoal>
+ </build>
+ <properties>
+ <fabric8.recreate>true</fabric8.recreate>
+ <fabric8.imagePullPolicySnapshot>Always</fabric8.imagePullPolicySnapshot>
+ </properties>
+ </profile>
+ <profile>
+ <id>f8-local-deploy</id>
+ <build>
+ <defaultGoal>clean install docker:build fabric8:json fabric8:apply</defaultGoal>
+ </build>
+ <properties>
+ <fabric8.recreate>true</fabric8.recreate>
+ </properties>
+ </profile>
+ </profiles>
+
<build>
<plugins>
<plugin>
diff --git a/src/main/java/com/alibaba/dubbo/config/spring/AnnotationBean.java b/src/main/java/com/alibaba/dubbo/config/spring/AnnotationBean.java
deleted file mode 100644
index 0d2c32f..0000000
--- a/src/main/java/com/alibaba/dubbo/config/spring/AnnotationBean.java
+++ /dev/null
@@ -1,313 +0,0 @@
-/*
- * Copyright 1999-2012 Alibaba Group.
- *
- * 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
- *
- * 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.dubbo.config.spring;
-
-import com.alibaba.dubbo.common.Constants;
-import com.alibaba.dubbo.common.logger.Logger;
-import com.alibaba.dubbo.common.logger.LoggerFactory;
-import com.alibaba.dubbo.common.utils.ConcurrentHashSet;
-import com.alibaba.dubbo.common.utils.ReflectUtils;
-import com.alibaba.dubbo.config.AbstractConfig;
-import com.alibaba.dubbo.config.ApplicationConfig;
-import com.alibaba.dubbo.config.ConsumerConfig;
-import com.alibaba.dubbo.config.ModuleConfig;
-import com.alibaba.dubbo.config.MonitorConfig;
-import com.alibaba.dubbo.config.ProtocolConfig;
-import com.alibaba.dubbo.config.ProviderConfig;
-import com.alibaba.dubbo.config.ReferenceConfig;
-import com.alibaba.dubbo.config.RegistryConfig;
-import com.alibaba.dubbo.config.ServiceConfig;
-import com.alibaba.dubbo.config.annotation.Reference;
-import com.alibaba.dubbo.config.annotation.Service;
-
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.DisposableBean;
-import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
-import org.springframework.beans.factory.config.BeanPostProcessor;
-import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
-import org.springframework.beans.factory.support.BeanDefinitionRegistry;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-/**
- * AnnotationBean
- *
- * @author william.liangf
- * @export
- */
-public class AnnotationBean extends AbstractConfig implements DisposableBean, BeanFactoryPostProcessor, BeanPostProcessor, ApplicationContextAware {
-
- private static final long serialVersionUID = -7582802454287589552L;
-
- private static final Logger logger = LoggerFactory.getLogger(Logger.class);
- private final Set<ServiceConfig<?>> serviceConfigs = new ConcurrentHashSet<ServiceConfig<?>>();
- private final ConcurrentMap<String, ReferenceBean<?>> referenceConfigs = new ConcurrentHashMap<String, ReferenceBean<?>>();
- private String annotationPackage;
- private String[] annotationPackages;
- private ApplicationContext applicationContext;
-
- public String getPackage() {
- return annotationPackage;
- }
-
- public void setPackage(String annotationPackage) {
- this.annotationPackage = annotationPackage;
- this.annotationPackages = (annotationPackage == null || annotationPackage.length() == 0) ? null
- : Constants.COMMA_SPLIT_PATTERN.split(annotationPackage);
- }
-
- public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
- this.applicationContext = applicationContext;
- }
-
- public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
- throws BeansException {
- if (annotationPackage == null || annotationPackage.length() == 0) {
- return;
- }
- if (beanFactory instanceof BeanDefinitionRegistry) {
- try {
- // init scanner
- Class<?> scannerClass = ReflectUtils.forName("org.springframework.context.annotation.ClassPathBeanDefinitionScanner");
- Object scanner = scannerClass.getConstructor(new Class<?>[]{BeanDefinitionRegistry.class, boolean.class}).newInstance(new Object[]{(BeanDefinitionRegistry) beanFactory, true});
- // add filter
- Class<?> filterClass = ReflectUtils.forName("org.springframework.core.type.filter.AnnotationTypeFilter");
- Object filter = filterClass.getConstructor(Class.class).newInstance(Service.class);
- Method addIncludeFilter = scannerClass.getMethod("addIncludeFilter", ReflectUtils.forName("org.springframework.core.type.filter.TypeFilter"));
- addIncludeFilter.invoke(scanner, filter);
- // scan packages
- String[] packages = Constants.COMMA_SPLIT_PATTERN.split(annotationPackage);
- Method scan = scannerClass.getMethod("scan", new Class<?>[]{String[].class});
- scan.invoke(scanner, new Object[]{packages});
- } catch (Throwable e) {
- // spring 2.0
- }
- }
- }
-
- public void destroy() throws Exception {
- for (ServiceConfig<?> serviceConfig : serviceConfigs) {
- try {
- serviceConfig.unexport();
- } catch (Throwable e) {
- logger.error(e.getMessage(), e);
- }
- }
- for (ReferenceConfig<?> referenceConfig : referenceConfigs.values()) {
- try {
- referenceConfig.destroy();
- } catch (Throwable e) {
- logger.error(e.getMessage(), e);
- }
- }
- }
-
- public Object postProcessAfterInitialization(Object bean, String beanName)
- throws BeansException {
- if (!isMatchPackage(bean)) {
- return bean;
- }
- Service service = bean.getClass().getAnnotation(Service.class);
- if (service != null) {
- ServiceBean<Object> serviceConfig = new ServiceBean<Object>(service);
- if (void.class.equals(service.interfaceClass())
- && "".equals(service.interfaceName())) {
- if (bean.getClass().getInterfaces().length > 0) {
- serviceConfig.setInterface(bean.getClass().getInterfaces()[0]);
- } else {
- throw new IllegalStateException("Failed to export remote service class " + bean.getClass().getName() + ", cause: The @Service undefined interfaceClass or interfaceName, and the service class unimplemented any interfaces.");
- }
- }
- if (applicationContext != null) {
- serviceConfig.setApplicationContext(applicationContext);
- if (service.registry() != null && service.registry().length > 0) {
- List<RegistryConfig> registryConfigs = new ArrayList<RegistryConfig>();
- for (String registryId : service.registry()) {
- if (registryId != null && registryId.length() > 0) {
- registryConfigs.add((RegistryConfig) applicationContext.getBean(registryId, RegistryConfig.class));
- }
- }
- serviceConfig.setRegistries(registryConfigs);
- }
- if (service.provider() != null && service.provider().length() > 0) {
- serviceConfig.setProvider((ProviderConfig) applicationContext.getBean(service.provider(), ProviderConfig.class));
- }
- if (service.monitor() != null && service.monitor().length() > 0) {
- serviceConfig.setMonitor((MonitorConfig) applicationContext.getBean(service.monitor(), MonitorConfig.class));
- }
- if (service.application() != null && service.application().length() > 0) {
- serviceConfig.setApplication((ApplicationConfig) applicationContext.getBean(service.application(), ApplicationConfig.class));
- }
- if (service.module() != null && service.module().length() > 0) {
- serviceConfig.setModule((ModuleConfig) applicationContext.getBean(service.module(), ModuleConfig.class));
- }
- if (service.provider() != null && service.provider().length() > 0) {
- serviceConfig.setProvider((ProviderConfig) applicationContext.getBean(service.provider(), ProviderConfig.class));
- } else {
-
- }
- if (service.protocol() != null && service.protocol().length > 0) {
- List<ProtocolConfig> protocolConfigs = new ArrayList<ProtocolConfig>();
- for (String protocolId : service.registry()) {
- if (protocolId != null && protocolId.length() > 0) {
- protocolConfigs.add((ProtocolConfig) applicationContext.getBean(protocolId, ProtocolConfig.class));
- }
- }
- serviceConfig.setProtocols(protocolConfigs);
- }
- try {
- serviceConfig.afterPropertiesSet();
- } catch (RuntimeException e) {
- throw (RuntimeException) e;
- } catch (Exception e) {
- throw new IllegalStateException(e.getMessage(), e);
- }
- }
- serviceConfig.setRef(bean);
- serviceConfigs.add(serviceConfig);
- serviceConfig.export();
- }
- return bean;
- }
-
- public Object postProcessBeforeInitialization(Object bean, String beanName)
- throws BeansException {
- if (!isMatchPackage(bean)) {
- return bean;
- }
- Method[] methods = bean.getClass().getMethods();
- for (Method method : methods) {
- String name = method.getName();
- if (name.length() > 3 && name.startsWith("set")
- && method.getParameterTypes().length == 1
- && Modifier.isPublic(method.getModifiers())
- && !Modifier.isStatic(method.getModifiers())) {
- try {
- Reference reference = method.getAnnotation(Reference.class);
- if (reference != null) {
- Object value = refer(reference, method.getParameterTypes()[0]);
- if (value != null) {
- method.invoke(bean, new Object[]{value});
- }
- }
- } catch (Throwable e) {
- logger.error("Failed to init remote service reference at method " + name + " in class " + bean.getClass().getName() + ", cause: " + e.getMessage(), e);
- }
- }
- }
- Field[] fields = bean.getClass().getFields();
- for (Field field : fields) {
- try {
- if (!field.isAccessible()) {
- field.setAccessible(true);
- }
- Reference reference = field.getAnnotation(Reference.class);
- if (reference != null) {
- Object value = refer(reference, field.getType());
- if (value != null) {
- field.set(bean, value);
- }
- }
- } catch (Throwable e) {
- logger.error("Failed to init remote service reference at filed " + field.getName() + " in class " + bean.getClass().getName() + ", cause: " + e.getMessage(), e);
- }
- }
- return bean;
- }
-
- private Object refer(Reference reference, Class<?> referenceClass) { //method.getParameterTypes()[0]
- String interfaceName;
- if (!"".equals(reference.interfaceName())) {
- interfaceName = reference.interfaceName();
- } else if (!void.class.equals(reference.interfaceClass())) {
- interfaceName = reference.interfaceClass().getName();
- } else if (referenceClass.isInterface()) {
- interfaceName = referenceClass.getName();
- } else {
- throw new IllegalStateException("The @Reference undefined interfaceClass or interfaceName, and the property type " + referenceClass.getName() + " is not a interface.");
- }
- String key = reference.group() + "/" + interfaceName + ":" + reference.version();
- ReferenceBean<?> referenceConfig = referenceConfigs.get(key);
- if (referenceConfig == null) {
- referenceConfig = new ReferenceBean<Object>(reference);
- if (void.class.equals(reference.interfaceClass())
- && "".equals(reference.interfaceName())
- && referenceClass.isInterface()) {
- referenceConfig.setInterface(referenceClass);
- }
- if (applicationContext != null) {
- referenceConfig.setApplicationContext(applicationContext);
- if (reference.registry() != null && reference.registry().length > 0) {
- List<RegistryConfig> registryConfigs = new ArrayList<RegistryConfig>();
- for (String registryId : reference.registry()) {
- if (registryId != null && registryId.length() > 0) {
- registryConfigs.add((RegistryConfig) applicationContext.getBean(registryId, RegistryConfig.class));
- }
- }
- referenceConfig.setRegistries(registryConfigs);
- }
- if (reference.consumer() != null && reference.consumer().length() > 0) {
- referenceConfig.setConsumer((ConsumerConfig) applicationContext.getBean(reference.consumer(), ConsumerConfig.class));
- }
- if (reference.monitor() != null && reference.monitor().length() > 0) {
- referenceConfig.setMonitor((MonitorConfig) applicationContext.getBean(reference.monitor(), MonitorConfig.class));
- }
- if (reference.application() != null && reference.application().length() > 0) {
- referenceConfig.setApplication((ApplicationConfig) applicationContext.getBean(reference.application(), ApplicationConfig.class));
- }
- if (reference.module() != null && reference.module().length() > 0) {
- referenceConfig.setModule((ModuleConfig) applicationContext.getBean(reference.module(), ModuleConfig.class));
- }
- if (reference.consumer() != null && reference.consumer().length() > 0) {
- referenceConfig.setConsumer((ConsumerConfig) applicationContext.getBean(reference.consumer(), ConsumerConfig.class));
- }
- try {
- referenceConfig.afterPropertiesSet();
- } catch (RuntimeException e) {
- throw (RuntimeException) e;
- } catch (Exception e) {
- throw new IllegalStateException(e.getMessage(), e);
- }
- }
- referenceConfigs.putIfAbsent(key, referenceConfig);
- referenceConfig = referenceConfigs.get(key);
- }
- return referenceConfig.get();
- }
-
- private boolean isMatchPackage(Object bean) {
- if (annotationPackages == null || annotationPackages.length == 0) {
- return true;
- }
- String beanClassName = bean.getClass().getName();
- for (String pkg : annotationPackages) {
- if (beanClassName.startsWith(pkg)) {
- return true;
- }
- }
- return false;
- }
-
-}
diff --git a/src/main/java/com/alibaba/dubbo/test/DubboFeatureTestApplication.java b/src/main/java/com/alibaba/dubbo/test/DubboFeatureTestApplication.java
index 3270ab1..182715a 100644
--- a/src/main/java/com/alibaba/dubbo/test/DubboFeatureTestApplication.java
+++ b/src/main/java/com/alibaba/dubbo/test/DubboFeatureTestApplication.java
@@ -7,7 +7,6 @@
@SpringBootApplication
-@ComponentScan(basePackages = {"com.alibaba.dubbo.test"}, includeFilters = {@ComponentScan.Filter(type = FilterType.ANNOTATION, classes = {com.alibaba.dubbo.config.annotation.Service.class, com.alibaba.dubbo.config.annotation.Reference.class})})
public class DubboFeatureTestApplication {
public static void main(String[] args) throws InterruptedException {
diff --git a/src/main/java/com/alibaba/dubbo/test/conf/DubboConfiguration.java b/src/main/java/com/alibaba/dubbo/test/conf/DubboConfiguration.java
index d48269a..e128426 100644
--- a/src/main/java/com/alibaba/dubbo/test/conf/DubboConfiguration.java
+++ b/src/main/java/com/alibaba/dubbo/test/conf/DubboConfiguration.java
@@ -9,7 +9,7 @@
* Created by ken.lj on 2017/9/10.
*/
@Configuration
-@ImportResource(locations = "classpath:dubbo-${spring.profiles.active}.xml")
+@ImportResource(locations = {"classpath:dubbo-common.xml", "classpath:dubbo-${spring.profiles.active}.xml"})
public class DubboConfiguration {
}
diff --git a/src/main/java/com/alibaba/dubbo/test/dto/Bean.java b/src/main/java/com/alibaba/dubbo/test/dto/Bean.java
new file mode 100644
index 0000000..9ee7832
--- /dev/null
+++ b/src/main/java/com/alibaba/dubbo/test/dto/Bean.java
@@ -0,0 +1,28 @@
+package com.alibaba.dubbo.test.dto;
+
+import java.io.Serializable;
+
+/**
+ * Created by ken.lj on 2017/9/24.
+ */
+public class Bean implements Serializable {
+ private int id;
+
+ private String name;
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
diff --git a/src/main/java/com/alibaba/dubbo/test/service/AsyncService.java b/src/main/java/com/alibaba/dubbo/test/service/AsyncService.java
new file mode 100644
index 0000000..37e3653
--- /dev/null
+++ b/src/main/java/com/alibaba/dubbo/test/service/AsyncService.java
@@ -0,0 +1,7 @@
+package com.alibaba.dubbo.test.service;
+
+/**
+ * Created by ken.lj on 2017/9/24.
+ */
+public interface AsyncService {
+}
diff --git a/src/main/java/com/alibaba/dubbo/test/service/CacheService.java b/src/main/java/com/alibaba/dubbo/test/service/CacheService.java
new file mode 100644
index 0000000..4352f01
--- /dev/null
+++ b/src/main/java/com/alibaba/dubbo/test/service/CacheService.java
@@ -0,0 +1,7 @@
+package com.alibaba.dubbo.test.service;
+
+/**
+ * Created by ken.lj on 2017/9/24.
+ */
+public interface CacheService {
+}
diff --git a/src/main/java/com/alibaba/dubbo/test/service/DemoService.java b/src/main/java/com/alibaba/dubbo/test/service/DemoService.java
new file mode 100644
index 0000000..2c6869e
--- /dev/null
+++ b/src/main/java/com/alibaba/dubbo/test/service/DemoService.java
@@ -0,0 +1,21 @@
+package com.alibaba.dubbo.test.service;
+
+import com.alibaba.dubbo.test.dto.Bean;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created by ken.lj on 2017/9/24.
+ */
+public interface DemoService {
+ String testString(String str);
+
+ boolean testPojo(Bean bean);
+
+ boolean testList(List<Bean> list);
+
+ boolean testMap(Map<String, Object> map);
+
+ Bean testResult(Bean bean);
+}
diff --git a/src/main/java/com/alibaba/dubbo/test/service/WSService.java b/src/main/java/com/alibaba/dubbo/test/service/WSService.java
new file mode 100644
index 0000000..626c5af
--- /dev/null
+++ b/src/main/java/com/alibaba/dubbo/test/service/WSService.java
@@ -0,0 +1,7 @@
+package com.alibaba.dubbo.test.service;
+
+/**
+ * Created by ken.lj on 2017/9/24.
+ */
+public interface WSService {
+}
diff --git a/src/main/java/com/alibaba/dubbo/test/service/CatService.java b/src/main/java/com/alibaba/dubbo/test/service/chain/CatService.java
similarity index 100%
rename from src/main/java/com/alibaba/dubbo/test/service/CatService.java
rename to src/main/java/com/alibaba/dubbo/test/service/chain/CatService.java
diff --git a/src/main/java/com/alibaba/dubbo/test/service/DogService.java b/src/main/java/com/alibaba/dubbo/test/service/chain/DogService.java
similarity index 100%
rename from src/main/java/com/alibaba/dubbo/test/service/DogService.java
rename to src/main/java/com/alibaba/dubbo/test/service/chain/DogService.java
diff --git a/src/main/java/com/alibaba/dubbo/test/service/LionService.java b/src/main/java/com/alibaba/dubbo/test/service/chain/LionService.java
similarity index 100%
rename from src/main/java/com/alibaba/dubbo/test/service/LionService.java
rename to src/main/java/com/alibaba/dubbo/test/service/chain/LionService.java
diff --git a/src/main/java/com/alibaba/dubbo/test/service/MouseService.java b/src/main/java/com/alibaba/dubbo/test/service/chain/MouseService.java
similarity index 100%
rename from src/main/java/com/alibaba/dubbo/test/service/MouseService.java
rename to src/main/java/com/alibaba/dubbo/test/service/chain/MouseService.java
diff --git a/src/main/java/com/alibaba/dubbo/test/service/impl/CatServiceImpl.java b/src/main/java/com/alibaba/dubbo/test/service/chain/impl/CatServiceImpl.java
similarity index 92%
rename from src/main/java/com/alibaba/dubbo/test/service/impl/CatServiceImpl.java
rename to src/main/java/com/alibaba/dubbo/test/service/chain/impl/CatServiceImpl.java
index de2ba8b..0b583e9 100644
--- a/src/main/java/com/alibaba/dubbo/test/service/impl/CatServiceImpl.java
+++ b/src/main/java/com/alibaba/dubbo/test/service/chain/impl/CatServiceImpl.java
@@ -1,4 +1,4 @@
-package com.alibaba.dubbo.test.service.impl;
+package com.alibaba.dubbo.test.service.chain.impl;
import com.alibaba.dubbo.test.service.CatService;
import com.alibaba.dubbo.test.service.MouseService;
diff --git a/src/main/java/com/alibaba/dubbo/test/service/impl/DogServiceImpl.java b/src/main/java/com/alibaba/dubbo/test/service/chain/impl/DogServiceImpl.java
similarity index 93%
rename from src/main/java/com/alibaba/dubbo/test/service/impl/DogServiceImpl.java
rename to src/main/java/com/alibaba/dubbo/test/service/chain/impl/DogServiceImpl.java
index a6c3baa..edc38f1 100644
--- a/src/main/java/com/alibaba/dubbo/test/service/impl/DogServiceImpl.java
+++ b/src/main/java/com/alibaba/dubbo/test/service/chain/impl/DogServiceImpl.java
@@ -1,4 +1,4 @@
-package com.alibaba.dubbo.test.service.impl;
+package com.alibaba.dubbo.test.service.chain.impl;
import com.alibaba.dubbo.test.service.CatService;
import com.alibaba.dubbo.test.service.DogService;
diff --git a/src/main/java/com/alibaba/dubbo/test/service/impl/LionServiceImpl.java b/src/main/java/com/alibaba/dubbo/test/service/chain/impl/LionServiceImpl.java
similarity index 94%
rename from src/main/java/com/alibaba/dubbo/test/service/impl/LionServiceImpl.java
rename to src/main/java/com/alibaba/dubbo/test/service/chain/impl/LionServiceImpl.java
index 4cec2dd..102069c 100644
--- a/src/main/java/com/alibaba/dubbo/test/service/impl/LionServiceImpl.java
+++ b/src/main/java/com/alibaba/dubbo/test/service/chain/impl/LionServiceImpl.java
@@ -1,4 +1,4 @@
-package com.alibaba.dubbo.test.service.impl;
+package com.alibaba.dubbo.test.service.chain.impl;
import com.alibaba.dubbo.test.service.CatService;
import com.alibaba.dubbo.test.service.DogService;
diff --git a/src/main/java/com/alibaba/dubbo/test/service/impl/MouseServiceImpl.java b/src/main/java/com/alibaba/dubbo/test/service/chain/impl/MouseServiceImpl.java
similarity index 73%
rename from src/main/java/com/alibaba/dubbo/test/service/impl/MouseServiceImpl.java
rename to src/main/java/com/alibaba/dubbo/test/service/chain/impl/MouseServiceImpl.java
index ae2e352..b9dc4bc 100644
--- a/src/main/java/com/alibaba/dubbo/test/service/impl/MouseServiceImpl.java
+++ b/src/main/java/com/alibaba/dubbo/test/service/chain/impl/MouseServiceImpl.java
@@ -1,11 +1,13 @@
-package com.alibaba.dubbo.test.service.impl;
+package com.alibaba.dubbo.test.service.chain.impl;
import com.alibaba.dubbo.test.service.MouseService;
+import org.springframework.stereotype.Service;
+
/**
* Created by ken.lj on 2017/9/8.
*/
-
+@Service("mouseService")
public class MouseServiceImpl implements MouseService {
@Override
public void eat(String master) {
diff --git a/src/main/java/com/alibaba/dubbo/test/service/impl/AnnotateServiceImpl.java b/src/main/java/com/alibaba/dubbo/test/service/impl/AnnotateServiceImpl.java
index bad2f2f..b232043 100644
--- a/src/main/java/com/alibaba/dubbo/test/service/impl/AnnotateServiceImpl.java
+++ b/src/main/java/com/alibaba/dubbo/test/service/impl/AnnotateServiceImpl.java
@@ -1,12 +1,12 @@
package com.alibaba.dubbo.test.service.impl;
-import com.alibaba.dubbo.config.annotation.Service;
import com.alibaba.dubbo.test.service.AnnotateService;
+import org.springframework.stereotype.Service;
+
/**
* Created by ken.lj on 2017/9/19.
*/
-@Service
public class AnnotateServiceImpl implements AnnotateService {
@Override
public String sayHello() {
diff --git a/src/main/java/com/alibaba/dubbo/test/service/impl/AsycServiceImpl.java b/src/main/java/com/alibaba/dubbo/test/service/impl/AsycServiceImpl.java
new file mode 100644
index 0000000..89ff903
--- /dev/null
+++ b/src/main/java/com/alibaba/dubbo/test/service/impl/AsycServiceImpl.java
@@ -0,0 +1,11 @@
+package com.alibaba.dubbo.test.service.impl;
+
+import com.alibaba.dubbo.test.service.AsyncService;
+
+import org.springframework.stereotype.Service;
+
+/**
+ * Created by ken.lj on 2017/9/24.
+ */
+public class AsycServiceImpl implements AsyncService {
+}
diff --git a/src/main/java/com/alibaba/dubbo/test/service/impl/CacheServiceImpl.java b/src/main/java/com/alibaba/dubbo/test/service/impl/CacheServiceImpl.java
new file mode 100644
index 0000000..5bcd175
--- /dev/null
+++ b/src/main/java/com/alibaba/dubbo/test/service/impl/CacheServiceImpl.java
@@ -0,0 +1,9 @@
+package com.alibaba.dubbo.test.service.impl;
+
+import com.alibaba.dubbo.test.service.CacheService;
+
+/**
+ * Created by ken.lj on 2017/9/24.
+ */
+public class CacheServiceImpl implements CacheService {
+}
diff --git a/src/main/java/com/alibaba/dubbo/test/service/impl/DemoServiceImpl.java b/src/main/java/com/alibaba/dubbo/test/service/impl/DemoServiceImpl.java
new file mode 100644
index 0000000..b511336
--- /dev/null
+++ b/src/main/java/com/alibaba/dubbo/test/service/impl/DemoServiceImpl.java
@@ -0,0 +1,39 @@
+package com.alibaba.dubbo.test.service.impl;
+
+import com.alibaba.dubbo.test.dto.Bean;
+import com.alibaba.dubbo.test.service.DemoService;
+
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created by ken.lj on 2017/9/24.
+ */
+public class DemoServiceImpl implements DemoService {
+ @Override
+ public String testString(String str) {
+ return null;
+ }
+
+ @Override
+ public boolean testPojo(Bean bean) {
+ return false;
+ }
+
+ @Override
+ public boolean testList(List<Bean> list) {
+ return false;
+ }
+
+ @Override
+ public boolean testMap(Map<String, Object> map) {
+ return false;
+ }
+
+ @Override
+ public Bean testResult(Bean bean) {
+ return null;
+ }
+}
diff --git a/src/main/java/com/alibaba/dubbo/test/service/impl/WSServiceImpl.java b/src/main/java/com/alibaba/dubbo/test/service/impl/WSServiceImpl.java
new file mode 100644
index 0000000..048e91b
--- /dev/null
+++ b/src/main/java/com/alibaba/dubbo/test/service/impl/WSServiceImpl.java
@@ -0,0 +1,11 @@
+package com.alibaba.dubbo.test.service.impl;
+
+import com.alibaba.dubbo.test.service.WSService;
+
+import org.springframework.stereotype.Service;
+
+/**
+ * Created by ken.lj on 2017/9/24.
+ */
+public class WSServiceImpl implements WSService {
+}
diff --git a/src/main/java/com/alibaba/dubbo/test/web/BaseController.java b/src/main/java/com/alibaba/dubbo/test/web/BaseController.java
index a2d7200..4f4c896 100644
--- a/src/main/java/com/alibaba/dubbo/test/web/BaseController.java
+++ b/src/main/java/com/alibaba/dubbo/test/web/BaseController.java
@@ -1,6 +1,5 @@
package com.alibaba.dubbo.test.web;
-import com.alibaba.dubbo.config.annotation.Reference;
import com.alibaba.dubbo.test.service.AnnotateService;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -9,7 +8,7 @@
* Created by ken.lj on 2017/9/19.
*/
public class BaseController<T extends AnnotateService> {
- @Reference
+
public T annotateService;
@RequestMapping("/hello")
diff --git a/src/main/java/com/alibaba/dubbo/test/web/HelloController.java b/src/main/java/com/alibaba/dubbo/test/web/HelloController.java
index d244964..0dc8f2f 100644
--- a/src/main/java/com/alibaba/dubbo/test/web/HelloController.java
+++ b/src/main/java/com/alibaba/dubbo/test/web/HelloController.java
@@ -1,9 +1,7 @@
package com.alibaba.dubbo.test.web;
-import com.alibaba.dubbo.config.annotation.Reference;
import com.alibaba.dubbo.test.service.AnnotateService;
-import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
diff --git a/src/main/java/com/alibaba/dubbo/test/web/TestcaseController.java b/src/main/java/com/alibaba/dubbo/test/web/TestcaseController.java
new file mode 100644
index 0000000..7d3199a
--- /dev/null
+++ b/src/main/java/com/alibaba/dubbo/test/web/TestcaseController.java
@@ -0,0 +1,54 @@
+package com.alibaba.dubbo.test.web;
+
+import com.alibaba.dubbo.test.service.AnnotateService;
+import com.alibaba.dubbo.test.service.AsyncService;
+import com.alibaba.dubbo.test.service.CacheService;
+import com.alibaba.dubbo.test.service.DemoService;
+import com.alibaba.dubbo.test.service.WSService;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * Created by ken.lj on 2017/9/25.
+ */
+@RestController
+@RequestMapping("/testcase")
+public class TestcaseController {
+
+ @Autowired
+ private DemoService demoService;
+ private AsyncService asyncService;
+ private CacheService cacheService;
+ private WSService wsService;
+ private AnnotateService annotateService;
+
+ @RequestMapping("/all")
+ public String testAll() {
+ return "all";
+ }
+
+ @RequestMapping("/async")
+ public String testAsync() {
+ return "async";
+ }
+
+ @RequestMapping("/cache")
+ public String testCache() {
+ return "cache";
+ }
+
+ @RequestMapping("/simple")
+ public String testSimple() {
+ String result = demoService.testString("hello");
+ System.out.println(result);
+ return "DemoService string";
+ }
+
+ @RequestMapping("/annotate")
+ public String testAnnotate() {
+ return "annotate";
+ }
+}
diff --git a/src/main/resources/dubbo-annotation.xml b/src/main/resources/dubbo-annotation.xml
index 4e01d66..97868d4 100644
--- a/src/main/resources/dubbo-annotation.xml
+++ b/src/main/resources/dubbo-annotation.xml
@@ -20,18 +20,8 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
- <!-- 提供方应用信息,用于计算依赖关系 -->
- <dubbo:application name="Annotation" />
- <dubbo:provider />
-
- <!-- 使用multicast广播注册中心暴露服务地址 -->
- <dubbo:registry client="curator" address="zookeeper://11.160.112.23:2181?backup=11.239.190.141:2181,11.239.172.213:2181"/>
-
- <!-- 用dubbo协议在20880端口暴露服务 -->
- <dubbo:protocol name="dubbo" port="-1"/>
-
- <bean id="mouseService" class="com.alibaba.dubbo.test.service.impl.MouseServiceImpl" />
+ <bean id="mouseService" class="com.alibaba.dubbo.test.service.chain.impl.MouseServiceImpl" />
<dubbo:annotation />
diff --git a/src/main/resources/dubbo-cat.xml b/src/main/resources/dubbo-cat.xml
index 1d004d2..3a92d66 100644
--- a/src/main/resources/dubbo-cat.xml
+++ b/src/main/resources/dubbo-cat.xml
@@ -20,15 +20,6 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
- <!-- 提供方应用信息,用于计算依赖关系 -->
- <dubbo:application name="Cat"/>
-
- <!-- 使用multicast广播注册中心暴露服务地址 -->
- <dubbo:registry client="curator"
- address="zookeeper://11.160.112.23:2181?backup=11.239.190.141:2181,11.239.172.213:2181"/>
-
- <!-- 用dubbo协议在20880端口暴露服务 -->
- <dubbo:protocol name="dubbo" port="-1"/>
<!-- 和本地bean一样实现服务 -->
<dubbo:service interface="com.alibaba.dubbo.test.service.CatService" ref="catService"/>
diff --git a/src/main/resources/dubbo-common.xml b/src/main/resources/dubbo-common.xml
new file mode 100644
index 0000000..a10e3d5
--- /dev/null
+++ b/src/main/resources/dubbo-common.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ - Copyright 1999-2011 Alibaba Group.
+ -
+ - 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
+ -
+ - 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.
+-->
+<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
+ xmlns="http://www.springframework.org/schema/beans"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
+
+ <!-- 提供方应用信息,用于计算依赖关系 -->
+ <dubbo:application name="dubbo-feature-test" />
+
+ <!-- 使用multicast广播注册中心暴露服务地址 -->
+ <dubbo:registry client="curator" address="zookeeper://11.160.112.23:2181?backup=11.239.190.141:2181,11.239.172.213:2181"/>
+
+ <!-- 用dubbo协议在20880端口暴露服务 -->
+ <dubbo:protocol name="dubbo" port="-1"/>
+
+</beans>
\ No newline at end of file
diff --git a/src/main/resources/dubbo-dog.xml b/src/main/resources/dubbo-dog.xml
index 798ba73..d9794ed 100644
--- a/src/main/resources/dubbo-dog.xml
+++ b/src/main/resources/dubbo-dog.xml
@@ -20,15 +20,6 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
- <!-- 提供方应用信息,用于计算依赖关系 -->
- <dubbo:application name="Dog"/>
-
- <!-- 使用multicast广播注册中心暴露服务地址 -->
- <dubbo:registry address="zookeeper://11.160.112.23:2181?backup=11.239.190.141:2181,11.239.172.213:2181"/>
-
- <!-- 用dubbo协议在20880端口暴露服务 -->
- <dubbo:protocol name="dubbo" port="-1"/>
-
<!-- 和本地bean一样实现服务 -->
<dubbo:service interface="com.alibaba.dubbo.test.service.DogService" ref="dogService"/>
diff --git a/src/main/resources/dubbo-lion.xml b/src/main/resources/dubbo-lion.xml
index 9dfc720..e7c6b13 100644
--- a/src/main/resources/dubbo-lion.xml
+++ b/src/main/resources/dubbo-lion.xml
@@ -20,15 +20,6 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
- <!-- 提供方应用信息,用于计算依赖关系 -->
- <dubbo:application name="Lion"/>
-
- <!-- 使用multicast广播注册中心暴露服务地址 -->
- <dubbo:registry address="zookeeper://11.160.112.23:2181?backup=11.239.190.141:2181,11.239.172.213:2181"/>
-
- <!-- 用dubbo协议在20880端口暴露服务 -->
- <dubbo:protocol name="dubbo" port="-1"/>
-
<!-- 和本地bean一样实现服务 -->
<dubbo:service interface="com.alibaba.dubbo.test.service.LionService" ref="lionService"/>
diff --git a/src/main/resources/dubbo-mouse.xml b/src/main/resources/dubbo-mouse.xml
index bb818ad..b662c83 100644
--- a/src/main/resources/dubbo-mouse.xml
+++ b/src/main/resources/dubbo-mouse.xml
@@ -20,18 +20,7 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
- <!-- 提供方应用信息,用于计算依赖关系 -->
- <dubbo:application compiler="jdk" name="Mouse" />
-
- <dubbo:provider proxy="jdk" />
-
- <!-- 使用multicast广播注册中心暴露服务地址 -->
- <dubbo:registry client="curator" address="zookeeper://11.160.112.23:2181?backup=11.239.190.141:2181,11.239.172.213:2181"/>
-
- <!-- 用dubbo协议在20880端口暴露服务 -->
- <dubbo:protocol name="dubbo" port="-1"/>
-
- <bean id="mouseService" class="com.alibaba.dubbo.test.service.impl.MouseServiceImpl" />
+ <bean id="mouseService" class="com.alibaba.dubbo.test.service.chain.impl.MouseServiceImpl" />
<!-- 和本地bean一样实现服务 -->
<dubbo:service interface="com.alibaba.dubbo.test.service.MouseService" ref="mouseService"/>
diff --git a/src/main/resources/dubbo-regression-consumer.xml b/src/main/resources/dubbo-regression-consumer.xml
new file mode 100644
index 0000000..19e79f3
--- /dev/null
+++ b/src/main/resources/dubbo-regression-consumer.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ - Copyright 1999-2011 Alibaba Group.
+ -
+ - 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
+ -
+ - 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.
+-->
+<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
+ xmlns="http://www.springframework.org/schema/beans"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
+
+ <dubbo:consumer />
+
+ <dubbo:reference id="demoService" interface="com.alibaba.dubbo.test.service.DemoService" />
+
+ <dubbo:reference id="asyncService" interface="com.alibaba.dubbo.test.service.AsyncService" />
+
+ <dubbo:reference id="cacheService" interface="com.alibaba.dubbo.test.service.CacheService" />
+
+ <dubbo:reference id="wsService" interface="com.alibaba.dubbo.test.service.WSService" />
+
+ <dubbo:reference id="annotateService" interface="com.alibaba.dubbo.test.service.AnnotateService" />
+
+</beans>
\ No newline at end of file
diff --git a/src/main/resources/dubbo-regression-provider.xml b/src/main/resources/dubbo-regression-provider.xml
new file mode 100644
index 0000000..1efb88e
--- /dev/null
+++ b/src/main/resources/dubbo-regression-provider.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ - Copyright 1999-2011 Alibaba Group.
+ -
+ - 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
+ -
+ - 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.
+-->
+<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
+ xmlns="http://www.springframework.org/schema/beans"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
+
+ <dubbo:provider />
+
+ <dubbo:service interface="com.alibaba.dubbo.test.service.DemoService" ref="demoService"/>
+
+ <dubbo:service interface="com.alibaba.dubbo.test.service.AsyncService" ref="asyncService"/>
+
+ <dubbo:service interface="com.alibaba.dubbo.test.service.CacheService" ref="cacheService"/>
+
+ <dubbo:service interface="com.alibaba.dubbo.test.service.WSService" ref="wsService"/>
+
+ <dubbo:service interface="com.alibaba.dubbo.test.service.AnnotateService" ref="annotateService"/>
+
+ <bean id="demoService" class="com.alibaba.dubbo.test.service.impl.DemoServiceImpl" />
+ <bean id="asyncService" class="com.alibaba.dubbo.test.service.impl.AsycServiceImpl" />
+ <bean id="cacheService" class="com.alibaba.dubbo.test.service.impl.CacheServiceImpl" />
+ <bean id="wsService" class="com.alibaba.dubbo.test.service.impl.WSServiceImpl" />
+ <bean id="annotateService" class="com.alibaba.dubbo.test.service.impl.AnnotateServiceImpl" />
+
+</beans>
\ No newline at end of file
diff --git a/src/test/java/com/alibaba/dubbo/test/DubboFeatureTestApplicationTests.java b/src/test/java/com/alibaba/dubbo/test/DubboFeatureTestApplicationTests.java
index 0351b8e..450bd6d 100644
--- a/src/test/java/com/alibaba/dubbo/test/DubboFeatureTestApplicationTests.java
+++ b/src/test/java/com/alibaba/dubbo/test/DubboFeatureTestApplicationTests.java
@@ -9,8 +9,6 @@
@SpringBootTest
public class DubboFeatureTestApplicationTests {
- @Test
- public void contextLoads() {
- }
+
}