public class InjectionUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static org.slf4j.Logger |
LOGGER |
| Constructor and Description |
|---|
InjectionUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
inject(Object bean,
Object... dependencies)
inject objects into the bean
|
static void |
inject(Object bean,
Object dependency)
inject the given object into the according field annotated with @Autowired
|
static void |
inject(Object bean,
String qualifier,
Object dependency)
inject the given object into the according field annotated with @Autowired
additionally the @Qualifier annotation is evaluated to find the correct field |
static InjectionMock |
injectMocks(Object bean)
inject mocks into all autowired fields and return them to the caller
|
static void |
injectValue(Object bean,
String field,
String value)
inject String in field that is annotated with @Value
|
public static InjectionMock injectMocks(Object bean)
bean - the bean to autowirepublic static void injectValue(Object bean, String field, String value)
bean - the bean to inject the value intofield - the name of the target fieldvalue - the value to injectpublic static void inject(Object bean, Object... dependencies)
bean - the bean to inject the dependencies intodependencies - the objects to injectpublic static void inject(Object bean, Object dependency)
bean - the bean to inject the dependency intodependency - the object to injectpublic static void inject(Object bean, String qualifier, Object dependency)
bean - the bean to inject the dependency intoqualifier - the qualifier to match if @Qualifier is present on the fielddependency - the object to injectCopyright © 2016–2023 Taimos GmbH. All rights reserved.