Loading…
Spring Core, Boot, Data JPA, Security, WebFlux & Batch
The Spring ecosystem is the single biggest topic in Java backend interviews. Drill IoC and bean lifecycle, Boot auto-configuration, JPA and the N+1 problem, OAuth2 and JWT, reactive WebFlux, and batch processing — every sub-module with curated Q&A.
How to use this hub
6 modules cover spring ecosystem end-to-end. Open the first module, use Open question 1 on its landing page, and use Next at the bottom of each answer to stay in order.
Revision sheet
~12 min · 5 sections · save as PDF
Spring Core interview questions test whether you understand the framework underneath Spring Boot — the IoC container, dependency injection (constructor vs setter vs field), bean lifecycles and scopes, the BeanFactory vs ApplicationContext, AOP fundamentals (proxies, advices, pointcuts), and the @Transactional internals interviewers love to probe. This page covers the conceptual layer that lets you debug a real Spring app instead of just write one. Pair this page with the Spring Boot page (auto-configuration, starters, profiles), Spring Data JPA / Hibernate, Spring Security, Spring WebFlux, and Spring Batch.
Spring Core in three layers:
BeanDefinition → BeanFactory → ApplicationContext.@PostConstruct → BPP-after → ready.@Transactional, events.Senior questions probe the proxy boundary: same-bean self-invocation skips the aspect; this is where 80% of @Transactional bugs live.
The interview surface for this module breaks into these focus areas:
final, fail-fast cycles, easy testing.@Bean calls return singletons; false → faster start, no inter-call guarantee."I'd register this as a `@Component` / `@Configuration` `@Bean`, prefer constructor injection so
, and apply <`@Transactional` / `@Async` / aspect> via the proxy — knowing the proxy boundary means I'd avoid same-bean self-invocation and split the responsibility into + ."
Revision sheet
~12 min · 5 sections · save as PDF
Spring Boot interview questions are the single most asked Spring topic — auto-configuration internals, the starter system, application.properties/yml + profiles, Actuator endpoints and security, embedded servers, configuration binding, graceful shutdown, scheduled tasks, layered Docker images, and the troubleshooting questions interviewers pull from real production incidents. This page covers the questions that test whether you have actually shipped Spring Boot to production, not just used start.spring.io. For lower-level Spring concepts (IoC, AOP, transaction internals) see Spring Core; for persistence see Spring Data JPA / Hibernate.
Boot = Spring + opinionated auto-configuration + an embedded server + starter dependencies.
@SpringBootApplication = @Configuration + @EnableAutoConfiguration + @ComponentScan./actuator/health, /info, /metrics, /env (secured!).The interview surface for this module breaks into these focus areas:
@SpringBootApplication(exclude = ...) or spring.autoconfigure.exclude=.@Profile("!prod") works; never hardcode secrets.server.shutdown=graceful + spring.lifecycle.timeout-per-shutdown-phase."In Spring Boot I'd lean on the
, override via `application- .yml`, expose behind , and ship a layered Docker image so dependency layers stay cached. For startup tuning I'd profile with the conditions report and disable unused auto-configs."
Revision sheet
~12 min · 5 sections · save as PDF
Database persistence is the backbone of every business application, and interviewers use JPA/Hibernate questions to test whether you understand what is happening beneath Spring Data's magic repository methods. The N+1 problem, LazyInitializationException, and @Transactional misuse are the three most cited production bugs in Java applications — freshers who understand them stand out immediately. Knowing the difference between JPA (specification) and Hibernate (implementation) also signals architecture awareness.
mappedBy side is NOT the owner; the owning side holds the foreign key columnjpa-basics-and-orm-concepts — drill: ORM benefit, entity states and what triggers each transition, EntityManager vs Spring Data repositoryentity-mapping-annotations — drill: @Entity + @Id is minimum, @GeneratedValue strategies (IDENTITY is most common for MySQL/PostgreSQL), @Column nullable/uniquejpa-relationships — drill: @OneToMany with mappedBy on the non-owner side; @ManyToOne on the child is the owning side; cascade ALL vs specific typesspring-data-repositories — drill: JpaRepository extends PagingAndSortingRepository extends CrudRepository; derived query naming rulesjpql-and-derived-queries — drill: JPQL uses entity/field names not table/column names; Pageable for paginationtransactions-basics — drill: @Transactional default propagation = REQUIRED; checked exceptions do NOT trigger rollback by defaultlazy-vs-eager-loading — drill: @OneToMany default = LAZY; @ManyToOne default = EAGER; LazyInitializationException = access after tx closedcomparisons — drill: JPA vs Hibernate, JPQL vs SQL, LAZY vs EAGER with N+1 implicationsscenario-based — drill: fix LazyInitializationException (open session in view or @EntityGraph or DTO projection), N+1 fix"In my Spring Boot projects I use Spring Data JPA with Hibernate as the JPA provider. I annotate entity classes with @Entity and @Id, map relationships with @OneToMany and @ManyToOne, and write queries using derived method names or @Query JPQL. I'm careful about LAZY vs EAGER loading — I keep collections LAZY and use @EntityGraph or JOIN FETCH when I need the related data in a specific query to avoid the N+1 problem. I annotate service methods with @Transactional to ensure that operations run atomically and roll back on failure."
Revision sheet
~12 min · 5 sections · save as PDF
Spring Security interview questions cover the auth layer that protects every modern Java backend — the SecurityFilterChain, authentication providers, password encoding, session vs stateless (JWT) auth, OAuth2 and OpenID Connect, method-level security (@PreAuthorize, @PostAuthorize), CORS and CSRF, and the common pitfalls interviewers love to surface (storing JWTs in localStorage, missing audit fields, leaking principal in logs). This page covers Spring Security with Spring Boot 3, including the modern config-by-bean style and the migration patterns from the older WebSecurityConfigurerAdapter approach.
Spring Security is a chain of filters, then method security on top:
@PreAuthorize, @PostAuthorize, SpEL.BCryptPasswordEncoder).Boot 3 / Security 6 dropped WebSecurityConfigurerAdapter; everything is now bean-style.
The interview surface for this module breaks into these focus areas:
DelegatingSecurityContextRunnable."I'd configure a `SecurityFilterChain` bean, route public/private paths explicitly, choose
based on , encode passwords with BCrypt, and put method-level guards on the service. CSRF stays on for cookie auth, off for stateless JWT APIs."
Revision sheet
~12 min · 5 sections · save as PDF
Spring WebFlux interview questions test whether you understand reactive programming on the JVM — Mono vs Flux, backpressure, the Project Reactor operator vocabulary, Schedulers and threading, when reactive helps versus when it just adds complexity, and the migration patterns from blocking Spring MVC. This page is small but focused: each question is one a senior interviewer actually asks when WebFlux is on your resume.
WebFlux = reactive streams (Mono/Flux) on top of Netty by default.
boundedElastic for blocking, parallel for CPU.subscribeOn(boundedElastic()).The interview surface for this module breaks into these focus areas:
StepVerifier for assertion, WebTestClient for HTTP."I'd compose the pipeline as `Mono.fromX` → operators → `subscribe`, isolate any blocking call on `boundedElastic`, propagate context with `contextWrite`, and verify timing with `StepVerifier`. For new code I'd weigh WebFlux against virtual threads + plain blocking code."
Revision sheet
~12 min · 5 sections · save as PDF
Spring Batch interview questions cover the batch-processing framework that powers reconciliation, ETL and reporting jobs in every regulated Java backend — the Job/Step/Tasklet/Chunk model, ItemReader/Processor/Writer, restart and skip logic, partitioning and parallel steps, JobRepository internals, and the integration patterns that show up in finance and telco interviews. Each answer leads with the framework concept, then the operational concern interviewers really want to hear.
Batch = Job → Step → Tasklet | Chunk(reader / processor / writer).
The interview surface for this module breaks into these focus areas:
JpaPagingItemReader / cursor reader.#{jobParameters['date']}).@Scheduled for simple."I'd model this as
with a step (size N tuned to ), drive idempotency by , allow skip on , and partition by if the volume justifies it. The schedule sits behind ."