Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-9707

Support flexible formatting for resolved message codes

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 3.1.2
    • Fix Version/s: 3.2 RC1
    • Component/s: None
    • Last commented by a User:
      true

      Description

      Maybe it would be a nice idea to enhance the current DefaultMessageCodesResolver with an option of a 'reversed' code resolving.

      The current DefaultMessageCodesResolver uses e.g.
      1.: code + "." + object name + "." + field
      2.: code + "." + field
      3.: code + "." + field type
      4.: code

      which would result in messages.properties like:
      product.code.label=Code # used for form label; not related to validation!
      NotBlank.product.code=May not be null
      MaxSize.product.code=To long

      E.g. using new option of DefaultMessageCodesResolver we could e.g. force it to use:
      1.: object name + "." + field + "." + code
      2.: field + "." + code
      3.: field type + "." + code
      4.: code

      which would result in messages.properties like:
      product.code.label=Code # used for form label; not related to validation!
      product.code.NotBlank=May not be null
      product.code.MaxSize=To long

      This 'looks' more consistent and convienient in message.properties.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                pwebb Phil Webb
                Reporter:
                marceloverdijk Marcel Overdijk
                Last updater:
                Chris Beams
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  5 years, 47 weeks, 4 days ago