Enable SSL certificate in spring boot
application.
To enable https URL first we need to create an
SSL certificate and configure the SSL certificate with spring boot application.
Create SSL certificate –
Navigate to the java
installation directory, inside bin folder there is keytool executable file.
Run below command to
generate jks file.
keytool -genkeypair -alias cert -keyalg RSA -keysize 2048
-keystore cert.jks -validity 3650
Run below command to
get the content of keystore-
keytool -list -v -keystore cert.jks
Create a spring boot application–
Copy the certificate
jks file in src/main/resources folder
Add below property in
you application.yml file
server.port: 8443
server.ssl.key-alias: cert
server.ssl.key-store-password: ********
server.ssl.key-store: classpath:cert.jks
server.ssl.key-store-provider: SUN
server.ssl.key-store-type: JKS
Now you can access the url with https
Refer below repository for project-
Enable SSL URL for web application
Refer below repository for project-
Enable SSL URL for web application
No comments:
Post a Comment