Class DefaultActuatorService
java.lang.Object
com.bobocode.bring.web.actuator.service.impl.DefaultActuatorService
- All Implemented Interfaces:
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 Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns the Git information for the Actuator endpoint.private Commit
prepareCommitInfo
(Properties properties) Prepares commit information based on the provided properties.void
Initializes the Git information during the bean's post-construction phase.private GitInfo
prepareGitInfo
(Properties properties, Commit commit) Prepares Git information based on the provided properties and commit details.Prepares system properties data for the Actuator endpoint.
-
Field Details
-
GIT_PROPERTIES_FILE_NOT_FOUND_MESSAGE
- See Also:
-
GIT_FILE_NAME
- See Also:
-
GIT_BRANCH_PROPERTY
- See Also:
-
GIT_COMMIT_ID_PROPERTY
- See Also:
-
GIT_COMMIT_MESSAGE_FULL_PROPERTY
- See Also:
-
GIT_COMMIT_TIME_PROPERTY
- See Also:
-
gitInfo
-
serverProperties
-
-
Constructor Details
-
DefaultActuatorService
public DefaultActuatorService()
-
-
Method Details
-
getGitInfo
Returns the Git information for the Actuator endpoint.- Specified by:
getGitInfo
in interfaceActuatorService
- Returns:
- Git information including branch details and the latest commit information.
-
preparePropertyData
Prepares system properties data for the Actuator endpoint.- Specified by:
preparePropertyData
in interfaceActuatorService
- 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
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
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.
-