Spring Data Gremlin for Azure Cosmos DB Graph API

We are pleased to announce that Spring Data Gremlin is now available on Maven Central and source code on GitHub. This project provides Spring Data support for Graph databases that use Gremlin as a traversal language. For Azure users, it provides a delightful experience to interact with Azure Cosmos DB using Graph API. Java developers can now use Spring annotations to map with database entities, such as Vertex and Edge. It also allows developers to create their own database queries based on Spring Data Repository.

Key features

Spring Data Gremlin supports annotation-oriented programming model to simplify the mapping to the database entity. It also provides supports to create custom queries.

  • Mapping with database entities, including annotations.
    • @Id to map a filed in the domain class with id field of an entity.
    • @Vertex and @VertexSet map to Vertex.
    • @Edge, @EdgeSet, @EdgeFrom and @EdgeTo to map with Edge
  • Advanced operations with Vertex, Edge and Graph.
    • findVertexById and findEdgeById to find data by specific field.
    • vertexCount and edgeCount for counting Vertex and Edge numbers.
  • Spring Data CRUD functionality.
  • Custom database queries based on Spring Data Repository.

Getting started

You can follow this tutorial to create a Graph database instance in Azure Cosmos DB and add a new Graph in Data Explorer. Use the URI and Keys on the overview page to configure your project.

1st snapshot

Configure your project

Include the Spring Data Gremlin library in your project, by opening the pom.xml file and adding the following settings in the <dependencies> section. Then set up the application.yml file to connect with the Graph database you just created.


More detailed configurations are available on GitHub.

Run it

Get started with our sample! Once you’ve executed it, you can open the Azure Portal to check the updated Graph in your database.


When it’s done, read about our project on GitHub and discover more advanced features.

Next steps

More information about using Spring on Azure, visit the following pages:


Feedback and questions help us to improve. You can share your thoughts by contacting us on GitHub.

Source: Azure Blog Feed

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.