Import this library to get HTTPS capability for your spring-boot application.
If you don't want to test with your keystore, run ./gradlew clean build -x test to exclude tests. Otherwise, configure keystore proeprties in src/test/resources/application.yml and execute ./gradlew clean build.
The output folder is build/libs.
Import the library and enable component scan @ComponentScan("org.ycavatars.sboot.kit"), provide your keystore and configure these properties via these ways.
connector.https.enabledconnector.https.keystoreFileconnector.https.keystorePassconnector.https.keyAlias
If you don't know how to generate a keystore, read this section.
You have to generates a key pair (a public key and associated private key) to enable HTTPS. Before you begin, it might be better for you to read these documents: keytool - Key and Certificate Management Tool ,Use keytool to Create a Server Certificate and SSLConnectionSocketFactory java doc.
keytool -genkeypair -alias <keyAlias> -keyalg RSA -keystore <keystoreFile>.p12 -storepass <keystorePass> -validity 3650 -keysize 2048 -dname "CN=<hostname>"
Specify your own , and , and set them to
connector.attribute.keyAlias, connector.attribute.keystoreFile and
connector.attribute.keystorePass. means the host which runs your
server. If you forget to set , your client will have issues like
SSLHandshakeException.
Note that each certificate is valid for 10 years in this example
(-validity 3650). Remember to change them depends on your needs.