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

Fixed Service annotation method parameters are not in effect #4598

Merged
merged 5 commits into from Jul 31, 2019
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -16,9 +16,12 @@
*/
package org.apache.dubbo.config.spring.beans.factory.annotation;

import java.util.Collections;
import org.apache.dubbo.common.logger.Logger;
import org.apache.dubbo.common.logger.LoggerFactory;
import org.apache.dubbo.common.utils.ArrayUtils;
import org.apache.dubbo.config.MethodConfig;
import org.apache.dubbo.config.annotation.Method;
import org.apache.dubbo.config.annotation.Service;
import org.apache.dubbo.config.spring.ServiceBean;
import org.apache.dubbo.config.spring.context.annotation.DubboClassPathBeanDefinitionScanner;
Expand Down Expand Up @@ -387,6 +390,11 @@ private AbstractBeanDefinition buildServiceBeanDefinition(Annotation serviceAnno
builder.addPropertyValue("interface", interfaceClass.getName());
// Convert parameters into map
builder.addPropertyValue("parameters", convertParameters(serviceAnnotationAttributes.getStringArray("parameters")));
// Add methods parameters
List<MethodConfig> methodConfigs = convertMethodConfigs(serviceAnnotationAttributes.get("methods"));
if (!methodConfigs.isEmpty()) {
builder.addPropertyValue("methods", methodConfigs);
}

/**
* Add {@link org.apache.dubbo.config.ProviderConfig} Bean reference
Expand Down Expand Up @@ -447,6 +455,12 @@ private AbstractBeanDefinition buildServiceBeanDefinition(Annotation serviceAnno

}

private List convertMethodConfigs(Object methodsAnnotation) {
if (methodsAnnotation == null){
return Collections.EMPTY_LIST;
}
return MethodConfig.constructMethodConfig((Method[])methodsAnnotation);
}

Leishunyu marked this conversation as resolved.
Show resolved Hide resolved
private ManagedList<RuntimeBeanReference> toRuntimeBeanReferences(String... beanNames) {

Expand Down