Webサーバーが起動に失敗しました。ポート8080はすでに使用されていました。春ブーツ

匿名の作成者:

私はGradleのプロジェクトからWEBAPIを呼び出すようにしようとしています。

私のbuild.gradleは以下の通りです。

plugins {
    id 'org.springframework.boot' version '2.1.4.RELEASE'
    id 'java'
}

apply plugin: 'io.spring.dependency-management'

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter'
    runtimeOnly 'org.springframework.boot:spring-boot-devtools'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    compile 'org.springframework.boot:spring-boot-starter-webflux'
    compile 'org.projectreactor:reactor-spring:1.0.1.RELEASE'
}

私は、次の依存関係を削除した場合

compile 'org.springframework.boot:spring-boot-starter-webflux'

それは動作しますが、私はそれをバック追加した場合。それはとエラーになります

Web server failed to start. Port 8080 was already in use.

だから、どのように私は私がWebクライアントを使用できるように、この問題を解決するのですか?アプリケーションを実行するためにポートを必要とするWebアプリケーションではありませんので。それはmicroserviceの一種です。

私はちょうど春ブーツのWebクライアントを使用します。どのように私は、Webアプリケーションに私のspplicationを変換せずにそれを使用します。

グスタボ・ポーター:

あなたが埋め込まれたサーバが起動したくない場合は、ちょうどあなたの中に次のプロパティを設定するapplication.properties(または.yml):

spring.main.web-application-type=none

あなたのクラスパスには、Webサーバを起動するために必要なビットが含まれている場合は、春ブーツが自動的に起動します。この行動のconfigureあなたapplication.propertiesでWebApplicationTypeを無効にするには

出典:https://docs.spring.io/spring-boot/docs/current/reference/html/howto-embedded-web-servers.html

おすすめ

転載: http://43.154.161.224:23101/article/api/json?id=333616&siteId=1
おすすめ