How to generate a SSL self-signed Certificate with a longer expiry date
By default, All the self-signed certificate only valid for 90 days, then you will need to renew them every 90 days, which is very troublesome.
Run the following command (where validity is the number of days before the certificate will expire):
keytool -genkey -keyalg RSA -alias selfsigned -keystore keystore.jks -storepass password -validity 360 -keysize 2048
For additional details see: How to create a self signed certificate using Java Key Tool