Every 5–8-year Spring Boot and Spring Security question — auto-configuration, startup, transactions, performance, filters, OAuth2 and method security — in one-line form with links.
Published September 25, 2026
This page condenses every question from the 5 to 8 Years course in these areas into a single line: the question, linked to its full answer, and the one-sentence answer you should be able to give instantly. Read down the list and answer each question aloud before reading the line. Wherever you hesitate, follow the link and revise the full answer — interviewers at your level expect these basics to be fluent, and they often open with them before going deeper.
Logging, Configuration & Actuator (Advanced) — Interview Questions — open the lesson
spring-boot-starter-logging: SLF4J as the API, and Logback as the default implementation. Out of the box, it logs to the console with a sensible pattern at INFO level.org.slf4j.Logger, and a binding chosen at deployment time does the actual output: Logback, Log4j2, or java.util.logging.slf4j-api. What prints the logs is decided by which provider jar is on the classpath at runtime.<dependency> <groupId>org.springframework.boot</groupId>SpringApplication.setDefaultProperties); @PropertySource on @Configuration classes; Config data files, in this order:…application.yml and application.properties? How are they prioritised? — Yes. Boot loads both and merges them. If the same key is in both in the same location, .properties wins over .yml.application.properties to application.yml, application-prod.properties to application-prod.yml), turning dotted keys into nested maps. An IDE or a converter tool helps; Watch the YAML pitfalls: Indentation is significant; Multi-document files: you…health is exposed by default; Paths and ports: management.endpoints.web.base-path=/manage; Security: protect everything except health and info with Spring Security (an EndpointRequest matcher), and sanitise env and configprops values…/health and its liveness/readiness groups drive load balancer and Kubernetes probes. Database, disk, broker and custom indicators decide whether the instance takes traffic; Metrics: /metrics and /prometheus, backed by Micrometer. JVM, HTTP…Transactions, Multiple Datasources & Query Tuning — Interview Questions — open the lesson
PlatformTransactionManager abstraction (JpaTransactionManager, DataSourceTransactionManager, JtaTransactionManager, and the reactive ReactiveTransactionManager), used in two ways: Declarative: @Transactional on methods or classes. An AOP proxy begins the…JpaTransactionManager) are the norm, and the fastest; Externally coordinated transactions use JTA/XA: a transaction manager (Atomikos, Narayana, or an application server's)…@Transactional for most methods, and programmatic TransactionTemplate where one method needs several independent commits; Never hold a database…DataSource, LocalContainerEntityManagerFactoryBean and PlatformTransactionManager (or a JdbcTemplate); Mark one set @Primary, so auto-wiring without a qualifier works; Point each set at its own repository and entity packages…DataSource, EntityManagerFactory and TransactionManager; @Primary on the default; @Qualifier at injection points; and separate repository packages bound through @EnableJpaRepositories.Validation & REST API Design (Advanced) — Interview Questions — open the lesson
spring-boot-starter-validation. That brings Hibernate Validator, the reference implementation of Jakarta Bean Validation 3.x (jakarta.validation.* in Boot 3; it was javax.validation in Boot 2). Then: Annotate DTO fields (@NotBlank, @Email, @Size, @Positive,…@Valid @ModelAttribute("form") Form form, BindingResult result. BindingResult must come immediately after the validated parameter. If result.hasErrors(), return the form view, which renders field errors with th:errors;…@Constraint(validatedBy = …), plus a ConstraintValidator<A, T>. Validators are Spring beans, so they can inject repositories or services; Spring's…ConstraintValidator that receives the whole object.@Valid/@Validated, since they plug into the same Validator. For example, Hibernate Validator's extra constraints (@URL, @CreditCardNumber, @UUID),…@ValidPhone, @ValidPincode built from @Pattern plus @Size), and reuse it on every DTO; Share the DTOs, or at least the constraint annotations, in a common module; Centralise the messages in…@RequestBody do? — It binds the HTTP request body to a method parameter, through an HttpMessageConverter chosen by the Content-Type: Jackson for JSON, or JAXB/Jackson XML.ResponseEntity and returning an object directly? — Returning an object: Spring serialises it with status 200 (or the status given by @ResponseStatus). It's simple, and good for the standard path; ResponseEntity<T>: full control of the status, headers and body per call. For example: 201 Created with a Location header./products?category=x&page=2: retrieval, with filters and pagination. It's cacheable, and must have no side effects; POST /products: create, where the server assigns the ID. Returns 201 with Location. Also used for actions that don't map to CRUD (`POST…/warehouses/{id}/stock), with consistent naming; Scalability: Stateless services, horizontally scaled; Performance: Caching: ETag/Cache-Control for catalogue reads, and Redis for hot data; Correctness under concurrency:…Reactive, Async & Scheduling in Spring Boot — Interview Questions — open the lesson
OrderPlaced event to Kafka or RabbitMQ, and immediately returns 201/202 to the user.spring-boot-starter-webflux) is a non-blocking web stack, running on Netty by default, built on Project Reactor: Mono<T> carries 0 or 1 item, and Flux<T> carries 0..N items. Both are Reactive Streams publishers; Annotated controllers, or functional…Subscription.request(n) to say how many items it can take, and the publisher must not emit more than was requested.Function<Flux<In>, Flux<Out>>), or accept WebSocket or RSocket streams; Process non-blockingly: Parse, filter and enrich, with…@EnableScheduling, then @Scheduled methods: fixedRate: start every N, regardless of the previous run; Async execution: add @EnableAsync. Methods marked @Async run on a TaskExecutor, returning void or CompletableFuture<T>; The underlying…@Async with a dedicated, bounded executor. For robustness, use a queue-backed job: Upload: stream the file to object storage (S3 or GCS), not into memory. Create a ImageJob(PENDING) row, and return 202 Accepted with /jobs/{id}, or notify later…Deployment, High Availability, Scaling & Caching — Interview Questions — open the lesson
java -jar app.jar, run as a systemd service, or on a PaaS (Render, Heroku-style, Elastic Beanstalk, Azure App Service, Cloud Run); A WAR deployed to an external servlet container (Tomcat, Jetty, or an application server);…<packaging>war</packaging>, or the Gradle war plugin; Mark the embedded Tomcat as provided, so it's not bundled but is still available at compile time and for java -jar in development:.Cache-Control, ETag): catalogue pages, images; A local in-process cache: Caffeine. Nanosecond access, size- and time-bounded. Good for reference data (categories, configuration, exchange rates), where…ConcurrentMapCacheManager: a plain ConcurrentHashMap per cache. It has: no TTL or expiry; no size limit or eviction, so it grows until an OutOfMemoryError; no statistics; no sharing between instances: each node has its…spring-boot:build-image); Make the application container-friendly: Configuration through environment variables and secrets, with no environment-specific images; CI/CD: Build, scan the image (Trivy or…Custom Starters, DI, Testing & DevTools — Interview Questions — open the lesson
acme-audit-spring-boot-autoconfigure: the @AutoConfiguration classes, @ConfigurationProperties, and…optional in the autoconfigure module); Expose the library's settings as typed @ConfigurationProperties with safe defaults; Define its client beans in an @AutoConfiguration, guarded by:…spring-boot-starter-web (MVC + Tomcat), -webflux (Reactor + Netty); Data: -data-jpa, -jdbc, -data-mongodb, -data-redis; Security: -security, -oauth2-resource-server, -oauth2-client; Validation and operations: -validation, -actuator; …@Autowired? — Constructor injection (recommended): a single constructor needs no annotation, since Spring 4.3. Dependencies are final, the object is fully initialised, it's easy to test with new, and circular dependencies are exposed; Setter injection: for optional dependencies, or…@Mock and @MockBean (@MockitoBean)? — @Mock (Mockito): creates a mock in a plain unit test, with no Spring context. It's injected with @InjectMocks, or manually. It's fast; @MockBean: replaces or adds a bean inside the Spring ApplicationContext for slice or integration tests (@WebMvcTest,…@RunWith and @Rule. JUnit 5 has one extension model (@ExtendWith), and several extensions can compose; Features: @ParameterizedTest with…@BeforeAll: expensive, shared, read-only setup, once per class. It's static unless you use @TestInstance(PER_CLASS). For example, start a Testcontainers database, or load reference data; @BeforeEach: fresh state per test: new objects, reset mocks, insert test data. That…@WebMvcTest(ProductController.class). It loads only the MVC slice: the controller, the advice, converters, filters and security.Securing REST APIs End to End — Interview Questions — open the lesson
spring-boot-starter-security) supports: HTTP Basic: simple, for internal tools or behind a gateway, and only over TLS; Session or form login: for server-rendered applications; OAuth2 resource server with JWTs (spring-boot-starter-oauth2-resource-server):…header.payload.signature.spring-boot-starter-security. Then define: authentication: where identities come from (a UserDetailsService backed by a database, LDAP, or an OAuth2/OIDC provider); authorisation: which requests or methods need which authorities.UserDetailsService (a JPA-backed user table), plus a PasswordEncoder (BCrypt…SecurityFilterChain (authorizeHttpRequests). It's enforced by the AuthorizationFilter, before the request reaches the controller, based on the path, the HTTP method and the authorities. It's coarse-grained, central and cheap.…SecurityFilterChain (a bean) and HttpSecurity: configure the ordered filter chain. The DelegatingFilterProxy/FilterChainProxy connect it to the servlet container; AuthenticationManager (usually ProviderManager) and…/auth/login over…Q: How should I use this list in the last week before an interview? A: Do one pass per day. Cover the answer text, say your answer out loud, then check it. Mark every question you could not answer crisply, and spend your study time only on the marked ones by opening the linked full answer. By the third pass the marked list should be short.
Q: The interviewer asks one of these basics — should I give only the one-liner? A: Lead with the one-liner, then add one concrete detail or example from your own work. At this level the follow-up usually probes the mechanism behind the basic answer, so be ready to go one layer deeper using the key points in the full lesson.
Q: Some answers here were corrected compared with common prep sheets — why? A: Several widely shared answers are outdated or wrong (for example, Java version details, removed Spring APIs, or SQL queries that miss edge cases). The full lessons call these out under "Common trap" — reading those is the fastest way to stand out from candidates who memorised the same sheets.