Class ConfigLazyPropertySource

java.lang.Object
org.springframework.core.env.PropertySource<String>
dev.orne.config.spring.ConfigLazyPropertySource

@API(status=INTERNAL, since="1.0") public class ConfigLazyPropertySource extends org.springframework.core.env.PropertySource<String>
Spring PropertySource that uses a Config bean lazily loaded from the application context on first access.

Allows configuration of the property source during bean factory post processing, before the configuration bean is available.

Since:
1.0
Version:
1.0, 2025-08
Author:
(w) Iker Hernaez
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.springframework.core.env.PropertySource

    org.springframework.core.env.PropertySource.StubPropertySource
  • Field Summary

    Fields inherited from class org.springframework.core.env.PropertySource

    logger, name, source
  • Constructor Summary

    Constructors
    Constructor
    Description
    ConfigLazyPropertySource(@NotNull String name, @NotNull org.springframework.beans.factory.BeanFactory beanFactory, @NotNull String beanName)
    Creates a new instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    containsProperty(@NotNull String name)
    boolean
    protected @NotNull org.springframework.beans.factory.BeanFactory
    Returns the bean factory.
    protected @NotNull Config
    Gets the configuration instance.
    getProperty(@NotNull String name)
    int

    Methods inherited from class org.springframework.core.env.PropertySource

    getName, getSource, named, toString

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ConfigLazyPropertySource

      public ConfigLazyPropertySource(@NotNull @NotNull String name, @NotNull @NotNull org.springframework.beans.factory.BeanFactory beanFactory, @NotNull @NotNull String beanName)
      Creates a new instance.
      Parameters:
      name - The name of the property source.
      beanFactory - The bean factory to load the configuration bean.
      beanName - The name of the configuration bean.
  • Method Details

    • containsProperty

      public boolean containsProperty(@NotNull @NotNull String name)
      Overrides:
      containsProperty in class org.springframework.core.env.PropertySource<String>
    • getProperty

      public String getProperty(@NotNull @NotNull String name)
      Specified by:
      getProperty in class org.springframework.core.env.PropertySource<String>
    • getBeanFactory

      @NotNull protected @NotNull org.springframework.beans.factory.BeanFactory getBeanFactory()
      Returns the bean factory.
      Returns:
      The bean factory.
    • getConfig

      @NotNull protected @NotNull Config getConfig()
      Gets the configuration instance.

      The configuration instance is retrieved lazily from the bean factory using the bean name provided as source of this property source on first access.

      Returns:
      The configuration instance.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class org.springframework.core.env.PropertySource<String>
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class org.springframework.core.env.PropertySource<String>