Skip to content
Preptima

Top 6 Spring boot Interview Questions

Browse 6 real-world technical and behavioral interview questions about Spring boot. Review scenarios, edge cases, and architectural best practices.

After a Spring Boot upgrade the app refuses to start with a circular reference between two services. Do you turn the check off?

Spring Boot has prohibited circular references by default since 2.6. Setting spring.main.allow-circular-references=true restores the old behaviour, defensible only as a dated stopgap. The fix is to break the cycle, usually by extracting what both services need, and to use constructor injection so new cycles fail fast.

mediumscenario

Your Spring Boot service needs 50 seconds to start and Kubernetes keeps killing it before it is ready. What do you change, and in which order?

First stop the kills: add a Kubernetes startup probe with a budget longer than the worst observed start, and point liveness and readiness at Actuator's separate health groups. Then measure where the 50 seconds goes before tuning, because lazy initialisation only moves the cost onto the first requests.

mediumscenario

A property has one value in application.yml, another in production, and nobody can say where the production value comes from. How do you find out?

Ask the running application, not the files. Actuator's env endpoint queried for that property lists the property sources in precedence order with the value each holds, the first holder winning. Then trace it: an environment variable matched by relaxed binding, a profile file, a command-line argument or a JVM system property.

mediumscenario

Security review asks which Actuator endpoints are exposed in production. What do you expose, to whom, and which one quietly leaks secrets?

Expose health to the platform, metrics to the scraper, and nothing else over HTTP without authentication, ideally on a separate management port. The quiet leak is heapdump: masking protects the env and configprops responses, but a heap dump holds every secret, token and customer record in memory unmasked.

mediumscenario

Why would you bind configuration with @ConfigurationProperties rather than @Value, and how do you make a bad value fail at startup instead of at the first request?

@Value injects one expression per field with no grouping, no relaxed name matching and no validation. @ConfigurationProperties binds a whole subtree onto a typed object, matches names loosely, handles lists and nested types, and combined with @Validated it fails the context refresh when the environment is wrong.

mediumconcept

How does Spring Boot auto-configuration decide what to create, and how do you override it?

Spring Boot auto-configuration loads candidate classes from AutoConfiguration.imports, applies conditional annotations, and backs off when your own beans or properties already define the needed behavior.

mediumconcept