How to enable HTTPS in a Spring Boot Java application

how to enable HTTPS in Spring Boot - Thomas Vitale

Setting up HTTPS for Spring Boot is very easy, all you need to do is performing   the following operations:

  1. Generate a key-pair using the RSA algorithm;
  2. Generate an X.509 certificate using the keys from the previous step;
  3. Import the certificate inside the JRE archive for certificates;
  4. Set up Spring Boot to enable HTTPS.

To perform the previous operations I’ll use these technologies and tools:

  • Java JDK 8 (1.8.0_72)
  • Spring Boot 1.5.3.RELEASE
  • keytool

The last tool is provided together with the JDK, so if you have the JDK installed  you have keytoolalready available. To check it, try running the command keytool --versionfrom your Terminal prompt. Note that if you are on Windows, you might need to launch it from the \bin folder. For more information about it, you can read the official documentation.

Continue reading “How to enable HTTPS in a Spring Boot Java application”

Spring Data JPA using Hibernate and Java Configuration with Annotations

Spring Data JPA using Hibernate and Java Configuration - Thomas Vitale

In this tutorial I’ll show you how to use Spring Data JPA to integrate a relational database (PostgreSQL in my example) into a Spring Boot application.

I’ll use these technologies and tools:

  • Spring Tool Suite (STS) 3.8.4.RELEASE
  • Java 8
  • Spring Boot 1.5.3.RELEASE
  • Maven 3.3.9
  • PostgreSQL 9.6.2

1. The Project Structure

The final folder structure of our project.

The folder structure of the Spring Data JPA project as seen in STS

2. Create a new Spring Boot project

If you’re using STS, you can easily create a starter project by either selecting File > New > Spring Starter Project from the main menu or right-clicking on the Package Explorer and select New > Spring Starter Project. Continue reading “Spring Data JPA using Hibernate and Java Configuration with Annotations”