skip to content

Wider Spring Portfolio

The rest of the portfolio: GraphQL, HATEOAS, SOAP web services, Modulith, Spring AI, and the operational projects — Session, Shell, LDAP and Statemachine. Interviewers dip in here to see how wide your exposure is beyond web and data.

part ofSpring Frameworkoverview, primer and where to startread it →
on this pageshow

explore

→ has its own guide

questions

144 · 6 sections

What is the N+1 problem in a GraphQL API, and how does batch loading solve it?

level: juniorimportance: must knowfreq 58%
basics
~20 s

When a query returns a list of N items and each item triggers its own lookup for a related field, you get 1 query for the list plus N extra queries. Batch loading collects those N lookups and runs them as one query.

open as a page

In Spring for GraphQL, how do @QueryMapping and @MutationMapping map controller methods to schema fields, and how does @Argument bind incoming arguments?

level: juniorimportance: must knowfreq 78%
basics
~10 s

Put @QueryMapping or @MutationMapping on a method in a @Controller; the method name matches the schema field under the Query or Mutation type. @Argument binds a named GraphQL argument to a method parameter.

open as a page

In Spring for GraphQL, what happens to the response when a single data fetcher throws an exception?

level: juniorimportance: must knowfreq 42%
basics
~10 s

Spring catches the exception, sets that field to null, and adds an entry to the top-level "errors" array in the response. Other fields that resolved successfully still return their data — a partial response.

open as a page

What is Relay-style cursor-based pagination in Spring for GraphQL, and what do the Connection, Edge, and PageInfo types represent?

level: juniorimportance: must knowfreq 42%
basics
~20 s

It is a standard way to page a list using opaque cursors instead of page numbers. A Connection wraps Edges; each Edge has a node (the item) plus its cursor; PageInfo carries hasNextPage/hasPreviousPage and start/end cursors.

open as a page

What is schema-first GraphQL development in Spring for GraphQL, and where do you put the schema files?

level: juniorimportance: must knowfreq 70%
basics
~10 s

You write the GraphQL schema by hand in SDL (.graphqls) files. Spring Boot loads them from classpath:graphql/ by default and builds the schema from them; your Java code just supplies the data.

open as a page

What is HAL in Spring HATEOAS, and how does a HAL JSON response differ from a plain JSON response?

level: juniorimportance: must knowfreq 55%
basics
~20 s

HAL (Hypertext Application Language) is a JSON format that adds hyperlinks to a resource under a _links object, plus embedded related resources under _embedded. Its media type is application/hal+json. Plain JSON has only data, no links.

open as a page

What is RepresentationModel and EntityModel<T> in Spring HATEOAS, and why would you use EntityModel instead of adding links directly to your DTO?

level: juniorimportance: must knowfreq 70%
basics
~10 s

RepresentationModel is the base class that carries hypermedia links. EntityModel<T> wraps a single domain object plus its links, so you can attach links without changing or extending your original DTO class.

open as a page

What is a RepresentationModelAssembler and why would you use one instead of building links inline in the controller?

level: middleimportance: should knowfreq 45%
basics
~10 s

RepresentationModelAssembler<T, D> is a component that converts a domain entity T into a link-bearing model D (usually EntityModel<T>). It centralizes link-building so controllers and other places produce identical representations instead of duplicating link code.

open as a page

What is Jaxb2Marshaller in Spring Web Services and what does it do?

level: juniorimportance: must knowfreq 55%
basics
~10 s

Jaxb2Marshaller is a Spring adapter around JAXB that converts Java objects to XML (marshal) and XML back to Java objects (unmarshal), so you work with typed objects instead of raw XML in SOAP messages.

open as a page

How does @PayloadRoot map a SOAP request to a handler method, and what are its namespace and localPart attributes?

level: middleimportance: must knowfreq 45%
basics
~20 s

@PayloadRoot maps a method to the root XML element of the SOAP body. namespace is that element's XML namespace URI, localPart is its element name. Spring-WS matches the incoming payload's root element by this qualified name and calls the method.

open as a page

How do you wire MessageDispatcherServlet with ServletRegistrationBean in a Spring Boot app, and why can't you reuse the default DispatcherServlet?

level: middleimportance: must knowfreq 55%
basics
~10 s

