Java, Spring & Kafka Fundamentals Deep-Dive
Company: Wells Fargo
Role: Software Engineer
Category: Software Engineering Fundamentals
Difficulty: medium
Interview Round: Technical Screen
## Java, Spring & Kafka Fundamentals Deep-Dive
This is a rapid-fire fundamentals interview for a senior backend engineer working in the Java/Spring ecosystem. Each part probes whether you understand the mechanics and trade-offs, not just the textbook definition. Answer each part precisely and back claims with a concrete example or a clear "when would you use X over Y."
### Constraints & Assumptions
- The codebase is a Java + Spring Boot microservices stack using Kafka for inter-service messaging.
- Assume modern Java (Java 17+ LTS) unless a question explicitly asks about version differences.
- "Explain X vs Y" answers should state the mechanism, then the decision rule for choosing one.
### Clarifying Questions to Ask
- Which Java/Spring Boot versions are in production? (Determines which language features and Spring Security APIs are in scope.)
- Are we using Spring Security's servlet filter chain (Spring MVC) or the reactive WebFilter chain (WebFlux)? The Filter/Interceptor mechanics differ.
- For the Kafka questions, what ordering and delivery guarantees does the business actually require? That reframes "ordering" from trivia into a design constraint.
### Part 1
Explain the difference between an **interface** and an **abstract class** in Java. When would you choose one over the other? Mention what changed about interfaces in recent Java versions.
```hint Frame it around capability vs. identity
Think "can-do contract that any unrelated class may implement" vs. "is-a base with shared state and partial implementation." Then recall what `default` / `static` / `private` methods (Java 8+) added to interfaces, and that an interface still holds no instance state.
```
#### What This Part Should Cover
```premium-lock What This Part Should Cover
```
### Part 2
You used design patterns in your projects. Pick the **Bridge pattern** and explain it in depth: what problem it solves, its structure, and a concrete example of where you applied it. Then state how it differs from the Adapter pattern and from the Strategy pattern.
```hint What "bridge" actually decouples
Bridge separates an **abstraction** hierarchy from its **implementation** hierarchy so the two can vary independently — it kills a combinatorial subclass explosion (M abstractions × N implementations) by composing instead of inheriting.
```
#### What This Part Should Cover
```premium-lock What This Part Should Cover
```
### Part 3
Explain the **SOLID** principles. For each, give a one-line statement and a concrete code-smell that violating it produces. Which one do you find most often violated in real codebases, and why?
```hint Anchor each letter to a failure mode
For each principle, name the smell it prevents: SRP → god class with many reasons to change; OCP → editing a class for every new case; LSP → subclass that throws/weakens a contract; ISP → fat interface forcing no-op methods; DIP → high-level code `new`-ing concrete low-level classes.
```
#### What This Part Should Cover
```premium-lock What This Part Should Cover
```
### Part 4
Explain the core Kafka concepts: **topic**, **partition**, and **broker**. Then explain Kafka's **message-ordering** guarantee precisely — what is and is not ordered, and how a producer controls which messages stay ordered.
```hint Ordering lives at the partition, not the topic
Kafka guarantees order **within a single partition**, not across a topic. The producer's **key** decides the partition, so messages that must stay ordered (e.g. all events for one account) must share a key.
```
#### What This Part Should Cover
```premium-lock What This Part Should Cover
```
### Part 5
In Spring Security, explain the difference between a **Filter** and an **Interceptor** (`HandlerInterceptor`), and where each sits in the request lifecycle. Then explain what **pre-authentication** means and when you'd use it.
```hint Two different chains, different scopes
A servlet **Filter** runs in the container's filter chain — before Spring MVC's `DispatcherServlet`, so it sees every request and is where Spring Security's auth lives. A Spring **Interceptor** runs inside the `DispatcherServlet`, around the handler, so it's MVC-aware (knows the handler/controller).
```
#### What This Part Should Cover
```premium-lock What This Part Should Cover
```
### Part 6
Compare a **Load Balancer** and an **API Gateway**. What does each do, at what layer, and when would you use one, the other, or both together?
```hint Distribution vs. application-aware mediation
A load balancer spreads traffic across identical instances (mostly L4, or L7 routing) for availability/scale. An API gateway is an application-layer front door that also does auth, rate limiting, request routing/transformation, aggregation, and observability per API.
```
#### What This Part Should Cover
```premium-lock What This Part Should Cover
```
### What a Strong Answer Covers
```premium-lock What a Strong Answer Covers
```
### Follow-up Questions
- If you need strict ordering for one entity but high throughput overall in Kafka, how do you reconcile per-partition ordering with parallelism? (Hint toward keying + partition count + consumer-group assignment.)
- Show how the Bridge pattern and the Dependency Inversion Principle relate — does Bridge depend on DIP, or are they orthogonal?
- Where exactly in the Spring Security filter chain does authentication occur, and how would you add a custom filter before/after it?
- An API gateway can become a bottleneck and a single point of failure. How do you mitigate that?
Quick Answer: This question tests depth of knowledge across core Java, Spring Boot, and Kafka fundamentals commonly required for senior backend engineering roles. It evaluates practical understanding of object-oriented design principles, distributed messaging semantics, and Spring Security internals — assessing whether candidates can reason about trade-offs rather than recite definitions.