Uploaded image for project: '[Read Only] - Hippo Site Toolkit 2'
  1. [Read Only] - Hippo Site Toolkit 2
  2. HSTTWO-2459

Add a method to retrieve a bean by (interface) class on ComponentManager

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • 2.24.13
    • 2.26.01
    • None
    • None

    Description

      As per http://hippo.2275632.n2.nabble.com/HstServices-getComponentManager-vs-HstFilter-getClientComponentManager-td7580345.html I would like to be able to retrieve a component based on it's interface.

      This is common in Spring as well by using: context.getBean(SomeInterface.class).

      Woonsans reply in the thread was:

      I think it will be useful to add #getComponentOfType(Class<T>) or #getComponent(Class<T>) in ComponentManager. It can throw exception when there are multiple beans. This seems necessary especially when using auto annotation scanner feature of spring anyway.
      Feel free to create a jira issue for this improvement.

      Personally I would go for the last option: #getComponent(Class<T>), but either is fine I suppose.

      Attachments

        Activity

          People

            aschrijvers Ard Schrijvers
            aukevanleeuwen@gmail.com Auke van Leeuwen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: