Class InfoPropertiesInfoContributor<T extends InfoProperties>

java.lang.Object
org.springframework.boot.actuate.info.InfoPropertiesInfoContributor<T>
Type Parameters:
T - the type of the InfoProperties to expose
All Implemented Interfaces:
InfoContributor
Direct Known Subclasses:
BuildInfoContributor, GitInfoContributor

public abstract class InfoPropertiesInfoContributor<T extends InfoProperties> extends Object implements InfoContributor
A base InfoContributor to expose an InfoProperties.
Since:
1.4.0
Author:
Stephane Nicoll, Madhura Bhave
  • Constructor Details

  • Method Details

    • getProperties

      protected final T getProperties()
      Return the properties that this instance manages.
      Returns:
      the info properties
    • getMode

      protected final InfoPropertiesInfoContributor.Mode getMode()
      Return the mode that should be used to expose the content.
      Returns:
      the mode
    • toSimplePropertySource

      protected abstract PropertySource<?> toSimplePropertySource()
      Return a PropertySource for the SIMPLE mode.
      Returns:
      the property source for the simple model
      See Also:
    • generateContent

      protected Map<String,Object> generateContent()
      Extract the content to contribute to the info endpoint.
      Returns:
      the content to expose
      See Also:
    • extractContent

      protected Map<String,Object> extractContent(PropertySource<?> propertySource)
      Extract the raw content based on the specified PropertySource.
      Parameters:
      propertySource - the property source to use
      Returns:
      the raw content
    • postProcessContent

      protected void postProcessContent(Map<String,Object> content)
      Post-process the content to expose. Elements can be added, changed or removed.
      Parameters:
      content - the content to expose
    • toPropertySource

      protected PropertySource<?> toPropertySource()
      Return the PropertySource to use based on the chosen InfoPropertiesInfoContributor.Mode.
      Returns:
      the property source
    • copyIfSet

      protected void copyIfSet(Properties target, String key)
      Copy the specified key to the target Properties if it is set.
      Parameters:
      target - the target properties to update
      key - the key
    • replaceValue

      protected void replaceValue(Map<String,Object> content, String key, Object value)
      Replace the value for the specified key if the value is not null.
      Parameters:
      content - the content to expose
      key - the property to replace
      value - the new value
    • getNestedMap

      protected Map<String,Object> getNestedMap(Map<String,Object> map, String key)
      Return the nested map with the specified key or empty map if the specified map contains no mapping for the key.
      Parameters:
      map - the content
      key - the key of a nested map
      Returns:
      the nested map