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.

        Issue Links

          Activity

          Hide
          marceloverdijk Marcel Overdijk added a comment - - edited

          Tried to test but I stumbled against SPR-9933 which I just created.

          Show
          marceloverdijk Marcel Overdijk added a comment - - edited Tried to test but I stumbled against SPR-9933 which I just created.
          Hide
          cbeams Chris Beams added a comment -

          Reopening this, dependent on the resolution of SPR-9933 whether we keep this change in 3.2 RC1 or not.

          Show
          cbeams Chris Beams added a comment - Reopening this, dependent on the resolution of SPR-9933 whether we keep this change in 3.2 RC1 or not.
          Hide
          marceloverdijk Marcel Overdijk added a comment -

          PS: I think SPR-9933 is a very critical issue... a 3.2 RC1 with SPR-9933 will hurt a lot of people (if it is a generic issue)

          Show
          marceloverdijk Marcel Overdijk added a comment - PS: I think SPR-9933 is a very critical issue... a 3.2 RC1 with SPR-9933 will hurt a lot of people (if it is a generic issue)
          Hide
          marceloverdijk Marcel Overdijk added a comment -

          As SPR-9933 was fixed with latest snapshot I was able to test this issue and it works as expected.
          Nice addition this flexible formatting!

          Show
          marceloverdijk Marcel Overdijk added a comment - As SPR-9933 was fixed with latest snapshot I was able to test this issue and it works as expected. Nice addition this flexible formatting!
          Hide
          cbeams Chris Beams added a comment -

          Excellent, Marcel. Glad to hear, and thanks again for the quick testing!

          Show
          cbeams Chris Beams added a comment - Excellent, Marcel. Glad to hear, and thanks again for the quick testing!

            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, 4 weeks, 3 days ago