Enable https in Spring Boot

August 20th, 2018

  1. Create Self Signed SSL Certificate

    keytool -genkeypair -alias filenameAlias -keyalg RSA -keysize 2048 -storetype PKCS12 -keystore filename.p12 -validity 3650

    And use below code to view certificate details.

    keytool -list -keystore  filename.p12
  2. Enabling HTTPS in Spring Boot application.propreties

    # The format used for the keystore. for JKS, set it as JKS
    # The path to the keystore containing the certificate
    # The password used to generate the certificate
    server.ssl.key-store-password=use the same password which we added during certificate creation
    # The alias mapped to the certificate
    # Run Spring Boot on HTTPS only, default 443 like no https 80 port

Note that you need copy filename.p12 to src/main/resources/keystore folder