Tapestry 5
  1. Tapestry 5
  2. TAP5-1030

Injecting a Logger into a non-service object, created as part of constructing a service configuration, should work but doesn't

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.1.0.5
    • Fix Version/s: 5.2.0
    • Component/s: None
    • Labels:
      None

      Description

      The Javadoc for ObjectLocator.autobuild() states that it "Autobuilds a class by finding the public constructor with the most parameters. Services and resources will be injected into the parameters of the constructor." However, this seems to only be true for the ServiceResourcesImpl implementation of the interface, which is aware of the following resources (code from 5.1.0.5, AbstractServiceCreator, line 63):

      injectionResources.put(String.class, serviceId);
      injectionResources.put(ObjectLocator.class, resources);
      injectionResources.put(ServiceResources.class, resources);
      injectionResources.put(Logger.class, logger);
      injectionResources.put(Class.class, resources.getServiceInterface());
      injectionResources.put(OperationTracker.class, resources.getTracker());

      On the other hand, RegistryImpl is only aware of the OperationTracker resource (RegistryImpl line 841)

      resourcesMap.put(OperationTracker.class, tracker);

      Specifically, one cannot call registry.autobuild() on any class that has a Logger resource in its constructor. If this is the intended behavior than the ObjectLocator javadoc should be updated.

        Activity

        Leonard Lu created issue -
        Howard M. Lewis Ship made changes -
        Field Original Value New Value
        Assignee Howard M. Lewis Ship [ hlship ]
        Howard M. Lewis Ship made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Hide
        Howard M. Lewis Ship added a comment -

        Did a little digging and found out that java.util.logging.Logger, not org.slf4j.Logger, was being set up for injection!

        Show
        Howard M. Lewis Ship added a comment - Did a little digging and found out that java.util.logging.Logger, not org.slf4j.Logger, was being set up for injection!
        Howard M. Lewis Ship made changes -
        Summary RegistryImpl.autobuild() does not inject resources into constructor parameters Injecting a Logger into a non-service object, created as part of constructing a service configuration, should work but doesn't
        Hide
        Howard M. Lewis Ship added a comment -

        Oops, I think some of the commits listed TAP5-1050!

        Show
        Howard M. Lewis Ship added a comment - Oops, I think some of the commits listed TAP5-1050 !
        Howard M. Lewis Ship made changes -
        Status In Progress [ 3 ] Closed [ 6 ]
        Fix Version/s 5.2.0 [ 12314122 ]
        Resolution Fixed [ 1 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open In Progress In Progress
        30d 5h 42m 1 Howard M. Lewis Ship 27/Mar/10 00:09
        In Progress In Progress Closed Closed
        1h 15m 1 Howard M. Lewis Ship 27/Mar/10 01:25

          People

          • Assignee:
            Howard M. Lewis Ship
            Reporter:
            Leonard Lu
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development