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 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

      default String 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 loader
      resourcePath - The resource path
      sourceName - The imported source name
      origin - 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 content
      sourceName - The imported source name
      extension - 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 path
      sourceName - The imported source name
      origin - The property source origin
      allowMultiple - Whether multiple resources should be merged in discovered order
      Returns:
      Imported property source
    • getResourcePath

      default String getResourcePath()
      Returns:
      The resource path.