Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Dubbo-2353]fix Invalid property 'interfaceName' of bean class [org.apache.dubbo.config.spring.ServiceBean]#2353 #2418

Merged
merged 10 commits into from
Nov 8, 2018
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ 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
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.apache.dubbo.config.spring.annotation.consumer.AnnotationAction;
import org.apache.dubbo.config.spring.api.DemoService;
import org.apache.dubbo.config.spring.api.HelloService;
import org.apache.dubbo.config.spring.context.annotation.provider.ProviderConfiguration;
import org.apache.dubbo.config.spring.filter.MockFilter;
import org.apache.dubbo.config.spring.impl.DemoServiceImpl;
import org.apache.dubbo.config.spring.impl.HelloServiceImpl;
Expand All @@ -50,6 +51,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 @@ -105,6 +107,23 @@ public void testServiceClass() {
}
}

@Test
public void testServiceAnnotation() {
beiwei30 marked this conversation as resolved.
Show resolved Hide resolved
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
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*
* @since 2.5.9
*/
@Service
@Service(interfaceName = "org.apache.dubbo.config.spring.api.HelloService")
public class HelloServiceImpl implements HelloService {

@Override
Expand Down