Skip to content

feat(integrations/spring-boot): add Spring Boot REST server integration#963

Open
Sh1bari wants to merge 1 commit into
a2aproject:mainfrom
Sh1bari:feature/spring-boot-integration
Open

feat(integrations/spring-boot): add Spring Boot REST server integration#963
Sh1bari wants to merge 1 commit into
a2aproject:mainfrom
Sh1bari:feature/spring-boot-integration

Conversation

@Sh1bari

@Sh1bari Sh1bari commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

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

  • Spring Boot auto-configuration for the A2A server runtime;
  • Spring MVC implementation of the A2A REST transport;
  • dependency-only Spring Boot REST server starter;
  • configuration through a2a.* properties;
  • support for overriding default infrastructure components with custom Spring beans;
  • runnable Spring Boot REST server and client examples;
  • integration and contract tests;
  • a dedicated runnable SUT for A2A TCK validation;
  • module-level README files with usage, build, and run instructions;
  • a GitHub Actions workflow for running the Spring Boot REST TCK.

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.java

A2ASpringBootServerContractTest extends AbstractA2AServerTest and 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.yml

The 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/server
  • examples/spring-boot/rest/client

The examples demonstrate agent card discovery, blocking message execution, and streaming message execution.

Scope

This PR implements only the completed scope:

Spring Boot → Server → REST

The 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 test
mvn -pl integrations/spring-boot/server/rest -am test
bash ./scripts/run-spring-boot-rest-tck.sh

Fixes #964

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +193 to +194
Map<String, Object> metadata = body == null ? Map.of()
: JsonUtil.readMetadata(JsonUtil.OBJECT_MAPPER.fromJson(body, com.google.gson.JsonObject.class));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
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));

@Sh1bari Sh1bari force-pushed the feature/spring-boot-integration branch 2 times, most recently from 20a24f8 to 57f190d Compare June 30, 2026 14:55
@Sh1bari Sh1bari force-pushed the feature/spring-boot-integration branch from 57f190d to 2133456 Compare June 30, 2026 15:30
@Sh1bari Sh1bari changed the title feat(integrations/spring-boot): add initial Spring Boot server integr… feat(integrations/spring-boot): add Spring Boot REST server integration Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feat]: Add Spring Boot server integration

1 participant