spring-cloud / spring-cloud/spring-cloud-function

UPDATED: Type resolution with deep generic hierarchies still fail in 2025.1.1 (regression from issue #1312)

Đang mở
#1,325 3 bình luận 2 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
Java
Star
1.1k
Fork
641
Merge trung bình
11 giờ 2 phút
Pull request đã merge (30 ngày)
8

Mô tả

Description

This is a follow-up to issue #1312 ("Type resolution with deep generic hierarchies is incorrect"). After upgrading Spring Cloud BOM from 2025.0.0 to 2025.1.1 and Spring Boot to 4.0.3, type resolution issues persist in batch mode consumption.

The demo repository (ferblaca/demoStreamGenerics/tree/upgrade_to_2025_0_0) was re-tested to confirm the behavior.

Current Behavior
Single Mode - All Consumers Work ✅
  • productConsumer (GenericConsumer<ProductCompleteDTO>)
  • productConsumer2 (Consumer<ProductCompleteDTO>)
  • productMessageConsumer (GenericMessageConsumer<ProductCompleteDTO>)
  • productMessageConsumer2 (Consumer<Message<ProductCompleteDTO>>)
Batch Mode - Partial Failure ⚠️
  • productBatchListConsumer (GenericBatchListConsumer<ProductCompleteDTO>): ❌ Fails — payload arrives as byte[........]
  • productBatchListConsumer2 (Consumer<List<ProductCompleteDTO>>): ✅ Works
  • productBatchListMessageConsumer (GenericBatchMessageListConsumer<ProductCompleteDTO>): ✅ Works
  • productBatchListMessageConsumer2 (Consumer<Message<List<ProductCompleteDTO>>>): ✅ Works
Root Cause

Only the productBatchListConsumer bean with the following signature fails to deserialize correctly:

@Bean
public GenericBatchListConsumer<ProductCompleteDTO> productBatchListConsumer() {
    return new GenericBatchListConsumer<>("productBatchListConsumer");
}

Where GenericBatchListConsumer is defined as:

public class GenericBatchListConsumer<T> implements Consumer<List<T>> {
    // ...
}

Instead of deserializing to the expected type, the message payload arrives as raw bytes:

Received Batch List productBatchListConsumer Consumer: [123, 34, 105, 100, 34, 58, 49, ...]
Steps to Reproduce
  1. Clone the demo repository
  2. Update pom.xml with:
    • Spring Cloud BOM: 2025.1.1
    • Spring Boot: 4.0.3
  3. Run ./mvnw spring-boot:run (Kafka starts automatically via Docker Compose)
  4. Send the same test messages from the original issue
  5. Check the logs for the byte array payload symptom
Environment
Component Version
Spring Boot 4.0.3
Spring Cloud Stream 5.0.1
Spring Cloud Function 5.0.1
Message Broker Kafka (KRaft mode via Docker Compose)

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng cách chạy bản demo với ./mvnw spring-boot:run sau khi kiểm tra các thay đổi phiên bản trong pom.xml, sau đó theo dõi bean productBatchListConsumer và chữ ký GenericBatchListConsumer được mô tả trong issue. So sánh batch payload của nó với các consumer đang hoạt động; công việc được xem là hoàn tất khi nó được deserialize thành các giá trị ProductCompleteDTO thay vì các byte thô, đồng thời các consumer hiện có ở chế độ single và batch vẫn tiếp tục hoạt động.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
docker-compose, java, kafka, spring, spring-boot
Lĩnh vực
backend, distributed-systems
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
48/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.