Skip to content

AMQP autoconfig breaks on Spring Boot 4.1 / Spring AMQP 4.1 (ConditionalRejectingErrorHandler.DefaultExceptionStrategy removed) #112

Description

@rammrain

spring-core 5.0.0 fails at application-context load with Spring Boot 4.1.0 (Spring AMQP 4.1.0). Boot 4.0.6 (Spring AMQP 4.0.3) works.

Error

BeanCreationException: bean "rabbitListenerContainerFactory" in ee/bitweb/core/amqp/AmqpAutoConfiguration.class
  → factory method "jsaFactory" threw:
    NoClassDefFoundError: org/springframework/amqp/rabbit/listener/ConditionalRejectingErrorHandler$DefaultExceptionStrategy

Root cause

In Spring AMQP 4.1, org.springframework.amqp.rabbit.listener.ConditionalRejectingErrorHandler was deprecated (@Deprecated(forRemoval = true, since = "4.1")) and relocated to org.springframework.amqp.listener. The nested DefaultExceptionStrategy no longer exists at the old coordinates, so this throws at runtime:

src/main/java/ee/bitweb/core/amqp/CoreExceptionStrategy.java:9

public class CoreExceptionStrategy extends ConditionalRejectingErrorHandler.DefaultExceptionStrategy {

Fix

The class moved to org.springframework.amqp.listener.ConditionalRejectingErrorHandler.DefaultExceptionStrategy (still public static class ... implements FatalExceptionStrategy). Update the import/extends in CoreExceptionStrategy and the ConditionalRejectingErrorHandler references in AmqpAutoConfiguration to the new package. The new package is absent in Spring AMQP 4.0.x, so this likely needs a Spring Boot 4.1 baseline.

Environment

  • ee.bitweb:spring-core:5.0.0
  • Boot 4.1.0 / Spring AMQP 4.1.0 (fails); Boot 4.0.6 / Spring AMQP 4.0.3 (works)
  • Found via a downstream Spring Boot 4.0.6 → 4.1.0 bump.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions