【问题标题】:Spring GCP Datastore interface: setting the namespace?Spring GCP Datastore 接口:设置命名空间?
【发布时间】:2021-06-04 01:32:34
【问题描述】:

我想使用 Spring DatastoreOperations 接口(com.google.cloud.spring.data.datastore.core.DatastoreTemplate.save() 方法)将实体保存到 Google Datastore。但是,我还需要指定数据存储命名空间,因为我的数据存储在每个用户的单独命名空间中。这完全有可能使用 Spring 抽象吗?当我在 application.properties (spring.cloud.gcp.datastore.namespace=...) 中对命名空间进行硬编码时它可以工作,但显然我需要根据请求在运行时设置它。

【问题讨论】:

    标签: spring google-cloud-platform namespaces datastore


    【解决方案1】:

    好的,我想我找到了解决方案:实现一个 DatastoreNamespaceProvider 类型的 bean 似乎正好解决了这个需求。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-12-30
      • 1970-01-01
      • 1970-01-01
      • 2012-07-19
      相关资源
      最近更新 更多