Class DefaultActuatorService

java.lang.Object
com.bobocode.bring.web.actuator.service.impl.DefaultActuatorService
All Implemented Interfaces:
ActuatorService

public class DefaultActuatorService extends Object implements ActuatorService
Default implementation of the ActuatorService interface. Provides methods for preparing Git information and system properties data for the Actuator endpoint.

This class uses the @Service annotation to indicate that it is a Bring component and should be automatically detected and registered during component scanning.

The Git information is loaded from the "git.properties" file, and the system properties data is obtained using System.getProperties().

The @PostConstruct method prepareGitInfo() is annotated to be executed after the bean is constructed. It loads the Git information during the initialization phase.

The class uses constants for error messages, Git file name, and keys of properties of Git.

Since:
1.0
Author:
Blyzhnytsia Team
  • Field Details

  • Constructor Details

    • DefaultActuatorService

      public DefaultActuatorService()
  • Method Details

    • getGitInfo

      public GitInfo getGitInfo()
      Returns the Git information for the Actuator endpoint.
      Specified by:
      getGitInfo in interface ActuatorService
      Returns:
      Git information including branch details and the latest commit information.
    • preparePropertyData

      public PropertiesData preparePropertyData()
      Prepares system properties data for the Actuator endpoint.
      Specified by:
      preparePropertyData in interface ActuatorService
      Returns:
      Properties data containing all system properties.
    • prepareGitInfo

      public void prepareGitInfo()
      Initializes the Git information during the bean's post-construction phase. This method is annotated with @PostConstruct and is executed after the bean is constructed.
    • prepareGitInfo

      private GitInfo prepareGitInfo(Properties properties, Commit commit)
      Prepares Git information based on the provided properties and commit details.
      Parameters:
      properties - The properties containing Git information.
      commit - The details of the latest commit.
      Returns:
      Git information including branch details and the latest commit information.
    • prepareCommitInfo

      private Commit prepareCommitInfo(Properties properties)
      Prepares commit information based on the provided properties.
      Parameters:
      properties - The properties containing commit details.
      Returns:
      The details of the latest commit, including ID, message, and timestamp.