与微服务项目中的 Spring Boot 云配置服务器一起使用的配置服务器配置无效

时间:2021-05-28 03:19:14

标签: spring-boot kotlin microservices

<块引用>

我的微服务项目使用 springboot 和 kotlin。 我是 springBoot 微服务的新学习者。当我尝试连接时 我使用云配置服务器的 git 存储库项目我得到了这个 问题类型


APPLICATION FAILED TO START
***************************

Description:

Invalid config server configuration.

Action:

If you are using the git profile, you need to set a Git URI in your configuration.  If you have set spring.cloud.config.server.bootstrap=true, you need to use a composite configuration.
<块引用>

这些是我的文件详细信息 CloudConfigServerApplication.kt

package com.micro.cloudconfigserver

import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication
import org.springframework.cloud.config.server.EnableConfigServer
import org.springframework.cloud.netflix.eureka.EnableEurekaClient

@SpringBootApplication
@EnableEurekaClient
@EnableConfigServer
class CloudConfigServerApplication

fun main(args: Array<String>) {
    runApplication<CloudConfigServerApplication>(*args)
}
<块引用>

应用程序.yml

server:
  port: 9296

spring:
  application:
    name: CONFIG-SERVER
  cloudd:
    config:
      server:
        git:
          uri: https://github.com/nilamani6394/config-server/tree/main
            clone-on-start: true
<块引用>

我确实得到了我在 yml 中定义的配置错误 文件。我没有发现我在这个项目中犯的错误

build.gradle.kts

导入 org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
    id("org.springframework.boot") version "2.3.11.RELEASE"
    id("io.spring.dependency-management") version "1.0.11.RELEASE"
    kotlin("jvm") version "1.3.72"
    kotlin("plugin.spring") version "1.3.72"
}

group = "com.micro"
version = "0.0.1-SNAPSHOT"
java.sourceCompatibility = JavaVersion.VERSION_11

repositories {
    mavenCentral()
}

extra["springCloudVersion"] = "Hoxton.SR11"

dependencies {
    implementation("org.jetbrains.kotlin:kotlin-reflect")
    implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
    implementation("org.springframework.cloud:spring-cloud-config-server")
    implementation("org.springframework.cloud:spring-cloud-starter-netflix-eureka-client")
    testImplementation("org.springframework.boot:spring-boot-starter-test") {
        exclude(group = "org.junit.vintage", module = "junit-vintage-engine")
    }
}

dependencyManagement {
    imports {
        mavenBom("org.springframework.cloud:spring-cloud-dependencies:${property("springCloudVersion")}")
    }
}

tasks.withType<KotlinCompile> {
    kotlinOptions {
        freeCompilerArgs = listOf("-Xjsr305=strict")
        jvmTarget = "11"
    }
}

tasks.withType<Test> {
    useJUnitPlatform()
}

0 个答案:

没有答案