Shipping Java services means more than passing tutorials: build reproducibility, observability, security, and JVM tuning matter in production.
Before deploy
- Pin JDK version in CI and containers; use Maven/Gradle wrapper
- Run unit + integration tests; static analysis (SpotBugs, Checkstyle)
- Externalize config (env vars, Spring profiles)—no secrets in JARs
- Health checks, structured logging (JSON), metrics (Micrometer/Prometheus)
- Dependency scanning for CVEs; keep Spring Boot baseline updated
Runtime hygiene
- Size heap and choose GC (G1 default on modern JDK); watch GC logs
- Connection pool limits for JDBC; timeouts on HTTP clients
- Graceful shutdown hooks; idempotent consumers for queues
Important interview questions and answers
- Q: How do you debug OutOfMemoryError?
A: Heap dump, analyze dominators, fix leaks or increase heap; don't only restart. - Q: 12-factor for Java?
A: Config in environment, stateless processes, logs as streams, disposable containers.
Self-check
- Where should database passwords live?
- Why use connection pools instead of new Connection per request?