Gradle spring boot - /健康终端无响应

问题描述 投票:0回答:1

我有一个spring boot rest api项目 - 我无法让弹簧启动执行器/健康终端工作。它只是没有出现,当我尝试去localhost:8080 / health时,我得到一个'Whitelabel Error Page'。我已经尝试将各种属性添加到我的application.properties但似乎没有工作 - 我不需要任何自定义映射或执行器端点的身份验证。下面是我的build.gradle - 任何建议?我想我错过了什么。

谢谢。

buildscript {
    repositories {
        mavenLocal()
        maven { url = 'https://artifactory.company.com/libs-release' }
        maven { url = 'https://artifactory.company.com/libs-remote' }
        maven { url = 'https://artifactory.company.com/libs-snapshot' }
    }
    dependencies {
        classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.2'
        classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.3.RELEASE")

    }
}

plugins {
    //id 'org.sonarqube' version '2.5'
    //id 'ch.netzwerg.release' version '1.2.5'
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'java-library'
apply plugin: 'maven-publish'
apply plugin: 'org.junit.platform.gradle.plugin'


bootJar {
    baseName = 'equipment-workorder-api'
    version =  '0.1.0'
}

// Inject test phases into the main build task
build.dependsOn('test')

jar {
    from sourceSets.main.allSource + sourceSets.test.allSource + sourceSets.test.output
}

tasks.withType(JavaCompile) {
    options.encoding = 'UTF-8'
}

repositories {
    mavenLocal()

    maven {
        name "libs-release"
        url "https://artifactory.company.com/libs-release"
    }
    maven {
        name "libs-snapshot"
        url "https://artifactory.company.com/libs-snapshot"
    }
    maven {
        name "libs-remote"
        url "https://artifactory.company.com/libs-remote"
    }
    maven {
        name "spring-milestones"
        url "http://repo.spring.io/milestone"
    }
    maven {
        name "jitpack.io" // this is for spring-test-junit5, remove once we upgrade to spring 5
        url "https://jitpack.io"
    }
    maven { url "http://repo.maven.apache.org/maven2" }
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
    //Spring Boot
    compile group: "org.springframework.boot", name: "spring-boot-actuator", version: "1.5.8.RELEASE"
    compile group: "org.springframework.boot", name: "spring-boot-configuration-processor", version: "1.5.8.RELEASE"


    //Logging
    implementation 'org.slf4j:slf4j-api:1.7.25'
    implementation 'org.projectlombok:lombok:1.16.16'
    compile group: 'log4j', name: 'log4j', version: '1.2.17'


    //JUnit / Mockito
    testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version:'5.0.2'
    testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-params', version:'5.0.2'
    testImplementation group: 'org.mockito', name: 'mockito-all', version: '1.10.19'
    testRuntime("org.junit.jupiter:junit-jupiter-engine:5.0.2")

    //Swagger
    compile group: 'io.springfox', name: 'springfox-swagger2', version: '2.9.2'
    compile group: 'io.springfox', name: 'springfox-swagger-ui', version: '2.9.2'


}


}
spring-boot spring-boot-actuator
1个回答
0
投票

由于您希望通过HTTP获取运行状况,您可能希望添加此依赖项并尝试:

compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '1.5.8.RELEASE'
© www.soinside.com 2019 - 2024. All rights reserved.