I read this and accordingly have set:

server.http2.enabled=true

in src/main/resources/application.properties. But when I run my application I see:

2024-04-05T17:12:57.828-07:00  INFO 36432 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''

I also tested with curl and it shows HTTP 1.1:

curl -I http://localhost:8080/
HTTP/1.1 200

can anyone help me out how to use http2?

Do I need to do this?

The library directory must be made available, if not already, to the JVM library path. You can do so with a JVM argument such as -Djava.library.path=/usr/local/opt/tomcat-native/lib.

The documentation says:

Spring Boot ships by default with Tomcat 10.1.x which supports h2c and h2 out of the box.

so I wasn't sure if I need to set -Djava.library.path. My understanding is that that setting is needed if one is using libtcnative for h2 support (which I am NOT). If that is what is needed, where do I find tomcat library. Its not in /usr/local/opt on my system.

thanks a lot.

Comment From: siddhsql

additional info:

╰─$ mvn dependency:tree | grep tomcat
[INFO] |  +- org.springframework.boot:spring-boot-starter-tomcat:jar:3.1.5:compile
[INFO] |  |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:10.1.15:compile
[INFO] |  |  \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:10.1.15:compile
[INFO] |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:10.1.15:compile

Comment From: philwebb

Thanks for getting in touch, but it feels like this is a question that would be better suited to Stack Overflow. As mentioned in the guidelines for contributing, we prefer to use GitHub issues only for bugs and enhancements. Feel free to update this issue with a link to the re-posted question (so that other people can find it) or add some more details if you feel this is a genuine bug.

Comment From: siddhsql

the problem with SO is that most questions get downvoted and closed for no reason. GitHub discussions allows to connect with a better audience who have knowledge of the subject in question and can provide better answer. On SO the question was asked here and solution is to set server.http2.enabled=true which is what I did but it does not seem to work for me. do you need a MRE?

Comment From: bclozel

We don't need an MRE as we know this setup is working. You can check out these sections in the reference doc: https://docs.spring.io/spring-boot/docs/current/reference/html/howto.html#howto.webserver.configure-http2 and https://docs.spring.io/spring-boot/docs/current/reference/html/howto.html#howto.webserver.configure-ssl

If you need more help, a well written question on StackOverflow will get our attention.