Skip to content

Relax JavaBean rules for SpEL property access [SPR-10716] #15344

@spring-projects-issues

Description

@spring-projects-issues

Koen Serneels opened SPR-10716 and commented

Expression that accesses a property having there second char upper cased are not found on the target object.
This is because a small bug in the property method matcher:

org.springframework.expression.spel.support.ReflectivePropertyAccessor#getPropertyMethodSuffix (L:368):

protected String getPropertyMethodSuffix(String propertyName) {
	if (propertyName.length() > 1 && Character.isUpperCase(propertyName.charAt(1))) {
		return propertyName;
	}
	else {
		return StringUtils.capitalize(propertyName);
	}
}

So this:

Character.isUpperCase(propertyName.charAt(1)))

Should become:

Character.isUpperCase(propertyName.charAt(0))

Affects: 3.2.3

Attachments:

Sub-tasks:

Issue Links:

Referenced from: commits b25e91a, f9f1069

2 votes, 4 watchers

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions