Reputation: 73
I want to save an entity into Google Datastore using the Spring DatastoreOperations interface (com.google.cloud.spring.data.datastore.core.DatastoreTemplate.save() method). However, I also need to specify the datastore namespace, as I my data is stored in a separate namespace for each user. Is this at all possible using the Spring abstraction? It works when I hardcode the namespace in application.properties (spring.cloud.gcp.datastore.namespace=...) but obviously I need to set it at runtime depending on the request.
Upvotes: 0
Views: 414
Reputation: 73
Ok, I think I found the solution: implementing a bean of type DatastoreNamespaceProvider seems to address exactly this need.
Upvotes: 1