Languages
[Edit]
EN

Spring Boot 2 - example APR native library configuration with Tomcat 9 (Http11AprProtocol + upgrade to HTTP2)

6 points
Created by:
Kara
601

In this article, we would like to show how in simple way configure APR native library with Spring Boot 2 (Tomcat 9).

Spring Boot 2 with Tomcat 9 APR native libary.
Spring Boot 2 with Tomcat 9 APR native libary.

Motivation to use APR native libraries is better connection management performance.

 

Using the below configuration you can:

  • use APR native library with Tomcat 9 (under Spring Boot 2 application),
  • enable HTTPS (or HTTP),
  • enable HTTP2 support,
  • enable HTTP/HTTPS conpression (gzip or brotli),
  • use only *.pem certificate and private key when APR is enabled.

Repository: GutHub

 

Used software

Edit

The application was run using:

 

APR installation

Edit

1) Under Debian (or: Ubuntu)

Edit

Run the command:

2) Uder Windows

Edit
  1. download native libaries (download link 1, download link 2 or direct link)
  2. extract tomcat-native-2.0.3-openssl-3.0.8-win32-bin.zip archive,
  3. paste extracted directory into C:\Program Files directory (or: C:\Program Files (x86)).

 

Project configuration

Edit

It is necessary to add additional configurations to the application.properties file and paste TomcatAprConfig.java file into your web application configurations.

application.properties file:

 

TomcatAprConfig.java file:

 

Application building

Edit

Run the command:

Note: consider to use absolute paths to certificates and do not store them inside *.jar file.

 

Application running

Edit

Depending on operating system we need to indicate where APR libaries are installed.

1) Under Debian (or: Ubuntu)

Edit

Run the command:

Note: be sure the APR is installed in /usr/lib/x86_64-linux-gnu directory.

2) Uder Windows

Edit

Run the command:

Note: use C:\\Program Files\\tomcat-native-2.0.3-openssl-3.0.8-win32-bin\\bin path under x86.

 

References

Edit
  1. Apache Portable Runtime (APR) based Native library for Tomcat
  2. http://tomcat.apache.org/native-doc
1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join