User-configurable global properties of Cloud Datastore.
Code not running in App Engine Standard can use the Cloud Datastore API by making a single
call to #setConfig before accessing any other classes from com.google.appengine.api. For example:
Clears the CloudDatastoreRemoteServiceConfig instance (if one has been set) as well as
the ApiProxy's EnvironmentFactory and the Environment for the current
thread.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-03 UTC."],[[["\u003cp\u003e\u003ccode\u003eCloudDatastoreRemoteServiceConfig\u003c/code\u003e allows for user-configurable global properties for Cloud Datastore.\u003c/p\u003e\n"],["\u003cp\u003eCode outside App Engine Standard needs to call \u003ccode\u003esetConfig\u003c/code\u003e to use the Cloud Datastore API before accessing any other classes from \u003ccode\u003ecom.google.appengine.api\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003esetConfig\u003c/code\u003e method is used to establish the \u003ccode\u003eCloudDatastoreRemoteServiceConfig\u003c/code\u003e instance.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eclear\u003c/code\u003e method is available to remove the current \u003ccode\u003eCloudDatastoreRemoteServiceConfig\u003c/code\u003e instance, and is intended only for use within tests.\u003c/p\u003e\n"],["\u003cp\u003eA builder method, \u003ccode\u003ebuilder()\u003c/code\u003e, is provided to create a new \u003ccode\u003eCloudDatastoreRemoteServiceConfig.Builder\u003c/code\u003e instance.\u003c/p\u003e\n"]]],[],null,["# Class CloudDatastoreRemoteServiceConfig (2.0.0)\n\n public abstract class CloudDatastoreRemoteServiceConfig\n\nUser-configurable global properties of Cloud Datastore.\n\nCode not running in App Engine Standard can use the Cloud Datastore API by making a single\ncall to [#setConfig](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.CloudDatastoreRemoteServiceConfig#com_google_appengine_api_datastore_CloudDatastoreRemoteServiceConfig_setConfig_) before accessing any other classes from [com.google.appengine.api](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api). For example: \n\n\n public static void main(Strings[] args) {\n CloudDatastoreRemoteServiceConfig config = CloudDatastoreRemoteServiceConfig.builder()\n .appId(AppId.create(Location.US_CENTRAL, \"my-project-id\"))\n .build();\n CloudDatastoreRemoteServiceConfig.setConfig(config);\n DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();\n ...\n }\n \nOutside of tests, the config should not be cleared once it has been set. In tests, the config can\nbe cleared by calling [#clear](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.CloudDatastoreRemoteServiceConfig#com_google_appengine_api_datastore_CloudDatastoreRemoteServiceConfig_clear_): \n\n\n {@literal @}Before\n public void before() {\n CloudDatastoreRemoteServiceConfig config = CloudDatastoreRemoteServiceConfig.builder()\n .appId(AppId.create(Location.US_CENTRAL, \"my-project-id\"))\n .emulatorHost(...)\n .build();\n CloudDatastoreRemoteServiceConfig.setConfig(config);\n }\n\n {@literal @}After\n public void after() {\n CloudDatastoreRemoteServiceConfig.clear();\n }\n \nBy default, this configuration uses [application-default\ncredentials](https://developers.google.com/identity/protocols/application-default-credentials). \n\nInheritance\n-----------\n\n[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \\\u003e CloudDatastoreRemoteServiceConfig \n\nInherited Members\n-----------------\n\n[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) \n[Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) \n[Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) \n[Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) \n[Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) \n[Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) \n[Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) \n[Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) \n[Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) \n[Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) \n[Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)\n\nStatic Methods\n--------------\n\n### builder()\n\n public static CloudDatastoreRemoteServiceConfig.Builder builder()\n\nReturns a [CloudDatastoreRemoteServiceConfig.Builder](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.CloudDatastoreRemoteServiceConfig.Builder).\n\n### clear()\n\n public static void clear()\n\nClears the [CloudDatastoreRemoteServiceConfig](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.CloudDatastoreRemoteServiceConfig) instance (if one has been set) as well as\nthe [ApiProxy](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.apphosting.api.ApiProxy)'s EnvironmentFactory and the Environment for the current\nthread.\n\nThis method should only be called in tests.\n\n### setConfig(CloudDatastoreRemoteServiceConfig config)\n\n public static void setConfig(CloudDatastoreRemoteServiceConfig config)\n\nSets the [CloudDatastoreRemoteServiceConfig](/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.CloudDatastoreRemoteServiceConfig) instance.\n\nConstructors\n------------\n\n### CloudDatastoreRemoteServiceConfig()\n\n public CloudDatastoreRemoteServiceConfig()"]]