Skip to content

Commit

Permalink
merge pull request #2353 to 2.6.x to fix #2353 (#2761)
Browse files Browse the repository at this point in the history
  • Loading branch information
beiwei30 authored Nov 8, 2018
1 parent a1b27ab commit 86c4737
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,8 @@ private AbstractBeanDefinition buildServiceBeanDefinition(Service service, Class

MutablePropertyValues propertyValues = beanDefinition.getPropertyValues();

String[] ignoreAttributeNames = of("provider", "monitor", "application", "module", "registry", "protocol", "interface");
String[] ignoreAttributeNames = of("provider", "monitor", "application", "module", "registry", "protocol",
"interface", "interfaceName");

propertyValues.addPropertyValues(new AnnotationPropertyValuesAdapter(service, environment, ignoreAttributeNames));

Expand Down Expand Up @@ -483,4 +484,4 @@ public void setBeanClassLoader(ClassLoader classLoader) {
this.classLoader = classLoader;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import com.alibaba.dubbo.config.spring.annotation.consumer.AnnotationAction;
import com.alibaba.dubbo.config.spring.api.DemoService;
import com.alibaba.dubbo.config.spring.api.HelloService;
import com.alibaba.dubbo.config.spring.context.annotation.provider.ProviderConfiguration;
import com.alibaba.dubbo.config.spring.filter.MockFilter;
import com.alibaba.dubbo.config.spring.impl.DemoServiceImpl;
import com.alibaba.dubbo.config.spring.impl.HelloServiceImpl;
Expand All @@ -51,6 +52,7 @@
import org.junit.Ignore;
import org.junit.Test;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.Collection;
Expand Down Expand Up @@ -106,6 +108,22 @@ public void testServiceClass() {
}
}

@Test
public void testServiceAnnotation() {
AnnotationConfigApplicationContext providerContext = new AnnotationConfigApplicationContext();
providerContext.register(ProviderConfiguration.class);

providerContext.refresh();

ReferenceConfig<HelloService> reference = new ReferenceConfig<HelloService>();
reference.setApplication(new ApplicationConfig("consumer"));
reference.setRegistry(new RegistryConfig(RegistryConfig.NO_AVAILABLE));
reference.setInterface(HelloService.class);
reference.setUrl("dubbo://127.0.0.1:12345");
String hello = reference.get().sayHello("hello");
assertEquals("Hello, hello", hello);
}

@Test
@SuppressWarnings("unchecked")
public void testProviderNestedService() {
Expand Down Expand Up @@ -999,4 +1017,4 @@ public void testGenericServiceConfigThroughSpring() throws Exception {
ctx.destroy();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*
* @since 2.5.9
*/
@Service
@Service(interfaceName = "com.alibaba.dubbo.config.spring.api.HelloService")
public class HelloServiceImpl implements HelloService {

@Override
Expand Down

0 comments on commit 86c4737

Please sign in to comment.