Embedded servers
20 questions in 7 subtopics.
Tomcat, Jetty, Undertow and Netty
How do you switch a Spring MVC application from Tomcat to Jetty in Maven, and which server does WebFlux use by default?Teams want to choose their own embedded servers: some Tomcat, some Jetty, some Netty. Should the platform allow this?Boot 4 drops support for an embedded server that some of your services use. What does this teach about choosing less common components, and how would you plan the change?Server thread pools
Explainserver.tomcat.threads.max, server.tomcat.accept-count and server.tomcat.max-connections. What happens when all are reached?Under load a service's latency jumps to 30 seconds while CPU is at 20 percent. A thread dump shows all 200 Tomcat threads waiting in HikariPool.getConnection. What is happening, and what would you change?Java servers moved from thread-per-request to event loops and reactive stacks, and now back to blocking code with virtual threads. What does this history teach you about choosing a concurrency model for long-lived systems?Graceful shutdown
What doesserver.shutdown=graceful do and which properties control it?During every Kubernetes rolling deploy a few requests fail with connection reset, although graceful shutdown is enabled. What is wrong and how do you fix it?Graceful shutdown and connection draining problems appear in many incidents during deploys. What long-term standards would you set so that deploys are invisible to users?HTTP/2 and compression
How do you enable HTTP/2 and response compression in a Spring Boot application, and what are the conditions?A team enables gzip compression on all responses, including those containing CSRF tokens and user data over HTTPS. A security reviewer raises a concern. What is it, and what would you decide?SSL bundles
Configure HTTPS for a Spring Boot server using a PEM certificate and key with SSL bundles.Certificates in your services expire every 90 days and restarts for renewal cause incidents. How would you use SSL bundles to fix this, both for the server and for outgoing clients?TLS is terminated in different places across your services: at the load balancer, a service mesh and the application. How would you decide a standard and where SSL bundles fit?Virtual threads on the server
What doesspring.threads.virtual.enabled=true change in a Spring Boot 3.2+ application on Java 21?After enabling virtual threads, a service handles more concurrent requests, but the database starts rejecting connections and a third-party client is overloaded. What happened and what do you do?Would you enable virtual threads by default for all MVC services in your organisation? How would you roll it out?Server port and context path
How do you set the server port and context path in Spring Boot, how do you start on a random port in tests, and how does the application find out which port it got?A Spring Boot service behind a load balancer is deployed withserver.servlet.context-path=/orders. Redirects after login go to http://internal-host:8080/login instead of the public https URL, and links in HAL responses are wrong. Explain and fix.Teams use different context paths and ports for their services (some /, some /api, some /service-name), which complicates gateway routing, health checks and documentation. What standard would you set?No question matches these choices.