在多重构建项目中,Spring Boot执行器的默认端点映射错误

我们在下面为Spring Boot 2项目设置了

  1. Coreservices –包含整个应用程序的Spring Boot域对象:具有自己的Gradle构建配置的输出JAR

  2. 奖励-包含与奖励模块相关的文件(控制器,服务(业务逻辑服务),视图) :输出WAR-取决于上述coreservices,也具有自己的gradle构建属性

当我验证奖励应用程序的执行器端点

例如:http://localhost:8080/rewards/actuator/info-获取核心服务构建信息,而不是奖励应用构建细节

什么可能导致执行器获取核心服务的详细信息而不是奖励?

奖励build.gradle

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

apply plugin: 'io.spring.dependency-management'
group = 'com.rewards'
version = '0.0.1-snAPSHOT'
sourceCompatibility = '1.8'

bootJar {
   archiveName = "$baseName.$extension"
}

bootWar {
   archiveName = "$baseName.$extension"
}

configurations {
    developmentOnly
    runtimeclasspath {
        extendsFrom developmentOnly
    }
    compileonly {
        extendsFrom annotationProcessor
    }
}

// repo configs

ext {
    set('springBootAdminVersion',"2.1.5")
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-actuator'
    implementation 'org.springframework.boot:spring-boot-starter-batch'
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    implementation 'org.springframework.boot:spring-boot-starter-jdbc'
    implementation 'org.springframework.boot:spring-boot-starter-jersey'
    implementation 'org.springframework.boot:spring-boot-starter-quartz'
    implementation 'org.springframework.boot:spring-boot-starter-security'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.springframework.boot:spring-boot-starter-web-services'
    implementation 'de.codecentric:spring-boot-admin-starter-client'
    implementation 'de.codecentric:spring-boot-admin-starter-server'
    developmentOnly 'org.springframework.boot:spring-boot-devtools'
    // runtimeonly 'mysql:mysql-connector-java'
    runtimeonly 'mysql:mysql-connector-java:5.1.34'
    annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
    providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    testImplementation 'org.springframework.batch:spring-batch-test'
    testImplementation 'org.springframework.security:spring-security-test'

    compile 'com.aniketh.platform:coreservices:0.0.1-snAPSHOT'

}

dependencyManagement {
    imports {
        mavenBom "de.codecentric:spring-boot-admin-dependencies:${springBootAdminVersion}"
    }
}

Coreservices build.gradle

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

group = 'com.aniketh.platform'
version = '0.0.1-snAPSHOT'
sourceCompatibility = '1.8'

configurations {
    developmentOnly
    runtimeclasspath {
        extendsFrom developmentOnly
    }
    compileonly {
        extendsFrom annotationProcessor
    }
}

bootJar {
   archiveName = "$baseName-boot"+".$extension"
   classifier = 'boot'
}

jar {
    enabled = true
    from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
    exclude 'com/aniketh/platform/coreservices/configs/**'
    /*archiveBaseName = "$baseName"
    archiveVersion = '1.0.0'*/
}

repositories {
    mavenCentral()
}

springBoot {
    mainClassname = 'com.aniketh.platform.coreservices.CoreservicesApplication'
    buildInfo()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-actuator'
    // implementation 'org.springframework.boot:spring-boot-starter-data-jdbc'
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    implementation 'org.springframework.boot:spring-boot-starter-data-rest'
    implementation 'org.springframework.boot:spring-boot-starter-jdbc'
    implementation 'org.springframework.boot:spring-boot-starter-security'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.springframework.boot:spring-boot-starter-web-services'
    developmentOnly 'org.springframework.boot:spring-boot-devtools'
    annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    testImplementation 'org.springframework.security:spring-security-test'

    compile 'io.springfox:springfox-swagger2:2.9.2'
    compile 'io.springfox:springfox-swagger-ui:2.9.2'
    compile 'org.ehcache:ehcache:3.3.1'
    compile 'javax.cache:cache-api'
    compile 'org.apache.commons:commons-lang3:3.0'
    compile 'org.slf4j:slf4j-api:1.7.25'
    compile 'commons-logging:commons-logging:1.2'
    compile 'org.apache.httpcomponents:httpclient'
    compile 'org.codehaus.jettison:jettison:1.4.0'
    compile group: 'org.apache.commons',name: 'commons-collections4',version: '4.0'
}

task sourceJar(type: Jar,dependsOn: classes) {
    classifier 'sources'
    from sourceSets.main.allSource
}

task javadocJar(type: Jar,dependsOn: javadoc) {
    classifier = 'javadoc'
    from javadoc.destinationDir
}

//upload and publish tasks
my476764515 回答:在多重构建项目中,Spring Boot执行器的默认端点映射错误

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3153486.html

大家都在问