Spring Boot管理客户端在存在上下文路径时仅显示详细信息

Spring Boot管理客户端在存在上下文路径时仅显示详细信息,spring,spring-boot,spring-boot-admin,Spring,Spring Boot,Spring Boot Admin,我正在使用eureka discovery运行引导管理服务器 管理服务器: plugins { id 'org.springframework.boot' version '2.1.7.RELEASE' id 'io.spring.dependency-management' version '1.0.8.RELEASE' id 'java' } group = 'com.example' version = '0.0.1-SNAPSHOT' sourceCompati

我正在使用eureka discovery运行引导管理服务器

管理服务器:

plugins {
    id 'org.springframework.boot' version '2.1.7.RELEASE'
    id 'io.spring.dependency-management' version '1.0.8.RELEASE'
    id 'java'
}

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

repositories {
    mavenCentral()
}

ext {
    set('springCloudVersion', "Greenwich.SR2")
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.springframework.boot:spring-boot-starter-security'
    implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
    implementation 'de.codecentric:spring-boot-admin-starter-server:2.1.6'

    testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

dependencyManagement {
    imports {
        mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
    }
}
spring:
  boot.admin.discovery.converter.management-context-path: /admin
  application:
    name: spring-boot-admin-sample-eureka

eureka:   #<1>
  instance:
    leaseRenewalIntervalInSeconds: 10
    health-check-url-path: /admin/health
    metadata-map:
      startup: ${random.int}    #needed to trigger info and endpoint update after restart
      management.context-path: ${management.endpoints.web.base-path}
      info.path: ${management.endpoints.web.base-path}/info
  client:
    registryFetchIntervalSeconds: 5
    serviceUrl:
      defaultZone: ${EUREKA_SERVICE_URL:http://localhost:8761}/eureka/

management:
  endpoints:
    web:
      exposure:
        include: "*"  #<2>
  endpoint:
    health:
      show-details: ALWAYS
plugins {
    id 'org.springframework.boot' version '2.1.7.RELEASE'
    id 'io.spring.dependency-management' version '1.0.8.RELEASE'
    id 'java'
}

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

repositories {
    mavenCentral()
}

ext {
    set('springCloudVersion', "Greenwich.SR2")
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-actuator'
    implementation 'org.springframework.boot:spring-boot-starter-security'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
    // https://mvnrepository.com/artifact/org.jolokia/jolokia-core
    compile group: 'org.jolokia', name: 'jolokia-core', version: '1.6.2'

    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    testImplementation 'org.springframework.security:spring-security-test'
}

dependencyManagement {
    imports {
        mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
    }
}
管理服务器应用程序Yml:

plugins {
    id 'org.springframework.boot' version '2.1.7.RELEASE'
    id 'io.spring.dependency-management' version '1.0.8.RELEASE'
    id 'java'
}

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

repositories {
    mavenCentral()
}

ext {
    set('springCloudVersion', "Greenwich.SR2")
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.springframework.boot:spring-boot-starter-security'
    implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
    implementation 'de.codecentric:spring-boot-admin-starter-server:2.1.6'

    testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

dependencyManagement {
    imports {
        mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
    }
}
spring:
  boot.admin.discovery.converter.management-context-path: /admin
  application:
    name: spring-boot-admin-sample-eureka

eureka:   #<1>
  instance:
    leaseRenewalIntervalInSeconds: 10
    health-check-url-path: /admin/health
    metadata-map:
      startup: ${random.int}    #needed to trigger info and endpoint update after restart
      management.context-path: ${management.endpoints.web.base-path}
      info.path: ${management.endpoints.web.base-path}/info
  client:
    registryFetchIntervalSeconds: 5
    serviceUrl:
      defaultZone: ${EUREKA_SERVICE_URL:http://localhost:8761}/eureka/

management:
  endpoints:
    web:
      exposure:
        include: "*"  #<2>
  endpoint:
    health:
      show-details: ALWAYS
plugins {
    id 'org.springframework.boot' version '2.1.7.RELEASE'
    id 'io.spring.dependency-management' version '1.0.8.RELEASE'
    id 'java'
}

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

repositories {
    mavenCentral()
}

ext {
    set('springCloudVersion', "Greenwich.SR2")
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-actuator'
    implementation 'org.springframework.boot:spring-boot-starter-security'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
    // https://mvnrepository.com/artifact/org.jolokia/jolokia-core
    compile group: 'org.jolokia', name: 'jolokia-core', version: '1.6.2'

    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    testImplementation 'org.springframework.security:spring-security-test'
}

dependencyManagement {
    imports {
        mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
    }
}
应用程序Yml

server:
  port: 8083
  servlet:
    context-path: /mypath

#management config
eureka:
  instance:
    leaseRenewalIntervalInSeconds: 10
    health-check-url-path: /admin/health
    statusPageUrlPath:  /admin/info
    metadata-map:
      startup: ${random.int}    #needed to trigger info and endpoint update after restart
      management.context-path: ${management.endpoints.web.base-path}
      info.path: ${management.endpoints.web.base-path}/info
  client:
    registryFetchIntervalSeconds: 5
    serviceUrl:
      defaultZone: ${EUREKA_SERVICE_URL:http://localhost:8761}/eureka/

management:
  endpoint:
    health:
      show-details: ALWAYS
  endpoints:
    web:
      base-path: /admin
      exposure:
        include: '*'

security.basic.enabled: false

info:
  component: Processor2
  build:
    name:           Processor2
    description:    Processor to Roll up PP
    version:        1
  eureka:
    region: ${eureka.client.region}
    zone: ${eureka.instance.metadataMap.zone}
    us-east-1b: discovery1
    us-east-1c: discovery2
    us-east-1e: discovery3
dp:
  username: admin
  password: admin123

spring:
  application.name: procerssor2
  jmx:
    enabled: true

  boot:
    admin:
      client:
        instance:
          service-url: /mypath

health:
  config:
    enabled: false
由于上下文路径的原因,引导管理员只是显示了详细信息。我核实了这一点。它看起来像下面

{
    "name": "PROCERSSOR2",
    "buildVersion": null,
    "status": "UP",
    "statusTimestamp": "2019-08-28T18:32:19.854Z",
    "instances": [
      {
        "id": "804f35b9b73d",
        "version": 1,
        "registration": {
          "name": "PROCERSSOR2",
          "managementUrl": "http://192.168.0.8:8083/admin",
          "healthUrl": "http://192.168.0.8:8083/mypath/admin/health",
          "serviceUrl": "http://192.168.0.8:8083/",
          "source": "discovery",
          "metadata": {
            "management.context-path": "/admin",
            "startup": "-518261604",
            "management.port": "8083",
            "info.path": "/admin/info"
          }
        },
        "registered": true,
        "statusInfo": {
          "status": "UP",
          "details": {
            "hystrix": {
              "status": "UP"
            },
            "diskSpace": {
              "status": "UP",
              "details": {
                "total": 499963170816,
                "free": 366424887296,
                "threshold": 10485760
              }
            },
            "refreshScope": {
              "status": "UP"
            },
            "discoveryComposite": {
              "status": "UP",
              "details": {
                "discoveryClient": {
                  "status": "UP",
                  "details": {
                    "services": [
                      "procerssor2",
                      "spring-boot-admin-sample-eureka"
                    ]
                  }
                },
                "eureka": {
                  "description": "Remote status from Eureka server",
                  "status": "UP",
                  "details": {
                    "applications": {
                      "PROCERSSOR2": 1,
                      "SPRING-BOOT-ADMIN-SAMPLE-EUREKA": 1
                    }
                  }
                }
              }
            }
          }
        },
        "statusTimestamp": "2019-08-28T18:32:19.854Z",
        "info": {},
        "endpoints": [
          {
            "id": "health",
            "url": "http://192.168.0.8:8083/mypath/admin/health"
          }
        ],
        "buildVersion": null,
        "tags": {}
      }
    ]
  }

当我删除上下文路径时。一切都很好。请帮助我,我也有同样的问题。在我的例子中,我只指向
${service.servlet.context path}/exactor

server:
  port: ${service.auth-service.port}
  servlet:
    context-path: ${service.auth-service.context-path}

eureka.instance.metadata-map.management.context-path: ${service.servlet.context-path}/actuator
因此,我认为根据您的代码,它应该类似于
/admin/exactor

server:
  port: ${service.auth-service.port}
  servlet:
    context-path: ${service.auth-service.context-path}

eureka.instance.metadata-map.management.context-path: ${service.servlet.context-path}/actuator