You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@dubbo.apache.org by GitBox <gi...@apache.org> on 2018/04/23 04:27:55 UTC

[GitHub] zonghaishang commented on a change in pull request #1611: Spring Framework / Spring Boot Enhancements

zonghaishang commented on a change in pull request #1611: Spring Framework / Spring Boot Enhancements
URL: https://github.com/apache/incubator-dubbo/pull/1611#discussion_r183274340
 
 

 ##########
 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:
   Is it possible to convert other scenes ?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services