spring-projects / spring-projects/spring-hateoas

The rest-messages resource bundle mechanics are at bit odd

Open
#2,392 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.1k
Forks
476
PR merge metrics
No merged PRs in 30d

Description

I wanted to customize some stuff in my HalForms responses (prompt for example).

So I added rest-messages.properties assuming that this was where the defaults go.

When I start my application the file is not considered, I dive into the code and see that a rest-default-messages.properties is mentioned.

As far as I read the code, then if I add an empty rest-default-messages.properties then my rest-messages.properties is loaded / taken into account? A bit surprising...

The culprit seems to be in the HateoasConfiguration.loadResourceBundleResources - where the context.getResources("classpath:rest-messages*.properties") does not match the base-file, it just looks for any translations (which I did not have).

If this is mentioned in the docs I did clearly not find it... But it looks a bit like a bug to me.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in HateoasConfiguration.loadResourceBundleResources and inspect how classpath:rest-messages*.properties is resolved against rest-messages.properties and rest-default-messages.properties. Trace the HalForms message customization path and define the expected behavior for a base bundle without translations; done means the documented resource-bundle behavior is consistent and covered by verification.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.