feat(integrations/spring-boot): add Spring Boot REST server integration#963
feat(integrations/spring-boot): add Spring Boot REST server integration#963Sh1bari wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces Spring Boot integration modules for the A2A Java SDK, including shared runtime auto-configuration, a Spring MVC REST transport adapter, runnable client/server examples, and integration tests with a TCK SUT. The review feedback highlights several opportunities to improve robustness and caching behavior: specifically, preventing potential NullPointerExceptions in the MVC controller when handling null or blank request bodies, ensuring the Last-Modified header uses a fixed startup timestamp rather than Instant.now() to allow proper HTTP caching, and safely falling back to the exception class name in the response mapper when a throwable's message is null.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| Map<String, Object> metadata = body == null ? Map.of() | ||
| : JsonUtil.readMetadata(JsonUtil.OBJECT_MAPPER.fromJson(body, com.google.gson.JsonObject.class)); |
There was a problem hiding this comment.
If body is empty or blank (but not null), body == null evaluates to false, and JsonUtil.OBJECT_MAPPER.fromJson(body, ...) will be called. This can return null or throw an exception, leading to a NullPointerException in JsonUtil.readMetadata. Adding a body.isBlank() check ensures we safely default to Map.of() for empty or whitespace-only bodies.
| Map<String, Object> metadata = body == null ? Map.of() | |
| : JsonUtil.readMetadata(JsonUtil.OBJECT_MAPPER.fromJson(body, com.google.gson.JsonObject.class)); | |
| Map<String, Object> metadata = (body == null || body.isBlank()) ? Map.of() | |
| : JsonUtil.readMetadata(JsonUtil.OBJECT_MAPPER.fromJson(body, com.google.gson.JsonObject.class)); |
20a24f8 to
57f190d
Compare
57f190d to
2133456
Compare
Description
Adds the first Spring Boot integration for the A2A Java SDK, focused on the REST server transport.
This PR introduces a modular Spring Boot integration that provides shared server runtime auto-configuration, a Spring MVC REST adapter, a dependency-only starter, runnable examples, integration tests, and automated A2A TCK validation.
What is included
a2a.*properties;Contract and TCK coverage
The required server contract test is implemented by:
integrations/spring-boot/server/rest/spring-boot-server-integration-tests/src/test/java/org/a2aproject/sdk/integrations/springboot/server/rest/A2ASpringBootServerContractTest.javaA2ASpringBootServerContractTestextendsAbstractA2AServerTestand validates the Spring Boot REST server implementation against the shared A2A server contract.Automated TCK validation is provided by:
.github/workflows/run-spring-boot-rest-tck.ymlThe workflow builds the Spring Boot server modules, starts the dedicated REST SUT, runs the A2A TCK, and uploads the generated logs.
Documentation and examples
Each Spring Boot integration module includes a README describing its purpose, usage, build commands, and local execution.
Runnable examples are available under:
examples/spring-boot/rest/serverexamples/spring-boot/rest/clientThe examples demonstrate agent card discovery, blocking message execution, and streaming message execution.
Scope
This PR implements only the completed scope:
Spring Boot → Server → RESTThe module structure leaves room for future JSON-RPC, gRPC, and client integrations, but those are intentionally excluded from the implementation scope of this PR.
Verification
The implementation can be verified with:
mvn -pl integrations/spring-boot/server -am testmvn -pl integrations/spring-boot/server/rest -am testFixes #964