Spring boot have some properties to config web port and SSL settings, but once a SSL certificate is set the http port turns into https port.
So, how can I keep both
Take a look at: https://github.com/creactiviti/spring-boot-starter-acme. It makes it very easy to auto-generate a LetsEncrypt based SSL certificate.
From the README:
Add the module to your pom.xml file as a dependency.
Build your project.
Deploy it to a target machine and point your domain name to the IP address of that machine. LetsEncrypt validates your ownership of the domain by making a callback to the http://your-domain/.well-known/acme-challenge/{token} endpoint exposed by this module.
Make sure that your server has openssl available on its $PATH.
To activate spring-boot-starter-acme and generate a certificate execute:
sudo java -Dserver.port=80 -Dacme.enabled=true -Dacme.domain-name=
Check your console for a confirmation that the certificate was successfully generated.
Stop your application and configure it to make use of the generated certificate:
server.port=443
server.ssl.key-store=keystore.p12
server.ssl.key-store-password=password
server.ssl.keyStoreType=PKCS12