Enable https in Spring Boot
· One min read
-
Create Self Signed SSL Certificate
keytool -genkeypair -alias filenameAlias -keyalg RSA -keysize 2048 -storetype PKCS12 -keystore filename.p12 -validity 3650And use below code to view certificate details.
keytool -list -keystore filename.p12 -
Enabling HTTPS in Spring Boot application.propreties
# The format used for the keystore. for JKS, set it as JKSserver.ssl.key-store-type=PKCS12# The path to the keystore containing the certificateserver.ssl.key-store=classpath:keystore/javadevjournal.p12# The password used to generate the certificateserver.ssl.key-store-password=use the same password which we added during certificate creation# The alias mapped to the certificateserver.ssl.key-alias=javadevjournal# Run Spring Boot on HTTPS only, default 443 like no https 80 portserver.port=8443
Note that you need copy filename.p12 to src/main/resources/keystore folder