Skip to content

SpEL does not expose field-level annotations when setting bean properties [SPR-6745] #11411

Closed
@spring-projects-issues

Description

@spring-projects-issues

Keith Donald opened SPR-6745 and commented

This means annotation-driven type conversion does not work when binding to JavaBean properties with SpEL. This can be worked around by defining annotations on the method parameter of a setter method, and the return value of a getter, but is not ideal.

SpEL should be consistent with BeanWrapper with its TypeDescriptor configuration when getting and setting JavaBean properties. This likely means use of a BeanTypeDescriptor in those cases.

This was noticed when attempting to use a SpEL-based data mapper to map String fields in a Map to a JavaBean, where annotation-driven parsing rules were specified on JavaBean fields. This works fine with a BeanWrapper since the BeanTypeDescriptor exposes annotations from the field, getter, and setter. Unfortunately, SpEl just uses the default TypeDescriptor in these cases which only exposes parameter annotations.


Affects: 3.0 GA

Issue Links:

Referenced from: commits 117b138

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