- Spring Boot - Google OAuth2 Sign-In
- Spring Boot - Google Cloud Platform
- Spring Boot - OAuth2 with JWT
- Securing Web Applications
- Spring Boot - Database Handling
- Rest Controller Unit Test
- Spring Boot - Unit Test Cases
- Spring Boot - Twilio
- Spring Boot - Apache Kafka
- Spring Boot - Batch Service
- Spring Boot - Web Socket
- Spring Boot - Hystrix
- Spring Boot - Sending Email
- Spring Boot - Flyway Database
- Tracing Micro Service Logs
- Spring Boot - Creating Docker Image
- Spring Boot - Enabling Swagger2
- Spring Boot - Admin Client
- Spring Boot - Admin Server
- Spring Boot - Actuator
- Spring Cloud Configuration Client
- Spring Cloud Configuration Server
- Zuul Proxy Server and Routing
- Service Registration with Eureka
- Spring Boot - Eureka Server
- Spring Boot - Enabling HTTPS
- Spring Boot - Scheduling
- Spring Boot - Internationalization
- Spring Boot - CORS Support
- Consuming RESTful Web Services
- Spring Boot - Thymeleaf
- Spring Boot - Service Components
- Spring Boot - File Handling
- Spring Boot - Rest Template
- Spring Boot - Tomcat Port Number
- Spring Boot - Servlet Filter
- Spring Boot - Interceptor
- Spring Boot - Exception Handling
- Building RESTful Web Services
- Spring Boot - Logging
- Spring Boot - Application Properties
- Spring Boot - Runners
- Spring Beans & Dependency Injection
- Spring Boot - Code Structure
- Spring Boot - Build Systems
- Spring Boot - Tomcat Deployment
- Spring Boot - Bootstrapping
- Spring Boot - Quick Start
- Spring Boot - Introduction
- Spring Boot - Home
Spring Boot Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Spring Boot - Admin Server
Monitoring your apppcation by using Spring Boot Actuator Endpoint is spghtly difficult. Because, if you have ‘n’ number of apppcations, every apppcation has separate actuator endpoints, thus making monitoring difficult. Spring Boot Admin Server is an apppcation used to manage and monitor your Microservice apppcation.
To handle such situations, CodeCentric Team provides a Spring Boot Admin UI to manage and monitor all your Spring Boot apppcation Actuator endpoints at one place.
For building a Spring Boot Admin Server we need to add the below dependencies in your build configuration file.
Maven users can add the below dependencies in your pom.xml file −
<dependency> <groupId>de.codecentric</groupId> <artifactId>spring-boot-admin-server</artifactId> <version>1.5.5</version> </dependency> <dependency> <groupId>de.codecentric</groupId> <artifactId>spring-boot-admin-server-ui</artifactId> <version>1.5.5</version> </dependency>
Gradle users can add the below dependencies in your build.gradle file −
compile group: de.codecentric , name: spring-boot-admin-server , version: 1.5.5 compile group: de.codecentric , name: spring-boot-admin-server-ui , version: 1.5.5
Add the @EnableAdminServer annotation in your main Spring Boot apppcation class file. The @EnableAdminServer annotation is used to make your as Admin Server to monitor all other microservices.
package com.tutorialspoint.adminserver; import org.springframework.boot.SpringApppcation; import org.springframework.boot.autoconfigure.SpringBootApppcation; import de.codecentric.boot.admin.config.EnableAdminServer; @SpringBootApppcation @EnableAdminServer pubpc class AdminserverApppcation { pubpc static void main(String[] args) { SpringApppcation.run(AdminserverApppcation.class, args); } }
Now, define the server.port and apppcation name in apppcation.properties file a shown −
server.port = 9090 spring.apppcation.name = adminserver
For YAML users, use the following properties to define the port number and apppcation name in apppcation.yml file.
server: port: 9090 spring: apppcation: name: adminserver
The build configuration file is given below.
For Maven users – pom.xml
<?xml version = "1.0" encoding = "UTF-8"?> <project xmlns = "http://maven.apache.org/POM/4.0.0" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation = "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.tutorialspoint</groupId> <artifactId>adminserver</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>adminserver</name> <description>Demo project for Spring Boot</description> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.9.RELEASE</version> <relativePath /> <!-- lookup parent from repository --> </parent> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.8</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> </dependency> <dependency> <groupId>de.codecentric</groupId> <artifactId>spring-boot-admin-server</artifactId> <version>1.5.5</version> </dependency> <dependency> <groupId>de.codecentric</groupId> <artifactId>spring-boot-admin-server-ui</artifactId> <version>1.5.5</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project>
For Gradle users – build.gradle file
buildscript { ext { springBootVersion = 1.5.9.RELEASE } repositories { mavenCentral() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") } } apply plugin: java apply plugin: ecppse apply plugin: org.springframework.boot group = com.tutorialspoint version = 0.0.1-SNAPSHOT sourceCompatibipty = 1.8 repositories { mavenCentral() } dependencies { compile( org.springframework.boot:spring-boot-starter ) compile group: de.codecentric , name: spring-boot-admin-server , version: 1.5.5 compile group: de.codecentric , name: spring-boot-admin-server-ui , version: 1.5.5 testCompile( org.springframework.boot:spring-boot-starter-test ) }
You can create an executable JAR file, and run the Spring Boot apppcation by using the following Maven or Gradle commands −
For Maven, use the command shown here −
mvn clean install
After “BUILD SUCCESS”, you can find the JAR file under target directory.
For Gradle, use the command shown here −
gradle clean build
After “BUILD SUCCESSFUL”, you can find the JAR file under build/pbs directory.
Now, run the JAR file by using the command given below −
java –jar <JARFILE>
Now, the apppcation has started on the Tomcat port 9090 as shown here −
Now hit the below URL from your web browser and see the Admin Server UI.
http://localhost:9090/
Advertisements