Package com.axelor.inject
Class Beans
java.lang.Object
com.axelor.inject.Beans
A singleton class that can be used to get instances of injetable services where injection is not
possible.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TReturns the appropriate instance for the given injection type.static <T> Tget(Class<T> type, Annotation qualifier) Returns the appropriate instance for the given injection type qualified by the given annotation.static <T> Tinject(T bean) Injects dependencies into the fields and methods ofbean.
-
Method Details
-
get
Returns the appropriate instance for the given injection type.- Type Parameters:
T- type of the requested bean- Parameters:
type- the requested type- Returns:
- an appropriate instance of the given type
-
get
Returns the appropriate instance for the given injection type qualified by the given annotation.- Type Parameters:
T- type of the requested bean- Parameters:
type- the requested typequalifier- the qualifier annotation- Returns:
- an appropriate instance of the given type
-
inject
public static <T> T inject(T bean) Injects dependencies into the fields and methods ofbean.- Type Parameters:
T- type of the bean- Parameters:
bean- to inject members on- Returns:
- the bean itself
-