spring-cloud / spring-cloud/spring-cloud-function
UPDATED: Type resolution with deep generic hierarchies still fail in 2025.1.1 (regression from issue #1312)
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Java
- Sterne
- 1.1k
- Forks
- 641
- Ø Merge
- 11 Std. 2 Min.
- Gemergte PRs (30 T.)
- 8
Beschreibung
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 asbyte[........]productBatchListConsumer2(Consumer<List<ProductCompleteDTO>>): ✅ WorksproductBatchListMessageConsumer(GenericBatchMessageListConsumer<ProductCompleteDTO>): ✅ WorksproductBatchListMessageConsumer2(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
- Clone the demo repository
- Update
pom.xmlwith:- Spring Cloud BOM:
2025.1.1 - Spring Boot:
4.0.3
- Spring Cloud BOM:
- Run
./mvnw spring-boot:run(Kafka starts automatically via Docker Compose) - Send the same test messages from the original issue
- 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) |
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Führe zunächst die Demo mit ./mvnw spring-boot:run aus, nachdem du die Versionsänderungen in pom.xml überprüft hast, und folge dann der im Issue beschriebenen productBatchListConsumer-Bean und GenericBatchListConsumer-Signatur. Vergleiche deren Batch-Payload mit den funktionierenden Consumern; als erledigt gilt die Aufgabe, wenn sie in ProductCompleteDTO-Werte statt in rohe Bytes deserialisiert wird und die bestehenden Single- und Batch-Modus-Consumer weiterhin funktionieren.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- docker-compose, java, kafka, spring, spring-boot
- Bereich
- backend, distributed-systems
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Aktiv
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 48/100