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;
}
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.