mercyblitz commented on a change in pull request #1611: Spring Framework /
Spring Boot Enhancements
URL: https://github.com/apache/incubator-dubbo/pull/1611#discussion_r183278015
##########
File path:
dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/beans/factory/annotation/ReferenceBeanBuilder.java
##########
@@ -80,14 +86,30 @@ private void configureConsumerConfig(Reference reference,
ReferenceBean<?> refer
@Override
protected ReferenceBean doBuild() {
- return new ReferenceBean<Object>(annotation);
+ return new ReferenceBean<Object>();
}
@Override
- protected void preConfigureBean(Reference annotation, ReferenceBean bean) {
+ protected void preConfigureBean(Reference reference, ReferenceBean
referenceBean) {
Assert.notNull(interfaceClass, "The interface class must set first!");
+ DataBinder dataBinder = new DataBinder(referenceBean);
+ // Set ConversionService
+ dataBinder.setConversionService(getConversionService());
+ // Ignore those fields
+ String[] ignoreAttributeNames = of("application", "module",
"consumer", "monitor", "registry");
+// dataBinder.setDisallowedFields(ignoreAttributeNames);
+ // Bind annotation attributes
+ dataBinder.bind(new AnnotationPropertyValuesAdapter(reference,
applicationContext.getEnvironment(), ignoreAttributeNames));
}
+ private ConversionService getConversionService() {
+ DefaultConversionService conversionService = new
DefaultConversionService();
+ conversionService.addConverter(new StringArrayToStringConverter());
+ conversionService.addConverter(new StringArrayToMapConverter());
Review comment:
It's used to convert value of attributes of `@Service` and `@Reference` to
required type.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services