Tài liệu của tôi

Thanh bên đa gốc

flex-layout

  • Getting Started

  • Guides

  • Reference

typed-rx-http

  • Getting Started

  • Guides

  • Reference

global-rx-state

  • Getting Started

  • Guides

  • Reference

webflux-fe-dev-assistant

reactive-mongo-dsl

Execution Context & Resolver

Giải thích cách MongoTemplateResolver chọn MongoExecutionContext theo key và DriverMongoExecutionContext cung cấp ranh giới database, session, mapping.


Hợp đồng MongoTemplateResolver
MongoTemplateResolver.java
java

ReactiveMongoDsl<K>는 key마다 MongoExecutionContext를 가져옵니다. MongoExecutionContextMongoDatabase, ClientSession, collection naming, entity ↔ Document mapping과 save lifecycle hook의 경계를 담당합니다.

DriverMongoExecutionContext
java

기본 collection 이름은 entity simple class name을 decapitalize해서 결정합니다. 프로젝트의 실제 naming 규칙이 다르면 생성자에 collection-name resolver를 전달합니다.

Đặt tên Collection
java

Nếu tên collection cố định hoàn toàn trong suốt vòng đời ứng dụng, có thể sử dụng DriverMongoExecutionContext.cachedCollectionNameResolver(...). Không sử dụng helper cache cho resolver có tên thay đổi theo tenant/request/time.

Phạm vi Session và giao dịch

ClientSession được tạo ra trong getTxJob(...) chỉ được truyền qua MongoExecutionContext#getSessionScope() cho cùng một thực thi DSL. DriverMongoExecutionContext mặc định sử dụng MongoClient của riêng mình làm phạm vi session.

© 2026 Byeolnaerim. Bảo lưu mọi quyền.Giới thiệuChính sách xử lý thông tin cá nhân