O'Reilly logo

Learning Spring Boot by Greg L. Turnquist

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Configuring embedded Tomcat to use SSL

So far, we have built up an application with method-level security, alternate profiles of dev and production configuration, and wired up a MySQL server with Spring Security data loaded through Spring Boot scripts. The final touch to make our application secure from end to end would be to switch on SSL in the embedded Tomcat server.

Security is a multilevel process. Protecting assets with username / password / role controls is inadequate if anyone can snoop the network and steal credentials. Let's see how to prevent this.

The following class, SecureTomcatConfiguration, shows us how to create two Tomcat connectors. One is for unsecured HTTP on port 8080, and the other is for secured HTTPS on port 8443:

package ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required