Register MessageDispatcherServlet as a separate servlet via a ServletRegistrationBean mapped to something like /ws/*. It's Spring-WS's own front controller for SOAP; the regular DispatcherServlet handles MVC/REST, not SOAP message dispatching or WSDL serving.

open as a page

In Spring Web Services, what is a contract-first SOAP endpoint and what does the @Endpoint annotation do?

level: juniorimportance: should knowfreq 35%
basics
~10 s

Contract-first means you write the XML schema (XSD/WSDL) first, then code against it. @Endpoint marks a class as a Spring-WS handler for SOAP requests — like @Controller but for SOAP instead of REST.

open as a page

What is dynamic WSDL generation in Spring Web Services, and how does DefaultWsdl11Definition produce it?

level: juniorimportance: should knowfreq 45%
basics
~10 s

Spring-WS generates the WSDL at runtime from your XSD schema instead of you hand-writing it. You declare a DefaultWsdl11Definition bean pointing at an XsdSchema, and Spring builds the WSDL from that schema on request.

open as a page

In Spring Modulith, what defines an 'application module' and how do you obtain the module model in code?

level: juniorimportance: must knowfreq 70%
basics
~10 s

By default an application module is a direct sub-package of your main application class's package. You get the model in a test with ApplicationModules.of(Application.class).

open as a page

Why do Spring Modulith applications communicate between modules with published events, and what does @ApplicationModuleListener do?

level: juniorimportance: must knowfreq 45%
basics
~10 s

Instead of one module directly calling another, it publishes an event. A method marked @ApplicationModuleListener in the other module receives that event asynchronously after the publisher's transaction commits, so the modules stay loosely coupled.

open as a page

What does ApplicationModules.verify() do in Spring Modulith, and how do you wire it into a test?

level: juniorimportance: must knowfreq 62%
basics
~20 s

It scans your application's packages, discovers each top-level package as a module, and checks that modules only depend on ones they are allowed to. You run it from a JUnit test; if a rule is broken the test fails.

open as a page

How does Spring Modulith decide which types of a module are public API versus internal, and how is that enforced?

level: middleimportance: must knowfreq 65%
basics
~10 s

Types directly in the module's base package are public API; types in nested sub-packages are internal. Other modules referencing internal types cause ApplicationModules.of(App.class).verify() to fail.

open as a page

What is @ApplicationModuleTest and how does it differ from @SpringBootTest? Explain its bootstrap modes.

level: middleimportance: must knowfreq 55%
basics
~20 s

@ApplicationModuleTest is a Spring Modulith slice test that bootstraps only one module (plus chosen dependencies) instead of the whole app. Its BootstrapMode is STANDALONE (module only), DIRECT_DEPENDENCIES, or ALL_DEPENDENCIES, giving faster, isolated per-module integration tests.

open as a page

What is Spring AI's ChatClient, and how do you make a basic call to a model with it?

level: juniorimportance: must knowfreq 70%
basics
~10 s

ChatClient is Spring AI's fluent client for talking to an LLM. You write chatClient.prompt().user("...").call().content() to send a user message and get the reply back as a String.

open as a page

What is Spring AI's ChatMemory abstraction and why is it needed when talking to an LLM?

level: juniorimportance: must knowfreq 70%
basics
~20 s

LLM calls are stateless — the model forgets previous turns. ChatMemory is a Spring AI interface that stores a conversation's past messages and replays them into each new request, so the model appears to remember the dialogue.

open as a page

What is an EmbeddingModel in Spring AI and what does it produce?

level: juniorimportance: must knowfreq 60%
basics
~10 s

EmbeddingModel is a Spring AI interface that turns text into an embedding — a list of floating-point numbers (a vector) representing the text's meaning. Similar texts get numerically similar vectors, which powers semantic search.

open as a page

In Spring AI, what is a Prompt, and what roles do SystemMessage and UserMessage play inside it?

level: juniorimportance: must knowfreq 70%
basics
~10 s

A Prompt is the request sent to the model: a list of Messages plus optional options. A SystemMessage sets the model's behavior/persona; a UserMessage carries the user's actual input.

open as a page

What is RAG in Spring AI, and what does the QuestionAnswerAdvisor do?

level: juniorimportance: must knowfreq 70%
basics
~10 s

RAG (Retrieval-Augmented Generation) fetches relevant documents from a vector store and adds them to the prompt so the LLM answers from your data. Spring AI's QuestionAnswerAdvisor does this automatically on each ChatClient call.

open as a page

Why does Spring Session let you run multiple stateless app instances behind a load balancer, and what problem does it solve?

level: juniorimportance: must knowfreq 62%
basics
~20 s

By default an HTTP session lives in one server's memory, so a user must stick to that server. Spring Session stores sessions in a shared external store (Redis, JDBC), so any instance can read them.

open as a page

What is Spring Session, and why would you externalize HttpSession to Redis or JDBC instead of using the servlet container's default session?

level: juniorimportance: must knowfreq 62%
basics
~10 s

Spring Session stores the HttpSession in an external store (Redis, a database, etc.) instead of in the app server's memory. This lets multiple server instances share sessions and lets sessions survive restarts.

open as a page

What is Spring Shell, and how do you define a basic interactive command with @ShellComponent and @ShellMethod?

level: juniorimportance: must knowfreq 45%
basics
~20 s

Spring Shell builds interactive command-line apps. You annotate a bean class with @ShellComponent, then annotate a method with @ShellMethod. The method becomes a command you can type at the shell prompt; its parameters become command arguments.

open as a page

What is Spring Statemachine, and what are the core building blocks of a state machine (states, transitions, events)?

level: juniorimportance: must knowfreq 45%
basics
~20 s

Spring Statemachine is a framework for modelling finite state machines. A machine has states (where it currently sits), events (inputs you send), and transitions (rules that move it from one state to another when an event fires).

open as a page

Compare CookieHttpSessionIdResolver and HeaderHttpSessionIdResolver. When would you switch from cookies to a header?

level: middleimportance: must knowfreq 55%
basics
~20 s

An HttpSessionIdResolver decides how the session ID travels between client and server. The cookie resolver (default) uses a Set-Cookie/Cookie. The header resolver reads/writes it in an HTTP header (e.g. X-Auth-Token), which suits non-browser clients like mobile apps or SPAs across domains.

open as a page