Spring Boot & Auto-configuration interview questions & answers
206+ real Spring Boot & Auto-configuration interview questions with model answers, plus free lessons to learn the concepts. Prepare in English & Hinglish, then practise with an AI mock interview.
18 topics · 206+ questions
Hirenix kaise padhata hai
Ek chapter. 90 minute.
Interview ke liye taiyaar.
Har concept ek real-world problem se — jaisa production code mein aata hai, waisa. Ratna nahi padta, samajh aa jaata hai. Har question ka model answer diya hai: interviewer ko exactly kya bolna hai, aur kyun. Phir usi chapter ka AI mock interview.
- 📖Concept, 5 min meinJargon nahi — seedhi baat
- 🛠️Real-world problemJaisa production code mein aata hai
- 💬Model answerInterview mein kya bolna hai
- 🧠FlashcardsRevision 10 min mein
- 🤖AI mock interviewFollow-up bhi poochta hai
- 📊Weak topicsKahan phans rahe ho, pata chale

Farq content ka nahi, filter ka hai — sirf wahi jo production mein actually use hota hai aur interview mein actually poocha jaata hai. Kitaabi topics jo industry mein kahin nahi chalte, wo yahan nahi milenge.
What you’ll learn
- ●Spring Boot kyun: Spring ke upar ye kya jodta hai
- ●Auto-configuration asal me kaam kaise karti hai
- SpringBootApplication aur base-package ka trapFree account
- Starters, BOM, aur dependency managementFree account
- Conditional annotations: OnClass, OnMissingBean, OnPropertyFree account
- Back-off aur overriding: aapki bean jeetti hai, chup-chaapFree account
- Externalized configuration aur kaunsa source jeetta haiFree account
- ConfigurationProperties vs Value, aur relaxed bindingFree account
- Boot me profiles: profile-specific files aur activationFree account
- Embedded server: port, context path, graceful shutdownFree account
- REST controllers aur Jackson se JSON mappingFree account
- Error handling: ControllerAdvice aur ProblemDetailFree account
- Actuator: health, info, aur production readinessFree account
- Auto-configuration debug karna: condition evaluation reportFree account
- RecapFree account
- ●Project: URL Shortener REST API
- Project: Apna Auto-configuration ModuleFree account
- Project: Production-Hardened ServiceFree account
Spring Boot kyun: Spring ke upar ye kya jodta hai
Spring Boot koi naya framework nahi hai. Wo Spring hi hai, saath me kuch defaults jo aapko wahi configuration likhne se bacha lete hain jo aap waise bhi usi tarah likhte.
Ye baat marketing lagti hai, jab tak aap is lesson ka program chala kar na dekh lein. Output ki pehli line dekhiye: context class hai AnnotationConfigApplicationContext. Yahi wo class hai jo pichhle chapter (Spring Core) me padhi thi. Boot ne container ko, beans ko, dependency injection ko - kisi ko bhi replace nahi kiya. Usne wahi container aapke liye start kar diya.
Boot asal me kya jodta hai
Chaar cheezein, aur inhe interview me ginwa pana zaroori hai:
- Auto-configuration. Boot dekhta hai ki aapke classpath par kya pada hai, aur us combination ko jo beans aam taur par chahiye wo register kar deta hai. Classpath par Tomcat hai to web server configure ho jaata hai; Jackson hai to JSON conversion.
- Starters. Ek dependency line jo poora ek set le aati hai, un versions par jo aapas me chalna jaante hain - aapko haath se version chunne nahi padte.
- Ek embedded server. Aapki application apna Tomcat khud JVM ke andar start karti hai. Na WAR banana, na alag se server install karna.
- Production ke liye taiyaar features. Health check, metrics waghairah Actuator ke through.
Wo naap jo baat ko theek se pakka karta hai
Is lesson ka program apni ek bhi bean define nahi karta. Ek annotation hai aur ek main method. Chalaiye, aur container batata hai 175 bean definitions.
Ye saari beans auto-configuration ne classpath padh kar banayi. Aur asli baat ye hai: ye number yaad karne wala constant nahi hai - ye poori tarah is par depend karta hai ki kaunsi jars maujood hain. Ek library jodiye, number badh jaata hai, aur uske saath behaviour bhi badal jaata hai - bina aapke ek line code badle. Poore chapter ka mechanism yahi hai, ek integer me dikhta hua.
Wo teen jawab jo kabhi Spring ke the hi nahi
Spring Core chapter me aapne dekha tha ki @Value("${some.key}") tabhi resolve hota hai jab PropertySourcesPlaceholderConfigurer register ho, @Repository tabhi vendor exception translate karta hai jab uska post-processor register ho, aur AOP annotations tabhi asar dikhati hain jab proxying on ho. Plain container par teenon me se kuch bhi apne aap nahi hota.
Output ki teesri line faisla kar deti hai: placeholder bean : 1. Wo post-processor Boot ne register kiya. To jab koi kehta hai "Spring ${...} khud resolve kar deta hai", to sach ye hai ki wo Spring Boot karta hai. Zyadatar developers ko ye farq pata hi nahi chalta, kyunki unhone kabhi plain container chalaya hi nahi.
Kab use karein: kisi bhi nayi Spring application ke liye - REST API, scheduled job, message consumer, command-line tool. Convention over configuration yahan naara nahi hai; iska matlab hai ki defaults wahi chunav hain jo ek tajurbekaar team karti, isliye aapko configuration sirf wahan likhni padti hai jahan aapki zaroorat aam case se sach me alag ho.
Kab NAHI use karein: Boot wahan theek nahi baithta jahan aapko aise deployment me fit hona hai jiska server kisi aur ke haath me hai - jaise koi organisation jo WAR file bana kar managed application server par deploy karti hai. Aur jab aapko application nahi, ek chhoti library banani ho tab bhi ye galat auzaar hai, kyunki Boot ki keemat application ko jodne me hai. Ek asli keemat tab bhi hai jab wo theek baithta hai: Boot application bahut kuch aisa karti hai jo aapne likha hi nahi, to jab kuch anokha bartaav kare to aapko padhna aana chahiye ki auto-configuration ne kya faisla liya. Wahi hunar is poore chapter ka baaki hissa hai.
Mechanism seekhne ki wajah - us boilerplate ki jagah jo wo hatata hai - saaf hai: interview me aapse Boot ki taareef karne ko shayad hi kaha jaye. Poochha ye jaata hai ki bean kyun nahi bani, property kyun nahi padhi ja rahi, ya application colleague ki machine par alag kyun start hoti hai. In teenon sawaalon ki jad auto-configuration hai.
package demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
@SpringBootApplication
public class WhyBoot {
public static void main(String[] args) {
System.setProperty("spring.main.web-application-type", "none");
try (ConfigurableApplicationContext ctx = SpringApplication.run(WhyBoot.class, args)) {
System.out.println("context class : " + ctx.getClass().getSimpleName());
System.out.println("beans registered : " + ctx.getBeanDefinitionCount());
String[] placeholder = ctx.getBeanNamesForType(PropertySourcesPlaceholderConfigurer.class);
System.out.println("placeholder bean : " + placeholder.length
+ (placeholder.length > 0 ? " (" + placeholder[0] + ")" : ""));
}
}
}Auto-configuration asal me kaam kaise karti hai
Auto-configuration wahi ek idea hai jis par ye poora chapter khada hai. Spring Boot ke lagbhag saare interview sawaal jo dekhne me kuch aur lagte hain - "ye bean kyun nahi bani", "library jodne se behaviour kyun badal gaya", "meri machine par kyun chalta hai" - asal me isi ke baare me hote hain.
Mechanism ke teen step hain, aur inme se koi bhi jaadu nahi hai.
Step 1: candidates ki ek list
Jo bhi jar auto-configuration dena chahti hai, wo ek saada text file rakhti hai - META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports. Har line par ek poora class naam.
Neeche wala program us file ko kisi ke bataye bharose par nahi, apne hi classpath se padh kar dikhata hai. Is classpath par aisi 2 files hain - ek spring-boot-autoconfigure se, ek spring-boot-actuator-autoconfigure se - aur dono milakar 279 candidate classes ginwati hain.
Is file ka naam yaad rakhne layak hai. Purane tutorials batayenge ki ye list spring.factories me hoti hai. Wo Boot 2.7 tak sach tha; Boot 3 se mechanism AutoConfiguration.imports hai, aur interview me purana naam lena aapko turant purana sabit kar deta hai.
Step 2: conditions tay karti hain kaun bachega
279 candidates par vichaar hota hai. 279 ke aaspaas bhi apply nahi hote. Har candidate par conditions lagi hoti hain - ye class classpath par hai kya, user ne ye bean pehle se bana to nahi di, ye property set hai kya - aur jiski condition fail ho jaye wo kuch bhi nahi jodta. Conditions ka apna alag topic hai; yahan samajhne wali baat itni hai ki ye list candidates ki hai, faislon ki nahi.
Step 3: jo bache, unka aapas me order
Kuch auto-configurations tabhi maayne rakhti hain jab kuch doosri pehle chal chuki hon. Output me WebMvcAutoConfiguration khud bata rahi hai ki wo DispatcherServletAutoConfiguration, TaskExecutionAutoConfiguration aur ValidationAutoConfiguration ke baad chalti hai.
Dhyan dijiye ye naapa kaise gaya. Us class par @AutoConfigureAfter annotation hai hi nahi - program isi check par false chhapta hai. Boot 3 me order @AutoConfiguration annotation ke apne after aur afterName attributes se declare hota hai. @AutoConfigureAfter abhi bhi maujood hai aur chalta bhi hai, par framework ki apni classes aage badh chuki hain - to sirf usi ke around bana hua jawab ek purane Boot ka varnan karta hai, us Boot ka nahi jis par aapko kaam milega.
Iski asli keemat kitni hai
Output ki pehli do lines is feature ka imaandaar paimana hain. Ek plain @Configuration khaali Spring container me 6 bean definitions banata hai - sirf Spring ka apna infrastructure. Sirf annotation badliye, aur @SpringBootApplication 176 bana deta hai.
176 ko yaad mat kijiye. Isi chapter ke pichhle lesson me isi machine par 156, 175 aur 177 naape gaye the, kyunki har baar classpath aur scan hone wala package alag tha. Jo bean count jar jodne par hil jaye, wo demo ki kharabi nahi hai - wahi feature hai, numbers me likha hua.
Kab use karein: application ke aam hisson ke liye auto-configuration par bharosa kijiye - web server, JSON conversion, properties se datasource. Ye wahan sabse achha hai jahan aapki zaroorat wahi hai jo zyadatar applications ki hoti hai, aur wo zyadatar waqt hoti hai.
Trade-off kya hai: aapko chalti hui application milti hai, badle me ek aisa system jo wo faisle le chuka hai jo aapne dekhe hi nahi. Jab behaviour chaunkaye, tab ye keemat chukani padti hai, aur chukane ka ek hi tareeka hai - andaza lagane ki jagah padhna ki auto-configuration ne asal me kya tay kiya. Wo report is chapter me aage aati hai. Abhi jo aadat banani hai wo yahi lesson dikha raha hai: jab jaanna ho ki Boot ne kya kiya, to chalti hui application se poochhiye - count chhapiye, imports file padhiye, annotation par reflection kijiye - kisi blog post par bharosa mat kijiye.
@EnableAutoConfiguration wahi switch hai jo ye sab shuru karta hai. @SpringBootApplication usi ko apne andar rakhta hai, isliye aapko wo alag se likhna shayad hi padta hai.
package auto2;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Configuration;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Enumeration;
public class HowAuto {
@Configuration
static class PlainConfig { }
@SpringBootApplication
static class BootApp { }
static final String IMPORTS =
"META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports";
public static void main(String[] args) throws Exception {
try (var plain = new AnnotationConfigApplicationContext(PlainConfig.class)) {
System.out.println("plain @Configuration beans : " + plain.getBeanDefinitionCount());
}
System.setProperty("spring.main.web-application-type", "none");
try (ConfigurableApplicationContext boot = SpringApplication.run(BootApp.class, args)) {
System.out.println("@SpringBootApplication beans : " + boot.getBeanDefinitionCount());
}
int files = 0, candidates = 0;
Enumeration<URL> urls = HowAuto.class.getClassLoader().getResources(IMPORTS);
while (urls.hasMoreElements()) {
files++;
try (BufferedReader r = new BufferedReader(
new InputStreamReader(urls.nextElement().openStream()))) {
String line;
while ((line = r.readLine()) != null) {
line = line.trim();
if (!line.isEmpty() && !line.startsWith("#")) candidates++;
}
}
}
System.out.println("imports files on classpath : " + files);
System.out.println("candidates listed in them : " + candidates);
Class<?> webmvc = Class.forName(
"org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration");
System.out.println("@AutoConfigureAfter present : "
+ (webmvc.getAnnotation(org.springframework.boot.autoconfigure.AutoConfigureAfter.class) != null));
AutoConfiguration meta = webmvc.getAnnotation(AutoConfiguration.class);
System.out.print("WebMvc runs after :");
for (String n : meta.afterName()) System.out.print(" " + n.substring(n.lastIndexOf('.') + 1));
for (Class<?> c : meta.after()) System.out.print(" " + c.getSimpleName());
System.out.println();
}
}Project: URL Shortener REST API
Ye chapter ka entry project hai. Ye jaan-boojh kar chhota hai - ek file, koi database nahi - kyunki asli baat URL shortener nahi hai. Asli baat ye hai ki ab tak seekhi hui har Boot ki cheez itni si service me dikh jaati hai, aur interviewer isi ek screen ke code se kisi bhi cheez par sawaal poochh sakta hai.
Ye karta kya hai
POST /links ek target URL leta hai aur ek chhota code lautata hai. GET /{code} original par redirect kar deta hai. Anjaan code par theek error banta hai, aur galat request body aapke code ke chalne se pehle hi reject ho jaati hai.
Isme kya-kya lagta hai, aur har tukda aaya kahan se
Typed configuration. shortener.base-url aur shortener.code-length ek @ConfigurationProperties class par bind hote hain jis par @Validated laga hai. Runtime par kisi string key se kuch nahi padha jaata. Agar koi khaali base URL ke saath deploy kare to application start hone se mana kar deti hai, bajaye iske ki toote hue short links serve karti rahe.
Constructor injection. Links Props leta hai, aur Api Links - wahi dependency injection jo Spring Core chapter me thi, bilkul waise ki waise. Boot ne use replace nahi kiya; usne bas container aapke liye bana diya.
Layer wala shape. Controller HTTP dekhta hai, @Service logic rakhta hai, properties class configuration. Yahi alagav service ko testable banata hai, aur jab interviewer kehta hai "ek endpoint design kijiye" tab wo yahi dhoondh raha hota hai.
Sahi HTTP. POST /links 201 aur ek Location header lautata hai, sirf body wala 200 nahi. GET /{code} 302 lautata hai jisme target Location me hota hai - protocol ke star par redirect asal me yahi hai. Ye wahi status codes hain jinhe chunne ke liye ResponseEntity hai.
Asli error handling. Anjaan code ek domain exception phenkta hai, aur ek @RestControllerAdvice use ProblemDetail bana deta hai:
404 {"type":"about:blank","title":"Unknown short code",
"status":404,"detail":"code not found: zzzzzz","instance":"/zzzzzz"}
Gaur kijiye ki yahan type about:blank hai - handler ne title aur detail to diye par koi type URI nahi, aur RFC 7807 ka default yahi hai. Ek asli type URI set karna production service me ek line ka sudhaar hai jo karna chahiye.
Kinare par validation. @Valid @RequestBody aur @NotBlank khaali URL ko 400 se rok dete hain, business logic ki ek line chalne se pehle.
Ye kar ke dekhiye
- Error response behtar kijiye:
ProblemDetailko aslitypeURI dijiye, aurMethodArgumentNotValidExceptionke liye handler jodiye taaki 400 ye bhi bataye ki kaunsa field fail hua, sirf "Bad Request" nahi. - Hash wale code ki jagah random code laiye, aur us collision ko sambhaaliye jo tab mumkin ho jaata hai - ye asli design ka sawaal hai, koi rasm nahi.
@ConditionalOnPropertyjodiye taakishortener.stats.enabledflag se ek optional hit-counter endpoint on/off ho, aur condition report se confirm kijiye ki flag band hone par wo sach me gayab hai.- Actuator me sirf
healthaurmetricsexpose kijiye, phir jaanchiye ki/actuator/envabhi bhi 404 hai.
Imaandaar chetavni: store ek ConcurrentHashMap hai, isliye restart par sab kuch gayab ho jaata hai aur instances ke beech kuch saanjha nahi hota. Ye jaan-boojh kar hai - persistence agle chapter ka vishay hai, aur use yahan jodne se Boot ke concepts JPA ke setup ke neeche dab jaate.
package shortener;
@SpringBootApplication
@EnableConfigurationProperties(Shortener.Props.class)
public class Shortener {
@Validated
@ConfigurationProperties(prefix = "shortener")
public static class Props {
@NotBlank private String baseUrl;
private int codeLength = 6;
public void setBaseUrl(String v){ this.baseUrl=v; } public String getBaseUrl(){ return baseUrl; }
public void setCodeLength(int v){ this.codeLength=v; } public int getCodeLength(){ return codeLength; }
}
record CreateRequest(@NotBlank String url) { }
record CreateResponse(String code, String shortUrl, String target) { }
static class UnknownCode extends RuntimeException { UnknownCode(String c){ super("code not found: " + c); } }
@Service
static class Links {
private final Map<String, String> store = new ConcurrentHashMap<>();
private final Props props;
Links(Props props) { this.props = props; } // constructor injection
CreateResponse create(String target, int port) {
String code = Integer.toHexString(target.hashCode()).replace("-", "");
code = (code + "000000").substring(0, props.getCodeLength());
store.put(code, target);
return new CreateResponse(code, props.getBaseUrl() + ":" + port + "/" + code, target);
}
String resolve(String code) {
String t = store.get(code);
if (t == null) throw new UnknownCode(code);
return t;
}
}
@RestController
static class Api {
private final Links links;
private final Environment env;
Api(Links links, Environment env) { this.links = links; this.env = env; }
@PostMapping("/links")
ResponseEntity<CreateResponse> create(@Valid @RequestBody CreateRequest req) {
int port = Integer.parseInt(env.getProperty("local.server.port", "0"));
CreateResponse r = links.create(req.url(), port);
return ResponseEntity.created(URI.create(r.shortUrl())).body(r);
}
@GetMapping("/{code}")
ResponseEntity<Void> follow(@PathVariable("code") String code) {
return ResponseEntity.status(HttpStatus.FOUND).location(URI.create(links.resolve(code))).build();
}
}
@RestControllerAdvice
static class Errors {
@ExceptionHandler(UnknownCode.class)
ProblemDetail unknown(UnknownCode e) {
ProblemDetail pd = ProblemDetail.forStatusAndDetail(HttpStatus.NOT_FOUND, e.getMessage());
pd.setTitle("Unknown short code");
return pd;
}
}
}
# application.properties
# shortener.base-url=http://localhost
# shortener.code-length=6Spring Boot & Auto-configurationinterview questions & answers
10 sample questions below — 206+ in the full bank inside.
Kisi ek khaas auto-configuration class ko kaise disable karenge?
Ya to code me @SpringBootApplication(exclude = SomeAutoConfiguration.class), ya phir spring.autoconfigure.exclude property me poora class naam - aur yahi roop tab use hota hai jab faisla source ka nahi, deployment ka ho. Dono us class ko vichaar se poori tarah hata dete hain, chahe aapne uski jagah kuch diya ho ya nahi.
In simple terms: Dono roop jaanna amal me maayne rakhta hai: annotation compile-time ka faisla hai jo artifact me pak jaata hai, jabki property har environment me alag ho sakti hai, aur aksar aapko wahi chahiye hota hai.
Ek junior developer ko auto-configuration chaar vaakyon me samjhaiye.
Starters aapke classpath par jars ka ek set rakh dete hain. Un jars me se har ek AutoConfiguration.imports naam ki file me auto-configuration candidates ginwati hai. Conditions - class maujood hone par, property par, bean ke na hone par - tay karti hain ki kaunse candidates asal me lagenge. Aur kyunki unme se zyadatar par @ConditionalOnMissingBean laga hota hai, aapki khud banayi hui koi bhi cheez default ko hara deti hai.
In simple terms: Kisi mechanism ko chaar vaakyon me sameta pana khud hi imtihaan hai. Agar samjhane me das minute lagein, to ummedwar mechanism nahi balki lakshan bata raha hai, aur interviewer ise turant pakad leta hai.
Auto-configuration asal me karti kya hai, aur @EnableAutoConfiguration ka role kya hai?
Auto-configuration dekhti hai ki classpath par kya hai aur us combination ko jo beans aam taur par chahiye wo register kar deti hai - Tomcat maujood hai to web server configure ho jaata hai, Jackson maujood hai to JSON conversion. @EnableAutoConfiguration wahi switch hai jo ye prakriya shuru karta hai. Aap use khud shayad hi likhte hain kyunki @SpringBootApplication usme pehle se shaamil hai, @SpringBootConfiguration aur @ComponentScan ke saath.
In simple terms: Aam kamzor jawab hai "wo cheezein apne aap configure kar deta hai", jo bas naam dohra deta hai. Samajh classpath ko input batane se dikhti hai, kyunki chapter ki baaki har cheez - starters, conditions, back-off - isi ek soch par tiki hai.
@SpringBootApplication aur @EnableAutoConfiguration me farak kya hai?
@EnableAutoConfiguration sirf auto-configuration chalu karta hai, aur kuch nahi. @SpringBootApplication ek suvidha hai jo teen annotations ek saath laati hai: @SpringBootConfiguration, @EnableAutoConfiguration aur @ComponentScan. To farak wo baaki do hain - configuration class wali samajh aur us class ke package se shuru hone wali component scanning. Agar kabhi bina scanning ke sirf auto-configuration chahiye ho, to aap akela @EnableAutoConfiguration use karenge.
In simple terms: Composition ko ratne ki jagah runtime par SpringBootApplication.class.getAnnotations() se verify kiya ja sakta hai, aur ye batana kaam ka hai kyunki chapter ki baaki cheezein bhi isi aadat par chalti hain.
Amal me kaunse Actuator endpoints maayne rakhte hain, aur har ek kis kaam ka hai?
health ko load balancer ya orchestrator poll karta hai ye tay karne ke liye ki is instance ko traffic milna chahiye ya nahi - Kubernetes me liveness aur readiness probes isi par tikti hain. info build aur version ki detail rakhta hai, jisse aap bina kisi se poochhe bata sakte hain ki "asal me kaunsa version deploy hai". metrics Micrometer ke counters aur timers dashboards ke liye deta hai. env har property source aur value ginwa deta hai, jo bahut taqatwar hai aur theek isi wajah se use public nahi hona chahiye.
In simple terms: Ginwana aasan hai; har ek ka istemal kaun karta hai ye batana operational tajurba dikhata hai. env wala note us exposure wale sawaal ki bhoomika bhi bana deta hai jo aam taur par iske baad aata hai.
Actuator ko teen vaakyon me samjhaiye.
Actuator chalti hui application ke operational sawaalon ka jawab HTTP endpoints se deta hai - health, version, metrics - aur ek dependency ke roop me aata hai. Default me sirf health publish hota hai; baaki sab tab tak 404 rehta hai jab tak management.endpoints.web.exposure.include me naam na ho, yaani exposure har endpoint ke liye maangna padta hai. Application secure karne se Actuator apne aap secure nahi hota, aur health jaan-boojh kar pahunch me rehta hai kyunki probes login nahi kar sakti.
In simple terms: Teen vaakya - ye hai kya, sambhla hua default, aur security wali bareeki. Jo saaransh aakhri baat chhod deta hai wo sunne wale ko galat soch de deta hai ki kaun kahan tak pahunch sakta hai.
Spring Boot Actuator kya hai aur wo kya deta hai?
Ye Boot ka wo hissa hai jo chalti hui application ke baare me sawaalon ka jawab deta hai, uska business ka kaam nahi karta - ye zinda hai kya, kaunsa version hai, chal kaisa raha hai. Ye ek dependency ke roop me aata hai aur health, info tatha metrics jaise endpoints deta hai. Bina kisi configuration ke naapa gaya: /actuator/health ne 200 aur {"status":"UP"} diya, aur kisi bhi deploy ki gayi service me yahi ek feature is dependency ki keemat vasool kar deta hai.
In simple terms: Business ke kaam aur operational sawaalon ka farak wahi soch hai jo rakhni chahiye. Isse ye bhi samajh aata hai ki Actuator alag dependency kyun hai, web starter ka hissa kyun nahi.
Har deploy ki gayi service me Actuator kyun daalein, chhoti si service me bhi?
Kyunki akela health hi iski keemat vasool kar deta hai. Jo orchestrator ye bata hi na sake ki aapki application zinda hai ya nahi, wo ya to toote hue instance me traffic bhejta rahega ya theek-thaak instance ko restart kar dega, aur ye dono ek dependency ki keemat se bure hain. Chhoti services ko chhoot nahi hai - wo usi tarah fail hoti hain, aur aam taur par unhi ko koi dhyan se nahi dekh raha hota, isliye apne aap chalne wala health signal wahan kam nahi, zyada maayne rakhta hai.
In simple terms: Chhoti services wali baat kehne layak hai. Teams aksar un services par operational auzaar chhod deti hain jinhe wo mamooli maanti hain, aur theek wahin khamosh failure sabse lambe samay tak kisi ki nazar me nahi aati.
server.servlet.context-path=/api kya karta hai?
Wo har endpoint ko us prefix ke neeche khiska deta hai - wahi handler jo /ping par jawab deta tha ab /api/ping par deta hai aur /ping par nahi. Ise aksar tab use kiya jaata hai jab service kisi saanjhe gateway ke peechhe ho jo path prefix se route karta ho. Configuration badalne ke baad achanak 404 ki laher aaye to ye yaad rakhne layak hai, kyunki controllers me kuch badla hi nahi hota.
In simple terms: Yahan keemat debugging wale note ki hai. Deployment configuration edit karte waqt joda gaya context path aise 404 banata hai jo application me routing ka bug lagta hai.
Back-off ko ek vaakya me samjhaiye.
Spring Boot apna default tabhi register karta hai jab aapne apna register na kiya ho, aur ye @ConditionalOnMissingBean se laagu hota hai - aur ye chup-chaap hota hai, yaani aapki bean jeet jaati hai par kuch log nahi hota.
In simple terms: Aise chhote jawab wale sawaal sameta pane ki jaanch karte hain. Vaakya me mechanism, annotation aur khamoshi teenon aani chahiye, kyunki khamoshi chhod dene se hi log aage chal kar is bartaav ko galat samajhte hain.
196+ more Spring Boot & Auto-configuration questions inside
Create a free account to read the full question bank, learn every topic, and practise with an AI mock interview.
Unlock all questions — freeReady to practise Spring Boot & Auto-configuration?
Unlock every topic free, then face an AI interviewer that asks follow-ups and grades your answers.