Spring Roo
  1. Spring Roo
  2. ROO-1655

Controllers register duplicate type converters, construction order dictates which wins

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Complete
    • Affects Version/s: 1.1.0.RELEASE
    • Fix Version/s: 1.1.1.RELEASE
    • Component/s: WEB MVC
    • Labels:
      None

      Description

      If I create two sets of entities:

      ObjectA >-- ObjectB
      ObjectD >-- ObjectC
      

      and push-in and modify the the converters in the ObjectAController and the ObjectDController, the changes I make in A controller will be ignored (because they are overwritten by the same converters that ObjectBController generates) but the changes I make in D controller will work just fine.

      So, every time I create a new controller that references some entity, it could, based on how it collates with the other controllers, undo any customizations I've made to the String conversion of an entity.

      In some sense, this is similar to ROO-1405 which looks like it was closed primarily because it suggested placing the default converter in the entity.

      I would propose any of the following solutions:

      1. Allow me to set registerConverters=false at a global level so that I can fully take over that process.
      2. Keep track of which converters have been generated, and don't generate and register duplicates.
      3. Generate duplicate converters, but ask the registry if that type already has a converter before registering it.
      4. Only generate and register a single converter per controller (ObjectAController registers a converter for ObjectA, ignores any referenced entities).
      5. Generate all converters into a single global file.

        Issue Links

          Activity

          Hide
          Rossen Stoyanchev added a comment -

          Checked in changes under 66d71dd415c81bbe5a129b38bbb50f7e7bdf3662.

          A new @RooConversionService managed type is added. It provides a central place for registering Converters and Formatters application-wide and is automatically installed when the first controller is created. This is where converters for domain types are managed from now rather than from individual controllers.

          Show
          Rossen Stoyanchev added a comment - Checked in changes under 66d71dd415c81bbe5a129b38bbb50f7e7bdf3662. A new @RooConversionService managed type is added. It provides a central place for registering Converters and Formatters application-wide and is automatically installed when the first controller is created. This is where converters for domain types are managed from now rather than from individual controllers.
          Hide
          Stefan Schmidt added a comment -

          Made a change with commit aa652375971c05d72d4c7dca29475e0c931276c1 to cause automatic creation of ApplicationConversionServiceFactoryBean.java in case of upgrades from Roo 1.1.0 generated projects.

          Show
          Stefan Schmidt added a comment - Made a change with commit aa652375971c05d72d4c7dca29475e0c931276c1 to cause automatic creation of ApplicationConversionServiceFactoryBean.java in case of upgrades from Roo 1.1.0 generated projects.
          Hide
          Stefan Schmidt added a comment -

          Renamed RooJavaType to JavaTypeWrapper so it does not conflict with annotation naming conventions (commit id 7ebd064f2c7b02de034e8f6d019f5615cc3ba3b1).

          Show
          Stefan Schmidt added a comment - Renamed RooJavaType to JavaTypeWrapper so it does not conflict with annotation naming conventions (commit id 7ebd064f2c7b02de034e8f6d019f5615cc3ba3b1).
          Hide
          Rossen Stoyanchev added a comment -

          Added upgrade instructions (51cfa5726a5f2a25bb64aa1c652a382324ffff5a) and a few more changes to make upgrading easier (f251f71dea92fa0c9f9e3ea30aef60b1322ae723).

          Show
          Rossen Stoyanchev added a comment - Added upgrade instructions (51cfa5726a5f2a25bb64aa1c652a382324ffff5a) and a few more changes to make upgrading easier (f251f71dea92fa0c9f9e3ea30aef60b1322ae723).
          Hide
          Rossen Stoyanchev added a comment -

          Marking as completed.

          Show
          Rossen Stoyanchev added a comment - Marking as completed.

            People

            • Assignee:
              Rossen Stoyanchev
              Reporter:
              Tom Mack
            • Votes:
              3 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: