[英]Spring GCP Datastore interface: setting the namespace?
我想使用 Spring DatastoreOperations 接口(com.google.cloud.spring.data.datastore.core.DatastoreTemplate.save() 方法)將實體保存到 Google Datastore。 但是,我還需要指定數據存儲命名空間,因為我的數據存儲在每個用戶的單獨命名空間中。 這完全可以使用 Spring 抽象嗎? 當我在 application.properties (spring.cloud.gcp.datastore.namespace=...) 中對命名空間進行硬編碼時,它可以工作,但顯然我需要根據請求在運行時設置它。
好的,我想我找到了解決方案:實現一個 DatastoreNamespaceProvider 類型的 bean 似乎正好解決了這個需求。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.