Quick revision
The short answer
I would treat the HttpInvoker interface as the API contract: inventory its methods and transferred types, build a REST or gRPC API on the new Spring Boot 3 server with explicit DTOs, and give the desktop client a new implementation of the same Java interface that calls that API, so the rest of the client barely changes. If not every client can upgrade at once, a small, isolated adapter on the old stack translates HttpInvoker calls to the new API for a limited time, and the Java serialization endpoint is removed as early as possible because it is an attack surface.
What to remember
In this answer, we planned a migration from HttpInvoker to Spring Boot 3. We inventoried the remote interface and its transferred types as the API contract, built a REST or gRPC API with explicit DTOs, and kept the client's Java interface with a new implementation behind it, using @HttpExchange or a generated client if the client moves to a modern Java runtime, or a Java 8 compatible client otherwise. A time-limited, isolated adapter on the old stack bridges clients that upgrade late, and the Java serialization endpoint is removed as early as possible.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
I would treat the HttpInvoker interface as the API contract: inventory its methods and transferred types, build a REST or gRPC API on the new Spring Boot 3 server with explicit DTOs, and give the desktop client a new implementation of the same Java interface that calls that API, so the rest of the client barely changes. If not every client can upgrade at once, a small, isolated adapter on the old stack translates HttpInvoker calls to the new API for a limited time, and the Java serialization endpoint is removed as early as possible because it is an attack surface.
Why this question is asked
Desktop clients make migrations harder than web apps, because we cannot redeploy them all in one evening: some users update late, some machines are locked down, and some customers have their own release cycles. Interviewers use this scenario to see whether we can plan a migration with two moving ends and a security deadline. In this answer, we will recap how HttpInvoker works and why it must go, inventory the contract, design the new API, update the client, bridge the clients that lag behind, and plan the removal of the old endpoint.
1A Quick Recap of HttpInvoker
HttpInvoker was Spring's own remoting protocol. On the server, HttpInvokerServiceExporter published a Java interface at a URL. On the client, HttpInvokerProxyFactoryBean created a proxy implementing that interface. Each method call became an HTTP POST whose body was a Java-serialized RemoteInvocation, holding the method name and arguments, and the response was a serialized result or exception.
It worked well inside one company with one codebase, but it has two problems that force our hand. Spring removed it in Spring Framework 6, so it cannot run on Spring Boot 3. And it deserializes whatever the client sends, which exposes the server to deserialization attacks; for a desktop client, the server is usually reachable from the internet, which makes that risk serious.
2Inventory the Contract
The remote interface is the real API, even if nobody ever wrote it down. We list every method, its parameters, return types and declared exceptions, and then follow every type that crosses the wire, including nested ones. This often reveals surprises: JPA entities with lazy collections, Hibernate proxies, java.util.Date, enums that changed order, or a Map<String, Object> that carries anything at all.
We also measure. Logging which methods are called and how often, for two or three weeks, tells us which operations matter, which are dead, and which are heavy. A typical result is that 40 methods exist, 25 are used, and five carry most of the traffic.
Every one of these types becomes part of a public contract once we move to an explicit API, so this is the moment to decide what each one really needs to contain.
3Build the New API With Explicit DTOs
On the new server, we expose the same operations as a REST API, or gRPC if the team prefers a generated, strongly typed contract. Each operation gets explicit DTOs, small classes or records that contain only the fields the client needs, in a format such as JSON with ISO dates. Exceptions become HTTP status codes with a problem detail body. The domain entities stay on the server.
Versioning the path from the start, as in /api/v1, makes later changes easier because desktop clients will always lag behind the server.
4Keep the Same Java Interface in the Client
To limit client changes, we keep the OrderService interface the desktop code already uses, and swap the HttpInvoker proxy for a new implementation that calls the REST API and maps DTOs to the client's own model classes. The screens and business logic of the client do not change; only the wiring does.
There is a catch: Spring's HTTP interface clients with @HttpExchange need Spring Framework 6, which needs Java 17. A client that stays on Java 8 cannot use them. So we have two choices. We can upgrade the client to a modern Java runtime, which is often easier than it sounds for a desktop app, because we can bundle a runtime with jpackage and the user never installs Java separately; then @HttpExchange, or a client generated from an OpenAPI description, works directly. Or, if the client must stay on Java 8, we write the implementation with a Java 8 compatible HTTP and JSON library, or generate a Java 8 compatible client from the OpenAPI description, behind the same interface.
5Bridge Clients That Cannot Upgrade Yet
If thousands of desktops update over several months, the new server cannot serve old clients directly, because HttpInvoker no longer exists in Spring 6. A practical bridge is a small adapter service that stays on the old stack, say Spring 5.3 on Java 8 or 11. It exposes the old HttpInvoker endpoint and implements OrderService by calling the new REST API. Old clients talk to the adapter; new clients talk to the new API directly.
6 messages in order. Play them, or step through them one at a time.
Only the adapter still speaks HttpInvoker, and only until the last old client is gone.
The adapter is isolated, ideally in its own network zone, with serialization filters that allow only the expected classes, rate limits, and authentication in front of it. It is also time-limited: it has an end date announced to customers, and a dashboard shows how many calls still arrive through it, so we know when we can switch it off.
6Remove the Serialization Endpoint Early
Every day the Java serialization endpoint stays reachable is a day an attacker can try a gadget chain against it. So we plan the end from the start: force an update for clients below a minimum version once the new client is released, shrink the adapter's audience week by week, and set a hard deadline agreed with security. Until then, we apply a strict jdk.serialFilter allowlist on the adapter and keep it patched. When the call count drops to zero, or to a few clients we can contact individually, we turn it off and delete the code.
7Follow-up questions
Why not keep the domain objects and send them as JSON?
Because entities carry persistence details such as lazy collections and bidirectional references, and serializing them couples the client to the server's internal model again. DTOs make the contract explicit and let the server change its model without breaking clients.
REST or gRPC for a desktop client?
REST with JSON is easier to debug and works through corporate proxies and firewalls that desktop users often sit behind. gRPC gives stricter contracts and generated clients but needs HTTP/2 end to end, which some proxies block. For a desktop client over the internet, REST is usually the safer choice.
How do you test that the new implementation behaves like the old one?
Run both implementations of the same interface against a test server and compare their results for recorded inputs. Because the client interface stays the same, we can run the client's existing tests against the new implementation without changing them.
8Conclusion
In this answer, we planned a migration from HttpInvoker to Spring Boot 3. We inventoried the remote interface and its transferred types as the API contract, built a REST or gRPC API with explicit DTOs, and kept the client's Java interface with a new implementation behind it, using @HttpExchange or a generated client if the client moves to a modern Java runtime, or a Java 8 compatible client otherwise. A time-limited, isolated adapter on the old stack bridges clients that upgrade late, and the Java serialization endpoint is removed as early as possible.
Open with
I would start by treating the HttpInvoker interface as the contract it really is. I would list every method and follow every type that crosses the wire, and log usage for a few weeks to see which operations matter.
Then, if they want more
Then on the new Spring Boot 3 server I would expose those operations as a versioned REST API, or gRPC, with explicit DTOs instead of serialized entities, and map exceptions to status codes.
On the client side I want to change as little as possible, so I keep the same Java service interface the screens use and write a new implementation that calls the REST API and maps the DTOs back.
One detail matters here: @HttpExchange clients need Spring 6 and therefore Java 17, so either I move the desktop app to a bundled modern runtime with jpackage, which also makes @HttpExchange or a generated client possible, or, if it must stay on Java 8, I generate a Java 8 compatible client behind the same interface.
Because desktops will not all update at once, I would run a small adapter on the old Spring 5 stack that still accepts HttpInvoker calls and forwards them to the new API, isolated, with a serialization filter and a fixed end date.
And I would remove that serialization endpoint as early as possible, with forced updates and a deadline agreed with security, since it is a deserialization attack surface.
About this answer
- Last updated
- 12 November 2026
- Versions it names
- Java 8, Spring Boot 3, Spring Framework 6, Java 17
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Spring Framework reference, Spring Web MVC
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "A Java 8 desktop client talks to a server through Spring HttpInvoker. The server must...": https://scrivio-interview-library.netlify.app/spring-boot/web-other/10aff0eecb/