spring-projects / spring-projects/spring-boot
Allow to define that a binding target represents a scalar value
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 81.5k
- Forks
- 42.7k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 65
Description
If a property is of type Map there are some restrictions on the key. If the key contains a ., the key must be wrapped to teach the binder what is the key and what is the next navigation target.
This is now applicable when binding to a scalar value, logging.level is a good example of that.
While working on #14139, I've noticed we have defined a ServiceLevelAgreementBoundary type that represents a scalar value. There is a management.metrics.distribution.sla property that maps a meter ID to an array of such type.
A meter ID has typically a dot in it but this is working fine because the target type is an array. If the target type is a pojo, no binding of a meter with a dot happens unless it's wrapped.
There is a sample project to showcase concretely what happens: https://github.com/snicoll-scratches/test-binding-singular-pojo
It would be nice if we had an annotation that teaches the binder that the target type is a scalar value which would have two side effects:
- The binder could offer binding of key with a dot without requiring the wrapping. This can be useful for things where we know there is high chance the key will have a dot in it
- The IDE can poke at the source code for the type and stop complaining that the part after the dot doesn't represent a valid property of said type.
IntelliJ IDEA properly implements what is supposed to happen so SLA keys are shown as invalid at the moment:

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the behavior in the linked test-binding-singular-pojo sample and reading the binder behavior described in the issue. Define how an annotation would identify scalar target types, then verify that dotted keys bind without wrapping and that IntelliJ no longer reports the suffix as an invalid property.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring-boot
- Domain
- backend, developer-experience
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100