Scrivio Interview library

Application startup and lifecycle

17 questions in 6 subtopics.

SpringApplication.run

InternalsFoundations5 min read
Describe what SpringApplication.run does from the call in main until the application is ready.
CodingIntermediate5 min read
How do you customise startup without changing application.yml, for example setting a default profile, adding a listener and disabling the banner? Show code using SpringApplication or SpringApplicationBuilder.
LeadershipPrincipal5 min read
Startup time mattered little when apps were deployed a few times a year, and much more with containers and autoscaling. How has this changed the way you would choose a Java framework and runtime for the next five years?

ApplicationRunner and CommandLineRunner

ConceptFoundations5 min read
What is the difference between ApplicationRunner and CommandLineRunner, when are they called, and what happens if one throws an exception?
ScenarioIntermediate6 min read
A runner warms a cache by loading 2 million rows at startup. Kubernetes kills the pod during rollouts because it is not ready in time. What options do you have?
ScenarioAdvanced5 min read
Many services run database migrations, cache warming and remote registration in runners at startup, and rollouts are slow and fragile. What would you change at platform level?

Application events during startup

ConceptFoundations5 min read
List the main SpringApplication events in the order they are published during a successful startup of a web application.
DebuggingIntermediate5 min read
A team publishes 'service started' to a registry in a ContextRefreshedEvent listener. In tests and in a parent-child context setup the message is sent twice, and sometimes before the server accepts requests. Why, and what should they use?

Failure analyzers

DebuggingFoundations5 min read
Startup fails with a message under 'APPLICATION FAILED TO START' saying the port 8080 is already in use, followed by an 'Action' section. What produced this message, and how would you resolve the issue?
CodingIntermediate5 min read
Write a FailureAnalyzer for a custom LicenseMissingException and explain how it is registered.
DesignAdvanced6 min read
Your platform wants every service to fail fast with clear messages for common misconfigurations such as missing credentials or wrong URLs. How would you build this into the platform?

Lazy initialization

ConceptFoundations5 min read
What does spring.main.lazy-initialization=true do, and what are its downsides?
ScenarioIntermediate5 min read
A team enables lazy initialization in production to cut startup from 40 to 15 seconds. A week later a misconfigured bean causes errors for the first user of a feature. What would you recommend?
LeadershipPrincipal5 min read
Lazy initialization, AOT and other startup optimisations each change when errors appear. What long-term principle would you set for when configuration and wiring errors must surface?

Startup time analysis

DebuggingIntermediate5 min read
How would you find which beans make a Boot service take 60 seconds to start?
DesignAdvanced9 min read
Your company runs 300 Spring Boot services on Kubernetes and autoscaling is slow because pods take 45 seconds to be ready. What fleet-wide options would you evaluate?
LeadershipPrincipal7 min read
Over the next years, startup time will affect your cloud costs through autoscaling and scale-to-zero. How would you balance investment in JVM startup techniques against simply running more always-on instances?