Class ApplicationContextHelper
-
- All Implemented Interfaces:
public class ApplicationContextHelperInit on ApplicationPreparedEvent
- Since:
2022-08-12
trydofor
-
-
Field Summary
Fields Modifier and Type Field Description public static ConfigurableApplicationContextcontextpublic static ConfigurableEnvironmentenvironmentpublic final static StringPropertySourceUnsupportedpublic final static StringPropertySourceDelimiter
-
Method Summary
Modifier and Type Method Description static ConfigurableApplicationContextgetContext()static ConfigurableEnvironmentgetEnvironment()static StringgetApplicationName()Get the value of spring.application.name (if not empty) or context#getApplicationName by default. static StringgetProperties(String name)static <T> TgetProperties(String name, Class<T> type)static Map<String, String>listProperties()Get all keys and valid values in order of appearance. static Map<String, String>listPropertiesKeys()Show keys and its properties static Map<String, List<String>>listPropertySource()Get the PropertySources and the keys within them, the keys can be duplicated as the files can be cascaded. static voidwalkPropertySource(String root, @Param.Out() Map<String, List<String>> srcKey, PropertySource<out Object> src)Use to investigate the relationship between source and key, return source:source2#key to key mapping static <T> TgetBean(String name)static <T> TgetBean(Class<T> type)static <T> ObjectProvider<T>getBeanProvider(Class<T> type)static StringgetMessage(String code, Locale locale, Array<Object> arg)static ResourcegetResource(String local)static Array<Resource>getResources(String local)-
-
Method Detail
-
getContext
@NotNull() static ConfigurableApplicationContext getContext()
-
getEnvironment
@NotNull() static ConfigurableEnvironment getEnvironment()
-
getApplicationName
@NotNull() static String getApplicationName()
Get the value of spring.application.name (if not empty) or context#getApplicationName by default.
-
getProperties
static String getProperties(String name)
-
getProperties
static <T> T getProperties(String name, Class<T> type)
-
listProperties
@NotNull() static Map<String, String> listProperties()
Get all keys and valid values in order of appearance.
-
listPropertiesKeys
@NotNull() static Map<String, String> listPropertiesKeys()
Show keys and its properties
-
listPropertySource
@NotNull() static Map<String, List<String>> listPropertySource()
Get the PropertySources and the keys within them, the keys can be duplicated as the files can be cascaded.
-
walkPropertySource
static void walkPropertySource(String root, @Param.Out() Map<String, List<String>> srcKey, PropertySource<out Object> src)
Use to investigate the relationship between source and key, return source:source2#key to key mapping
-
getBeanProvider
@NotNull() static <T> ObjectProvider<T> getBeanProvider(Class<T> type)
-
getResource
static Resource getResource(String local)
-
getResources
@NotNull() static Array<Resource> getResources(String local)
-
-
-
-