fix: AnnotationEnhancer chain silently discards all modifications in RocketMQMessageListenerBeanPostProcessor

Đang mở
#776 8 bình luận 0 reaction 0 người được giao Xem trên GitHub

@lossend đang làm issue này rồi.

Từ ngày 15/6/2026.

  • #775 của @lossend — đang mở

Đánh giá

Độ khó
1/5
Thời gian dự kiến
Dưới một giờ
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
java, spring
Lĩnh vực
backend

Hướng nghiên cứu

Bắt đầu từ RocketMQMessageListenerBeanPostProcessor.buildEnhancer() và theo dõi cách các bean AnnotationEnhancer đã đăng ký được kết hợp. Xác nhận rằng các thuộc tính đã được tích lũy được trả về và kiểm tra xem một enhancer có thể ghi đè topic hoặc consumerGroup hay không; pull request được liên kết cho biết công việc này đã được tiến hành.

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

Mô tả

Bug Description

In RocketMQMessageListenerBeanPostProcessor.buildEnhancer(), the composed AnnotationEnhancer lambda correctly accumulates modified attributes through all registered enhancer beans into newAttrs, but then returns the original attrs instead of newAttrs.

This makes every registered AnnotationEnhancer bean a silent no-op — attribute modifications are computed but immediately discarded.

Affected Version

2.3.6 (rocketmq-v5-client-spring-boot)

Root Cause

RocketMQMessageListenerBeanPostProcessor.buildEnhancer():

this.enhancer = (attrs, element) -> {
    Map<String, Object> newAttrs = attrs;
    for (AnnotationEnhancer enh : enhancers) {
        newAttrs = enh.apply(newAttrs, element);  // accumulates correctly
    }
    return attrs;   // BUG: discards all changes, should be newAttrs
};

Expected Behavior

AnnotationEnhancer beans registered in the Spring context should be able to override @RocketMQMessageListener annotation attributes (e.g. topic, consumerGroup) at runtime.

Actual Behavior

All AnnotationEnhancer customizations are silently ignored. The original annotation attributes are always used.

Impact

Any application that relies on AnnotationEnhancer to dynamically override @RocketMQMessageListener attributes — for example, injecting topic or consumerGroup from environment properties — will find their customizations have no effect.

Fix

Return newAttrs instead of attrs:

return newAttrs;

A pull request with the fix has been submitted: https://github.com/apache/rocketmq-spring/pull/775

Ngôn ngữ chính
Java
Star
2.3k
Fork
941
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có 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.

Issue khác của apache/rocketmq-spring

Tất cả issue của apache/rocketmq-spring

Issue tương tự

Thêm issue về Java

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.