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
Closed
fix(agui-example): configure Spring Boot 4 example to decode AG-UI requests with Jackson 2#2635jujn wants to merge 1 commit into
jujn wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
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
@Configurationclass that supplies anObjectMapperbean intended for Jackson 2 usage. - Add an explicit
jackson-databinddependency 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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
ObjectMapperBean。Checklist
Please check the following items before code is ready to be reviewed.
mvn spotless:applymvn test)