Skip to content

fix(agui-example): configure Spring Boot 4 example to decode AG-UI requests with Jackson 2 - #2635

Closed
jujn wants to merge 1 commit into
mainfrom
fix/agui-example-jackson2-codec
Closed

fix(agui-example): configure Spring Boot 4 example to decode AG-UI requests with Jackson 2#2635
jujn wants to merge 1 commit into
mainfrom
fix/agui-example-jackson2-codec

Conversation

@jujn

@jujn jujn commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

Description

Spring Boot 4 默认使用 Jackson 3,而 AG-UI 的 MessageContent 模型依赖 Jackson 2 注解和自定义反序列化器,导致 agui-example 示例前端发送请求时 WebFlux 无法解析 RunAgentInput
Type definition error: [simple type, class io.agentscope.core.agui.model.MessageContent]

Change

  • 在 AG-UI 示例模块中显式引入 Jackson 2 依赖。
  • 提供 Jackson 2 ObjectMapper Bean。
  • 配置 Spring WebFlux 使用 Jackson 2 JSON codecs。
  • 保留 Spring Boot 4 默认 Jackson 3 依赖,避免影响其他组件。

Checklist

Please check the following items before code is ready to be reviewed.

  • Code has been formatted with mvn spotless:apply
  • All tests are passing (mvn test)
  • Javadoc comments are complete and follow project conventions
  • Related documentation has been updated (e.g. links, examples, etc.)
  • Code is ready for review

Copilot AI lite review requested due to automatic review settings August 9, 2026 13:05

Copilot AI 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.

Pull request overview

This PR adjusts the agui Spring Boot 4 WebFlux example to prefer Jackson 2 for JSON decoding so AG-UI request models (notably MessageContent) can be deserialized correctly.

Changes:

  • Configure WebFlux to prefer Jackson 2 via spring.http.codecs.preferred-json-mapper: jackson2.
  • Add a Spring @Configuration class that supplies an ObjectMapper bean intended for Jackson 2 usage.
  • Add an explicit jackson-databind dependency in the example module.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
agentscope-examples/agui/src/main/resources/application.yml Sets WebFlux preferred JSON mapper to jackson2.
agentscope-examples/agui/src/main/java/io/agentscope/examples/agui/config/Jackson2Configuration.java Adds a Jackson 2 ObjectMapper bean for the example app.
agentscope-examples/agui/pom.xml Adds jackson-databind dependency to the example module.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +27 to +33
@Bean
@ConditionalOnMissingBean(ObjectMapper.class)
public ObjectMapper jackson2ObjectMapper() {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
return mapper;
}
Comment on lines +67 to +70
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
@jujn jujn closed this Aug 9, 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.

2 participants