Uploaded image for project: 'Tapestry'
  1. Tapestry
  2. TAPESTRY-1425

Eager Loaded service (builder) cannot use object injection

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 5.0.4
    • Fix Version/s: 5.0.5
    • Component/s: tapestry-core
    • Labels:
      None

      Description

      A service which is EagerLoaded cannot use object injection, it must use InjectService.

      If the eager loaded service uses object injection then it will cause an error because the alias service has not had its mode set when eager loaded services are created.

      e..g This builder method results in an error
      @EagerLoad
      public RegistryShutdownListener buildFileCleanerCleanup( RegistryShutdownHub hub)

      When service injection is used it is ok.
      @EagerLoad
      public RegistryShutdownListener buildFileCleanerCleanup(@InjectService("RegistryShutdownHub") RegistryShutdownHub hub)

      Not sure if this can actually be fixed, or if it just needs to be documented.

        Issue Links

          Activity

          Hide
          hlship Howard M. Lewis Ship added a comment -

          Looks like we should chnage the Alias service's object provider to NO-OP until the mode is set (rather than fail). I'm a little nervous about injections that require the Alias service to properly disambiguate the injection.

          Show
          hlship Howard M. Lewis Ship added a comment - Looks like we should chnage the Alias service's object provider to NO-OP until the mode is set (rather than fail). I'm a little nervous about injections that require the Alias service to properly disambiguate the injection.
          Hide
          bpsommerville Ben Sommerville added a comment -

          Thats a good solution.

          My use case didn't need the alias service at all, the services were all unambiguous. It was just that the aliases were checked first & failed hard.

          Show
          bpsommerville Ben Sommerville added a comment - Thats a good solution. My use case didn't need the alias service at all, the services were all unambiguous. It was just that the aliases were checked first & failed hard.
          Hide
          hlship Howard M. Lewis Ship added a comment -

          We now defer eager loading until after application initialization, which means that the MasterObjectProvider will be initilaized and ready.

          Show
          hlship Howard M. Lewis Ship added a comment - We now defer eager loading until after application initialization, which means that the MasterObjectProvider will be initilaized and ready.

            People

            • Assignee:
              hlship Howard M. Lewis Ship
              Reporter:
              bpsommerville Ben Sommerville
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development