{"id":3654,"date":"2025-12-24T10:01:07","date_gmt":"2025-12-24T15:01:07","guid":{"rendered":"https:\/\/www.mymiller.name\/wordpress\/?p=3654"},"modified":"2025-12-24T10:01:07","modified_gmt":"2025-12-24T15:01:07","slug":"spring-boot-actuator-crafting-custom-endpoints-for-tailored-insights","status":"publish","type":"post","link":"https:\/\/www.mymiller.name\/wordpress\/springboot\/spring-boot-actuator-crafting-custom-endpoints-for-tailored-insights\/","title":{"rendered":"Spring Boot Actuator: Crafting Custom Endpoints for Tailored Insights"},"content":{"rendered":"\n<div class=\"wp-block-jetpack-markdown\"><p>Spring Boot Actuator provides a robust set of built-in endpoints for monitoring and managing your applications. However, there are scenarios where you might need to expose application-specific information or metrics beyond what the standard endpoints offer.  This is where custom actuator endpoints shine, allowing you to tailor the information you expose to suit your application\u2019s unique needs. Let\u2019s delve into the process of creating and utilizing these custom endpoints.<\/p>\n<p><strong>1. Gradle\/Maven Setup<\/strong><\/p>\n<p>To begin, ensure that your Spring Boot project includes the <code>spring-boot-starter-actuator<\/code> dependency. Here\u2019s how to add it to your <code>build.gradle<\/code> (Gradle) or <code>pom.xml<\/code> (Maven) file:<\/p>\n<p><strong>Gradle:<\/strong><\/p>\n<pre><code class=\"language-gradle\">dependencies {\n    implementation 'org.springframework.boot:spring-boot-starter-actuator'\n}\n<\/code><\/pre>\n<p><strong>Maven:<\/strong><\/p>\n<pre><code class=\"language-xml\">&lt;dependencies&gt;\n    &lt;dependency&gt;\n        &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\n        &lt;artifactId&gt;spring-boot-starter-actuator&lt;\/artifactId&gt;\n    &lt;\/dependency&gt;\n&lt;\/dependencies&gt;\n<\/code><\/pre>\n<p><strong>2. Creating Custom Endpoints<\/strong><\/p>\n<p>Spring Boot Actuator provides annotations to easily create custom endpoints:<\/p>\n<ul>\n<li><code>@Endpoint<\/code>: Marks a class as an actuator endpoint.<\/li>\n<li><code>@ReadOperation<\/code>: Annotates a method to handle HTTP GET requests.<\/li>\n<li><code>@WriteOperation<\/code>: Annotates a method to handle HTTP POST requests.<\/li>\n<li><code>@DeleteOperation<\/code>: Annotates a method to handle HTTP DELETE requests.<\/li>\n<\/ul>\n<p><strong>Example: A Simple \u201cHello\u201d Endpoint<\/strong><\/p>\n<pre><code class=\"language-java\">import org.springframework.boot.actuate.endpoint.annotation.*;\nimport org.springframework.stereotype.Component;\n\n@Component\n@Endpoint(id = &quot;hello&quot;)\npublic class HelloEndpoint {\n\n    @ReadOperation\n    public String hello() {\n        return &quot;Hello from a custom actuator endpoint!&quot;;\n    }\n}\n<\/code><\/pre>\n<p>This creates an endpoint accessible at <code>http:\/\/localhost:8080\/actuator\/hello<\/code> (assuming your application runs on port 8080) that returns the \u201cHello\u201d message.<\/p>\n<p><strong>3. Advanced Endpoint Types<\/strong><\/p>\n<p>Actuator supports more complex endpoint interactions:<\/p>\n<ul>\n<li><strong>Endpoints with Parameters:<\/strong><\/li>\n<\/ul>\n<pre><code class=\"language-java\">@ReadOperation\npublic String greet(@Selector String name) {\n    return &quot;Hello, &quot; + name + &quot;!&quot;;\n}\n<\/code><\/pre>\n<p>Access this with: <code>http:\/\/localhost:8080\/actuator\/hello\/greet?name=John<\/code><\/p>\n<ul>\n<li><strong>Endpoints Returning JSON Data:<\/strong><\/li>\n<\/ul>\n<pre><code class=\"language-java\">@ReadOperation\npublic Map&lt;String, String&gt; appInfo() {\n    Map&lt;String, String&gt; info = new HashMap&lt;&gt;();\n    info.put(&quot;appName&quot;, &quot;My Spring Boot App&quot;);\n    info.put(&quot;version&quot;, &quot;1.0.0&quot;);\n    return info;\n}\n<\/code><\/pre>\n<ul>\n<li><strong>Endpoints Accepting Input (POST):<\/strong><\/li>\n<\/ul>\n<pre><code class=\"language-java\">@WriteOperation\npublic String updateMessage(@RequestBody String newMessage) {\n    \/\/ ... logic to update a message ...\n    return &quot;Message updated successfully&quot;;\n}\n<\/code><\/pre>\n<p><strong>4. Configuring <code>application.yml<\/code><\/strong><\/p>\n<p>You can fine-tune the behavior of actuator endpoints using your <code>application.yml<\/code> or <code>application.properties<\/code> file. Here are some common configurations:<\/p>\n<pre><code class=\"language-yaml\">management:\n  endpoints:\n    web:\n      exposure:\n        include: &quot;*&quot;  # Expose all endpoints (use with caution in production)\n        exclude: &quot;env, beans&quot;  # Exclude specific endpoints\n  endpoint:\n    hello:  # Configure your custom &quot;hello&quot; endpoint\n      enabled: true\n      cache:\n        time-to-live: 10s  # Cache responses for 10 seconds\n<\/code><\/pre>\n<p><strong>5. Important Considerations<\/strong><\/p>\n<ul>\n<li><strong>Endpoint Security:<\/strong> By default, all actuator endpoints are secured. Configure Spring Security to manage access to your custom endpoints.<\/li>\n<li><strong>Endpoint IDs:<\/strong> Choose meaningful and unique IDs for your endpoints.<\/li>\n<li><strong>Technology-Specific Endpoints:<\/strong> Consider using technologies like WebFlux or RSocket to create endpoints tailored to those communication styles.<\/li>\n<\/ul>\n<p>Custom actuator endpoints offer a powerful way to extend the monitoring and management capabilities of your Spring Boot applications. By carefully crafting endpoints that expose application-specific information, you gain deeper insights into your application\u2019s behavior and health, empowering you to build more robust and maintainable systems.<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":3655,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[448],"tags":[69,319],"series":[],"class_list":["post-3654","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-springboot","tag-java-2","tag-spring"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/08\/oil-1183699_1280-jpg.avif","jetpack-related-posts":[{"id":3663,"url":"https:\/\/www.mymiller.name\/wordpress\/spring_discovery\/monitoring-microservices-health-with-spring-discovery-client-and-actuator\/","url_meta":{"origin":3654,"position":0},"title":"Monitoring Microservices Health with Spring Discovery Client and Actuator","author":"Jeffery Miller","date":"December 24, 2025","format":false,"excerpt":"In the world of microservices, where applications are decomposed into smaller, independent services, maintaining visibility into the health of each service is crucial. Spring Boot provides a powerful combination of the Spring Discovery Client and Actuator to simplify this task. In this blog post, we\u2019ll walk through building a Spring\u2026","rel":"","context":"In &quot;Spring Discovery&quot;","block_context":{"text":"Spring Discovery","link":"https:\/\/www.mymiller.name\/wordpress\/category\/spring_discovery\/"},"img":{"alt_text":"","src":"https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/08\/checklist-2077020_1280-jpg.avif","width":350,"height":200,"srcset":"https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/08\/checklist-2077020_1280-jpg.avif 1x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/08\/checklist-2077020_1280-jpg.avif 1.5x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/08\/checklist-2077020_1280-jpg.avif 2x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/08\/checklist-2077020_1280-jpg.avif 3x"},"classes":[]},{"id":3668,"url":"https:\/\/www.mymiller.name\/wordpress\/spring_discovery\/monitoring-microservices-health-with-spring-discovery-client-and-actuator-2\/","url_meta":{"origin":3654,"position":1},"title":"Monitoring Microservices Health with Spring Discovery Client and Actuator","author":"Jeffery Miller","date":"April 20, 2026","format":false,"excerpt":"In the world of microservices, where applications are decomposed into smaller, independent services, maintaining visibility into the health of each service is crucial. Spring Boot provides a powerful combination of the Spring Discovery Client and Actuator to simplify this task. In this blog post, we\u2019ll walk through building a Spring\u2026","rel":"","context":"In &quot;Spring Discovery&quot;","block_context":{"text":"Spring Discovery","link":"https:\/\/www.mymiller.name\/wordpress\/category\/spring_discovery\/"},"img":{"alt_text":"","src":"https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/09\/doctors-office-2610509_1280-jpg.avif","width":350,"height":200,"srcset":"https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/09\/doctors-office-2610509_1280-jpg.avif 1x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/09\/doctors-office-2610509_1280-jpg.avif 1.5x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/09\/doctors-office-2610509_1280-jpg.avif 2x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/09\/doctors-office-2610509_1280-jpg.avif 3x"},"classes":[]},{"id":3816,"url":"https:\/\/www.mymiller.name\/wordpress\/spring\/securing-your-spring-boot-actuator-endpoints-a-comprehensive-guide\/","url_meta":{"origin":3654,"position":2},"title":"Securing Your Spring Boot Actuator Endpoints: A Comprehensive Guide","author":"Jeffery Miller","date":"December 24, 2025","format":false,"excerpt":"Spring Boot Actuator provides invaluable insights into the inner workings of your running application. From health checks and metrics to thread dumps and environment details, these endpoints are crucial for monitoring and managing your application in production. However, exposing them without proper security can open doors to malicious actors, potentially\u2026","rel":"","context":"In &quot;Spring&quot;","block_context":{"text":"Spring","link":"https:\/\/www.mymiller.name\/wordpress\/category\/spring\/"},"img":{"alt_text":"","src":"https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2025\/04\/ai-generated-8070001_1280.avif","width":350,"height":200,"srcset":"https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2025\/04\/ai-generated-8070001_1280.avif 1x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2025\/04\/ai-generated-8070001_1280.avif 1.5x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2025\/04\/ai-generated-8070001_1280.avif 2x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2025\/04\/ai-generated-8070001_1280.avif 3x"},"classes":[]},{"id":3560,"url":"https:\/\/www.mymiller.name\/wordpress\/spng_security\/zero-trust-with-spring-boot-deep-dive-into-security\/","url_meta":{"origin":3654,"position":3},"title":"Zero Trust with Spring Boot: Deep Dive into Security","author":"Jeffery Miller","date":"April 20, 2026","format":false,"excerpt":"Zero Trust is a paradigm shift in security, assuming no inherent trust within a network. Implementing Zero Trust principles with Spring Boot fortifies your microservices against modern threats. Let\u2019s delve deeper into the key concepts: Secure Communication (HTTPS\/TLS): Encryption: HTTPS encrypts all communication between microservices, preventing eavesdropping and data tampering.\u2026","rel":"","context":"In &quot;Spring Security&quot;","block_context":{"text":"Spring Security","link":"https:\/\/www.mymiller.name\/wordpress\/category\/spng_security\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/06\/Gemini_Generated_Image_y76fbby76fbby76f.jpg?fit=1200%2C1200&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/06\/Gemini_Generated_Image_y76fbby76fbby76f.jpg?fit=1200%2C1200&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/06\/Gemini_Generated_Image_y76fbby76fbby76f.jpg?fit=1200%2C1200&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/06\/Gemini_Generated_Image_y76fbby76fbby76f.jpg?fit=1200%2C1200&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/06\/Gemini_Generated_Image_y76fbby76fbby76f.jpg?fit=1200%2C1200&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":3444,"url":"https:\/\/www.mymiller.name\/wordpress\/spring_discovery\/spring-boot-admin-server-with-spring-cloud-discovery\/","url_meta":{"origin":3654,"position":4},"title":"Spring Boot Admin Server with Spring Cloud Discovery","author":"Jeffery Miller","date":"December 24, 2025","format":false,"excerpt":"Spring Boot Admin Server is a powerful tool for monitoring and managing Spring Boot applications. It provides a centralized dashboard for viewing application health, metrics, and logs. Spring Cloud Discovery, on the other hand, enables service registration and discovery for microservices-based applications. By integrating Spring Boot Admin Server with Spring\u2026","rel":"","context":"In &quot;Spring Discovery&quot;","block_context":{"text":"Spring Discovery","link":"https:\/\/www.mymiller.name\/wordpress\/category\/spring_discovery\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2023\/11\/manhattan-3866140_640.jpg?fit=640%2C427&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2023\/11\/manhattan-3866140_640.jpg?fit=640%2C427&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2023\/11\/manhattan-3866140_640.jpg?fit=640%2C427&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":3660,"url":"https:\/\/www.mymiller.name\/wordpress\/spring_tracing\/crafting-custom-metrics-for-micrometer-tracing-a-comprehensive-guide\/","url_meta":{"origin":3654,"position":5},"title":"Crafting Custom Metrics for Micrometer Tracing: A Comprehensive Guide","author":"Jeffery Miller","date":"December 24, 2025","format":false,"excerpt":"Micrometer, a versatile application metrics facade, seamlessly integrates with Spring Boot Actuator to capture and expose vital insights into your application\u2019s performance. While Micrometer offers a plethora of pre-defined metrics, you often need to track application-specific metrics that aren\u2019t covered out of the box. This blog post will explore creating\u2026","rel":"","context":"In &quot;Spring Tracing &amp; Observability&quot;","block_context":{"text":"Spring Tracing &amp; Observability","link":"https:\/\/www.mymiller.name\/wordpress\/category\/spring_tracing\/"},"img":{"alt_text":"","src":"https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/08\/car-dashboard-2667434_1280-jpg.avif","width":350,"height":200,"srcset":"https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/08\/car-dashboard-2667434_1280-jpg.avif 1x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/08\/car-dashboard-2667434_1280-jpg.avif 1.5x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/08\/car-dashboard-2667434_1280-jpg.avif 2x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/08\/car-dashboard-2667434_1280-jpg.avif 3x"},"classes":[]}],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/posts\/3654","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/comments?post=3654"}],"version-history":[{"count":3,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/posts\/3654\/revisions"}],"predecessor-version":[{"id":3658,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/posts\/3654\/revisions\/3658"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/media\/3655"}],"wp:attachment":[{"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/media?parent=3654"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/categories?post=3654"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/tags?post=3654"},{"taxonomy":"series","embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/series?post=3654"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}