問題タブ [spring-boot-test]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票する
2 に答える
4686 参照

spring-boot - アプリケーション タイプをリアクティブに設定すると、Spring Boot 統合テストを開始できませんでした

Spring Boot 2.0.0.M3 経由で Spring Webflux を使用するアプリケーションがあります。

アプリケーションは、実行時にREACTIVEタイプとして設定されます。

メイン アプリケーションを実行している場合、リアクティブ アプリは正常に動作します。しかし、春のブート統合テストでこのアプリを起動できませんでした。

以下のようにテストを宣言しました。

テスト ケースを実行すると、以下のエラーが発生しました。

java.lang.IllegalStateException: ApplicationContext のロードに失敗しました

intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51) com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242) com.intellij.rt.execution. junit.JUnitStarter.main(JUnitStarter.java:70) 原因: org.springframework.context.ApplicationContextException: リアクティブ Web サーバーを起動できません。ネストされた例外は org.springframework.context.ApplicationContextException: Unable to start ReactiveWebApplicationContext due to missing ReactiveWebServerFactory Bean です。org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.onRefresh(ReactiveWebServerApplicationContext.java:64) で org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) で org.springframework.boot.ReactiveWebServerFactory Bean が見つからないため、ReactiveWebApplicationContext を開始できません。 org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.getWebServerFactory(ReactiveWebServerApplicationContext.java:103) で org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.createWebServer(ReactiveWebServerApplicationContext.java:87) で org.springframework .boot.web.reactive.context.ReactiveWebServerApplicationContext.onRefresh(ReactiveWebServerApplicationContext.java:61) ... 44 詳細

webflux でスプリング ブート統合テストを実行するための構成上の問題はありますか?

ここから完全なデモ プロジェクトにアクセスできます。

0 投票する
1 に答える
907 参照

java - Spring Boot 2 M3 - MyBatis 1.3.0 - テスト - プロパティ 'sqlSessionFactory' または 'sqlSessionTemplate' が必要です

Test クラスを実行しているときにのみ、次のエラーが発生します。これは Spring Boot 2 (現時点では M3) でのみ発生しますが、Spring Boot 1.5.3 では問題ありません。MyBatis 1.3.1-SNAPSHOT は利用できない/公開されていないようなので、1.3.0 を使用します。

また、JNDI ルックアップを使用して外部 Tomcat を起動する場合、これまでのところ問題はありません。マッパーと Bean は正常にロードされます。

build.gradle

アプリケーション.java

アプリケーションのプロパティ

application-local.properties (ローカル展開で取得)

ApplicationTests.java

application-test.poperties (テストの起動時に取得)

Spring Boot 2 に切り替えるときのこの構成の何が問題になっていますか?

プロジェクトは近日中に Github で利用できるようになります。

0 投票する
1 に答える
1467 参照

spring - 埋め込みMongoを使用したSpring Boot:要求されたアドレスを割り当てることができません:JVM_Bind

MongoとKafkaが埋め込まれたSpring BootのJUnitテストをセットアップしようとしています:-

src/test/resources/application.yml :-

問題

ここで何が間違っていますか?

バージョン:-