Details
-
Improvement
-
Status: Closed
-
Normal
-
Resolution: Fixed
-
2.24.13
-
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.