·
Let's create a mini application that self monitor with SpringBoot Admin.
1️⃣ Create the project in Spring Initilizr: https : // start .spring .io
Choose the following dependencies:
👉 Codecentric's Spring Boot Admin (Client)
👉 Codecentric's Spring Boot Admin (Server)
👉 Spring Web
2️⃣ Code the app
👉 the controller
package com.vv.controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; @RestController public class GreetController { @GetMapping("/greet") public String greet() { return "Hi!! there..."; } }
👉 the application
import de.codecentric.boot.admin.server.config.EnableAdminServer; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication @EnableAdminServer public class SpringBootAdminApplication { public static void main(String[] args) { SpringApplication.run(SpringBootAdminApplication.class, args); } }
👉 set the properties
server.port=8060
spring.application.name=greet-service
spring.boot.admin.client.url=http : // localhost : 8060
management.endpoints.web.exposure.include=*3️⃣ Now you should be good!
Start the app (run SpringBootAdminApplication)
Go to http : // 192. 168. 1. 10: 8060/wallboard
BIM! your app is monitored...
#java #springboot #admin #springbootadmin