Package com.atlassian.plugin.module
Interface ContainerAccessor
public interface ContainerAccessor
The ContainerAccessor allows access to the underlying plugin container (e.g. spring).
- Since:
- 2.5.0
-
Method Summary
Modifier and TypeMethodDescription<T> TcreateBean(Class<T> clazz) Will ask the container to instantiate a bean of the given class and does inject all constructor defined dependencies.<T> TGets single bean of given type<T> TRetrieves a bean by name from the container.<T> Collection<T>getBeansOfType(Class<T> interfaceClass) Gets all the beans that implement a given interface<T> TinjectBean(T bean) Injects an existing bean instance with any dependencies via setters or private field injection
-
Method Details
-
createBean
Will ask the container to instantiate a bean of the given class and does inject all constructor defined dependencies. Currently we have only spring as a container that will autowire this bean.- Parameters:
clazz- the Class to instantiate. Cannot be null.- Returns:
- an instantiated bean.
-
injectBean
<T> T injectBean(T bean) Injects an existing bean instance with any dependencies via setters or private field injection- Type Parameters:
T- The bean type- Parameters:
bean- The instantiated bean to inject- Since:
- 3.0
-
getBean
Retrieves a bean by name from the container.- Parameters:
id- the id of the container bean, cannot be null- Returns:
- the bean object, or null if cannot be found
- Since:
- 3.0
-
getBean
Gets single bean of given type- Type Parameters:
T- The bean type- Parameters:
requiredType- The expected bean type- Returns:
- The bean object, or null if cannot be found
- Since:
- 8.0
-
getBeansOfType
Gets all the beans that implement a given interface- Type Parameters:
T- The target interface type- Parameters:
interfaceClass- The interface class- Returns:
- A collection of implementations from the plugin's container
-