LazyInitializationException(could not initialize proxy - no Session)が画面では出ないのにバッチやテストで出る理由
画面からは問題なく動いているサービスのメソッドを、夜間バッチ(とテスト)から呼んだところ、次の例外が出ました。 Spring Boot 3.x(Hibernate 6.6)のメッセージです。 ...
画面からは問題なく動いているサービスのメソッドを、夜間バッチ(とテスト)から呼んだところ、次の例外が出ました。 Spring Boot 3.x(Hibernate 6.6)のメッセージです。 ...
一括登録の処理で例外が出たのに、途中まで登録したデータがデータベースに残っていました。登録のメソッドには @Transactional を付けています。 調べると、ロールバックされない原因は2つありました。どちらもエラーは出ず、テストで例外の発生だけを確かめていると気付けません。 ...
Spring Boot のバージョンを上げたところ、コードは何も変えていないのに、起動時に次のエラーが出るようになりました。 *************************** APPLICATION FAILED TO START *************************** Description: The dependencies of some of the beans in the application context form a cycle: ┌─────┐ | inventoryService (field private com.example.demo.OrderService com.example.demo.InventoryService.orderService) ↑ ↓ | orderService (field private com.example.demo.InventoryService com.example.demo.OrderService.inventoryService) └─────┘ Action: Relying upon circular references is discouraged and they are prohibited by default. Update your application to remove the dependency cycle between beans. As a last resort, it may be possible to break the cycle automatically by setting spring.main.allow-circular-references to true. 結論:Spring Boot 2.6 から、Bean 同士の循環参照が既定で禁止されました。 2.5 までは Spring が自動で循環を解決していたので、昔から循環していたコードがバージョンアップで表に出ます。設定で以前の動きに戻せますが、本来は循環そのものをなくします。 ...
Spring Boot 3 へ移行した後、一部の画面だけ入力チェックが効かなくなりました。必須項目を空にして送っても、エラーにならずに登録処理まで進みます。 エラーメッセージが一切出ない のがこの問題の厄介なところです。 ...
開発 PC では動く Spring Boot のアプリが、検証サーバーで java -jar すると次のエラーで起動しませんでした。 エラー: メイン・クラスorg.springframework.boot.loader.launch.JarLauncherのロード中にLinkageErrorが発生しました java.lang.UnsupportedClassVersionError: org/springframework/boot/loader/launch/JarLauncher has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0 ビルドする側の Java が古いと、Maven では次のエラーになります。 ...