Spring Admin Download Page

I am trying to understand how to use SBAP in my application, because it is a very convenient development tool. I read their handbook, but I do not understand a few things. Here is my pom for my application right now:

<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <packaging>war</packaging>

    <groupId>com.batch.books.test</groupId>
    <artifactId>test</artifactId>
    <version>0.0.1-SNAPSHOT</version>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.3.1.RELEASE</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
            <version>1.3.1.RELEASE</version>
        </dependency>
        <dependency>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-starter-web</artifactId>
          <version>1.3.1.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>1.1.3</version>
        </dependency>
        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-server</artifactId>
            <version>1.3.2</version>
        </dependency>
        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-server-ui</artifactId>
            <version>1.3.2</version>
        </dependency>
        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-starter-client</artifactId>
            <version>1.3.2</version>
        </dependency>
    </dependencies>

    <build>
        <finalName>test</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.3</version>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

And here is mine Application.java:

package app;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;

@SpringBootApplication
@EnableAdminServer
@EnableDiscoveryClient
public class Application {

    public static void main(String[] args) {
        ApplicationContext ctx = SpringApplication.run(Application.class, args);
    }

}

And my file application.yml:

info:
  version: @pom.version@
  stage: test

spring:
  application:
    name: @pom.artifactId@
  boot:
    admin:
      url: http://localhost:8080

Otherwise, I am very confused.

  • So do I register my application as a server and client?
  • How to run this application and access the admin page? They do not mention any URLs to go to the admin page. Is it simple http://localhost:8080:?
  • How do I configure this for development, but disable it during production? The help guide below says:

Is it possible to include spring-boot-admin in my business application?

tl; dr , . spring.boot.admin.context- , REST-api , . , . , .

, . , spring admin , ? 2 , 1 -, - , -?

+4
2
  • ?

. , . spring -boot-admin , .

  1. ? URL-, . : http://localhost:8080?

. spring.boot.admin.context-path, . , -, spring.boot.admin.context-path , - .

  1. , ? :...

, . dev-, qa- . . -, : @Configuration, @EnableAdminServer .

, .

+4

, Spring admin , , , , , .

SBAP - , Springboot . Infact, URL- HEALTH/METRICS ACTUATOR, MONITORED , - , .

SBAP METRICS , , , EUREKA, SBAP , - , EUREKA. YAML JAVA

@SpringBootApplication
@EnableDiscoveryClient
@EnableAdminServer
public class SpringbootAdminApplication {

   public static void main(String[] args) {
      SpringApplication.run(SpringbootAdminApplication.class, args);
   }
}

bootstrap.yml

  eureka:
    instance:
       leaseRenewalIntervalInSeconds: 10
    client:
      registerWithEureka: false
      fetchRegistry: true
      serviceUrl:
        defaultZone: http://localhost:8761/eureka/
  spring:
    boot:
     admin:
       url: http://localhost:8080
    cloud:
      config:
        enabled: false

, SpringBoot, SBAP, " http://localhost:8080" .

+1

Source: https://habr.com/ru/post/1625157/


All Articles