4.2.1 (TASK) Using Actuator
4.2.1 (TASK) Using Actuator
By:MadSe
• Objective :
• Steps :
By:MadSe
Making a Copy out of Previous App
By:MadSe
• As given above, access the “mycoolapp” project properties.
• Get the application folder path.
• Open the path in Windows File Explorer and create a copy
• Rename it to “Actuator_project”
• Open the project in Net Beans again.
• NOTE : Only the folder name is changed. The name of the
project will remain the same.
By:MadSe
Adding Dependency Reference in POM.xml
By:MadSe
• #36 Adding a comment
• #37 - #40 Adding reference to the actuator
By:MadSe
Adding Parameters in “Application.properties”
By:MadSe
• By default, only “/health” is exposed
• #1 Exposing all the endpoints
• #2 Enabling the customizable information for the “/actuator/info”
endpoint.
• #3 - #5 Adding info about application.
• NEXT page Compiling the app
By:MadSe
• Open the main “MyCoolApplication.java” file Run
• Check out the “Output” window
• Notice the 14 new endpoints being exposed
• Notice, the new endpoints will be prefixed with the base path
“/actuator” Next, accessing the endpoints in the browser
By:MadSe
• Above, accessing the endpoints.
• The “Info” endpoints doesn’t display any information about our app.
• Check out the other endpoints given below
By:MadSe
• We can restrict access to endpoints for security reasons.
By:MadSe
• Above, in the Output log, a security password generated
automatically to access the endpoints.
• Try accessing the endpoints given on the next page
By:MadSe
• While trying to access “/actuator/info”, we get the screen above.
• To access, put in the user as “user” and password to be the one
mentioned in the “Output” window.
By:MadSe
Restricting Access To “/health”
By:MadSe
• #8 Restricting default access to the “/health” endpoint compile
run
• Now, we will get password prompt while trying to access “/health” as
well We will not be able to access “/health” now even if we put in
the right username and password as it is restricted in the application
parameters.