Skip to content
Preptima

Spring Boot interview questions

Auto-configuration mechanics, configuration precedence, actuator, and production-readiness concerns.

5 questions in Java & Spring.

medium5

mediumScenarioConcept

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.

4 minmid, senior
mediumConceptCoding

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.

4 minmid, senior, staff