Interface PropertySourceImporter.ImportContext<T>
- Type Parameters:
T- The typed import declaration
- Enclosing interface:
PropertySourceImporter<T>
public static interface PropertySourceImporter.ImportContext<T>
Import context information and helper methods.
- Since:
- 5.0
-
Method Summary
Modifier and TypeMethodDescription@Nullable ConnectionStringdefault Stringdefault StringimportClasspathPropertySource(String resourcePath, String sourceName, PropertySource.Origin origin, boolean allowMultiple) Import a classpath property source with optional wildcard semantics.importPropertySource(ResourceLoader resourceLoader, String resourcePath, String sourceName, PropertySource.Origin origin) Import a property source from a resource path.importPropertySource(String content, String sourceName, String extension, PropertySource.Origin origin) Import a property source from inline text content.@Nullable PropertySource.Origin
-
Method Details
-
environment
Environment environment()- Returns:
- The environment that is resolving imports
-
connectionString
@Nullable ConnectionString connectionString()- Returns:
- The parsed connection string declaration, if the import was declared as a scalar string
-
importDeclaration
T importDeclaration()- Returns:
- The type-safe import declaration derived from the raw import input
-
getCanonicalLocation
- Returns:
- The canonical location.
-
parentOrigin
@Nullable PropertySource.Origin parentOrigin()- Returns:
- The origin of the property source that declared the import
-
importPropertySource
Optional<PropertySource> importPropertySource(ResourceLoader resourceLoader, String resourcePath, String sourceName, PropertySource.Origin origin) Import a property source from a resource path.- Parameters:
resourceLoader- The resource loaderresourcePath- The resource pathsourceName- The imported source nameorigin- The property source origin- Returns:
- Imported property source
-
importPropertySource
Optional<PropertySource> importPropertySource(String content, String sourceName, String extension, PropertySource.Origin origin) Import a property source from inline text content.- Parameters:
content- The inline contentsourceName- The imported source nameextension- The format extension (for example yml, properties, json)origin- The property source origin- Returns:
- Imported property source
-
importClasspathPropertySource
Optional<PropertySource> importClasspathPropertySource(String resourcePath, String sourceName, PropertySource.Origin origin, boolean allowMultiple) Import a classpath property source with optional wildcard semantics.- Parameters:
resourcePath- The classpath resource pathsourceName- The imported source nameorigin- The property source originallowMultiple- Whether multiple resources should be merged in discovered order- Returns:
- Imported property source
-
getResourcePath
- Returns:
- The resource path.
-