Package jetbrains.buildServer.util
Class SpringUtil
- java.lang.Object
-
- jetbrains.buildServer.util.SpringUtil
-
public final class SpringUtil extends java.lang.Object
- Since:
- 2018.2
- Author:
- Maxim.Zaytsev
-
-
Constructor Summary
Constructors Constructor Description SpringUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> T
getOwnBean(org.springframework.context.ApplicationContext context, java.lang.Class<T> type)
Returns instance of specified type from specified context but ignore beans of parent context.static <T> T
getOwnBean(org.springframework.context.ApplicationContext context, java.lang.Class<T> type, T defaultBean)
Returns instance of specified type from specified context but ignore beans of parent context.static <T> java.util.List<T>
getOwnBeans(org.springframework.context.ApplicationContext context, java.lang.Class<T> type)
Returns all instances of specified type from specified context but ignore beans of parent context
-
-
-
Method Detail
-
getOwnBeans
@NotNull public static <T> java.util.List<T> getOwnBeans(@NotNull org.springframework.context.ApplicationContext context, @NotNull java.lang.Class<T> type)
Returns all instances of specified type from specified context but ignore beans of parent context- Parameters:
context
- specified contexttype
- type the bean must match- Returns:
- list of fount beans
-
getOwnBean
@Nullable public static <T> T getOwnBean(@NotNull org.springframework.context.ApplicationContext context, @NotNull java.lang.Class<T> type)
Returns instance of specified type from specified context but ignore beans of parent context.- Parameters:
context
- specified contexttype
- type the bean must match- Returns:
- found instance or
null
if context doesn't contain bean or contains many beans of specified type
-
getOwnBean
@NotNull public static <T> T getOwnBean(@NotNull org.springframework.context.ApplicationContext context, @NotNull java.lang.Class<T> type, T defaultBean)
Returns instance of specified type from specified context but ignore beans of parent context.- Parameters:
context
- specified contexttype
- type the bean must matchdefaultBean
- default instance which must be returned if context doesn't contain bean or contains many beans of specified type- Returns:
- found instance or
defaultBean
if context doesn't contain bean or contains many beans of specified type
-
-