How to give boolean value in @Container in spring data cosmos?

Viewed 323

In the below code, I am not able to set autoScale from the configuration property. I am getting errors as "expected boolean but the string is supplied".

@Container(containerName = "${dynamic.container.name}"
        , autoScale = "${dynamic.container.autoScale}", ru = "400")
public class FruitsContainer(){
.....
}

Kindly let me know how can I achieve this?

1 Answers

Simple entities are defined in Cosmos DB as items. And we can do so by adding the @Container annotation and specifying properties related to the container, like container name, request units (RUs), time to live, auto scale and so on.

  • Annotation @Container(containerName="myContainer") specifies container name in Azure Cosmos DB.

  • And by default request units (RUs) assigned to newly created containers is 400. But we can change it to customize it according to our need.

  • Lastly, annotation autoScale field describes that container to be created with autoscale throughput when set to true. Check this Microsoft Document for more information on autoscale.

If you check Creating Containers with autoscale throughput, you will find that you can achieve what you want using the following snippet-

@Container(containerName = "${dynamic.container.name}"
        , autoScale = true, ru = "400")
public class FruitsContainer(){
.....
}
Related