Spring-Boot: Connect to Cassandra Using SSL encryption
The aim of this blog is to connect to Cassandra having encryption(SSL) enabled. I am going to provide steps to build a spring boot application and connect it to Cassandra. So let’s begin.
Adding Maven Dependencies
Add the following dependency in maven to connect to Cassandra
Now that dependency is added we are going to start coding. We are going to use CassandraTemplate. This class creates a Cassandra session based on the configuration provided in application.properties. Following are the Cassandra connection properties
Now that all configuration is done, we are ready to write some code. So the first thing we are going to do is create a POJO class and map it to table property.
Now add following lines of code in Java class.
And the following is one example of how to use it in code
Implementation of the above code can be found here.