問題タブ [spring-boot-2]
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.
java - Spring Boot 2.2.5 アプリケーションでファイルをアップロードするときの MalformedStreamException
アプリケーションで Spring Boot を 2.2.4 から 2.2.5 にアップグレードした後、multipart/form-data
フォームを使用してファイルをアップロードすると、次の例外が発生します。
フォームは次のようになります。
コントローラーは次のようになります。
maven - Prometheus メトリクスがパス変数値を提供しない
プロメテウス メトリクスを生成しているスプリング ブート アプリケーションのコード サンプル。
http://localhost:8080/myApi/ABCでアクセスしようとしています。
しかし、プロメテウス メトリクスでは、"uri=/myApi/{refNum}"でメトリクスを生成しています。
プロモテウスの指標:
コントローラ:
Pom.xml
java - Java テストのコンパイル エラー: Spring Boot 1.0 を 2.0 にアップグレードするときに「bad signature ¾4s9」
次のようなgradleプロジェクトがあります。
projectA は springboot 1.0 を 2.0 にアップグレードしています
projectA gradle.build は次のようになります。
projectB test はプロジェクト A projectB gradle.buildに依存しています。次のようになります。
./gradlew :projectB:test の実行時にコンパイル エラーが発生しました
エラーメッセージは次のとおりです。
TestSupport.java は projectB
にあり、QueryManager は projectA にあります。また、querymanager クラスは lombok と ea.async を使用します。
TestSupport.java の内容は次のとおりです。
私はたくさん検索しましたが、役立つものは何も見つかりませんでした。
prometheus - Prometheus 構成が Spring ブート 2.3.0 で機能しない: ClassNotFoundException: io.micrometer.prometheus.HistogramFlavor
アプリケーションはバージョン 2.2.6 で正常に動作していましたが、アプリケーションが最新バージョンの spring boot 2.3.0 にアップグレードされると、動作が停止し、起動時に失敗します。
2020-05-20T08:43:04.408+01:00 [APP/PROC/WEB/0] [OUT] 2020-05-20 07:43:04.407 ERROR 15 --- [ main] o.s.b.web.embedded.tomcat.TomcatStarter : Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'webMvcMetricsFilter' defined in class path resource [org/springframework/boot/actuate/autoconfigure/metrics/web/servlet/WebMvcMetricsAutoConfiguration.class]: Unsatisfied dependency expressed through method 'webMvcMetricsFilter' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'compositeMeterRegistry' defined in class path resource [org/springframework/boot/actuate/autoconfigure/metrics/CompositeMeterRegistryConfiguration.class]: Unsatisfied dependency expressed through method 'compositeMeterRegistry' parameter 1; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'prometheusMeterRegistry' defined in class path resource [org/springframework/boot/actuate/autoconfigure/metrics/export/prometheus/PrometheusMetricsExportAutoConfiguration.class]: Unsatisfied dependency expressed through method 'prometheusMeterRegistry' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'prometheusConfig' defined in class path resource [org/springframework/boot/actuate/autoconfigure/metrics/export/prometheus/PrometheusMetricsExportAutoConfiguration.class]: Unsatisfied dependency expressed through method 'prometheusConfig' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'management.metrics.export.prometheus-org.springframework.boot.actuate.autoconfigure.metrics.export.prometheus.PrometheusProperties': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.springframework.boot.actuate.autoconfigure.metrics.export.prometheus.PrometheusProperties] from ClassLoader [org.springframework.boot.loader.LaunchedURLClassLoader@4f3f5b24]
java - JPA - 親がすでにフェッチされている場合、JpaRepository 子レコードにはエンティティ レコードではなく親 ID があります
私はまだ JPA の概念を把握しており、私の質問に対する答えがどこにも見つからないようです!
推定
どちらのクラスにも @GeneratedValue(strategy = GenerationType.IDENTITY) の注釈が付けられています。すべてのゲッターとセッターがあります。
次に、標準の JpaRepository を実装し、コントローラーをセットアップしました
ここに問題があり
ます すべての子レコードを照会すると、特定の親にマップされた最初の子レコードだけが親エンティティ オブジェクトを持ちます。残りは、親エンティティを参照する ID を持ちます。
次に例を示します: POSTMAN からすべての子を取得すると、次のように返されます。
ご覧のとおり、最初にその親にマップされているchild2
だけです! 同様に、最初にその親にマップされただけです!"parent": 1
child1
child4
"parent": 2
child3
誰でもこの動作を説明できますか? 親を試しfetch = FetchType.EAGER
てみましたが、役に立ちませんでした!私は、すべての子が包括的な親オブジェクトを持ち、別の DB トリップを防ぐことを期待しています。
前もって感謝します!
実際のクラスで質問を更新する:
親
子