Repository navigation
[QUERY] Is spring.cloud.azure.cosmos.content-response-on-write-enable a valid configurable property I have control over in Azure Spring Cosmos? #42590
Description
Query/Question
Is spring.cloud.azure.cosmos.content-response-on-write-enabled a valid autoconfiguration property? Should setting it to false result in the contentResponseOnWriteEnabled config option being disabled? Because I haven't gotten it to work.
I've tried it through my yaml configs like:
spring:
cloud:
azure:
cosmos:
endpoint: https://my-example-db-account.documents.azure.com:443
key: my-secret-key
database: my-db
populate-query-metrics: false
client-telemetry-enabled: false
content-response-on-write-enabled: false
And I've tried setting it while manually building up my client like what shows up in this example https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/spring/azure-spring-data-cosmos/README.md#setup-configuration-class like this:
...
@Bean
public CosmosClientBuilder getCosmosClientBuilder() {
this.azureKeyCredential = new AzureKeyCredential(key);
DirectConnectionConfig directConnectionConfig = new DirectConnectionConfig();
GatewayConnectionConfig gatewayConnectionConfig = new GatewayConnectionConfig();
return new CosmosClientBuilder()
.preferredRegions(preferredRegions)
.contentResponseOnWriteEnabled(false)
.endpoint(uri)
.credential(azureKeyCredential)
.directMode(directConnectionConfig, gatewayConnectionConfig)
.clientTelemetryConfig(
new CosmosClientTelemetryConfig()
.metricsOptions(
new CosmosMicrometerMetricsOptions()
.setEnabled(false)
)
.diagnosticsHandler(CosmosDiagnosticsHandler.DEFAULT_LOGGING_HANDLER));
}
...But neither seem to flip this option off according to the application output on startup once it builds the client:

Disabling this option shows up in the recommended SDK best practices for performance, and it's listed as a valid configuration here: https://learn.microsoft.com/en-us/azure/developer/java/spring-framework/configuration-properties-azure-cosmos-db
Any ideas?
Why is this not a Bug or a feature Request?
I'm trying to gather more information on if I'm doing something wrong or if this is just expected behavior.
Setup (please complete the following information if applicable):
- OS: macOS, jdk21 (oracle open jdk 21.0.5)
- Library/Libraries:
org.springframework.boot:spring-boot-starter-parent:3.3.3com.azure.spring:spring-cloud-azure-dependencies:5.17.1org.springframework.cloud:spring-cloud-dependencies:2023.0.3com.azure.spring:spring-cloud-azure-starter-data-cosmoscom.azure.spring:spring-cloud-azure-starter-actuator
Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report
- Query Added
- Setup information Added
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsTodo
Activity
[-][QUERY] Is spring.cloud.azure.cosmos.content-response-on-write-enable a valid configurable property I have control over?[/-][+][QUERY] Is spring.cloud.azure.cosmos.content-response-on-write-enable a valid configurable property I have control over in Azure Spring Cosmos?[/+]joshfree commentedon Oct 28, 2024
Kushagra Thapar (@kushagraThapar) could you please route Tony Murillo (@MapFilterMagic)'s inquiry?
kushagraThapar commentedon Oct 28, 2024
Tony Murillo (@MapFilterMagic) you cannot set it to false in spring-data-cosmos. The reason behind this is because the contract with spring data framework is to return the entity that was saved when writing to the database. In order to follow the contract, we cannot set this to false.
MapFilterMagic commentedon Oct 28, 2024
Is this stated anywhere in the documentation? I feel like it showing up under the spring cloud properties is misleading? I could be wrong though.
kushagraThapar commentedon Oct 29, 2024
It's not documented anywhere, since this is implementation detail. Regardless, I agree with you, it should not show up in the spring cloud properties since it gets overwritten anyway in spring data cosmos SDK.
Rujun Chen (@rujche) / Xiaolu Dai (@saragluna) can we please fix this? The flag
spring.cloud.azure.cosmos.content-response-on-write-enabledshould not be exposed at all.saragluna commentedon Oct 30, 2024
Got it, since it will be a breaking change, we will remove it in our next major release.