You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "kexianjun (GitHub)" <gi...@apache.org> on 2018/11/17 01:54:40 UTC

[GitHub] [incubator-dubbo] kexianjun opened issue #2798: DubboBeanDefinitionParser#parse method add property to beanDefinition issue

I found that when dubbo sets a properties for a beanDefinition when parsing an XML in DubboBeanDefinitionParser#parse method, the propertyName is split with "-",which is the propertyName used in xml file,not the bean class attrubute name,if somewhere has configed such a property,the beanDefinition contains a property with a name like xxx-yy,and the bean class attribute name like xxxYy,when spring populateBean and set this property's value,it will throw  a NotWritablePropertyException because the property’s name is unmatched.The code is shown below.
```
private static BeanDefinition parse(Element element, ParserContext parserContext, Class<?> beanClass, boolean required) {
...
        for (Method setter : beanClass.getMethods()) {
           ...
                String property = StringUtils.camelToSplitName(name.substring(3, 4).toLowerCase() + name.substring(4), "-");
                props.add(property);
                Method getter = null;
               ...
                                beanDefinition.getPropertyValues().addPropertyValue(property, reference);
...
     
        return beanDefinition;
    }

```

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/2798 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [incubator-dubbo] cvictory closed issue #2798: DubboBeanDefinitionParser#parse method add property to beanDefinition may cause a NotWritablePropertyException

Posted by "cvictory (GitHub)" <gi...@apache.org>.
[ issue closed by cvictory ]

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/2798 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org