Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-973: Higher order for RabbitListTestBootstrap #976

Merged

Conversation

artembilan
Copy link
Member

Fixes #973

When we use @EnableRabbit and @RabbitListenerTest in the same
configuration set, e.g. mixing real @Configuration and test one for
@RabbitListenerTest, we may end up with the case when @EnableRabbit
is processed before @RabbitListenerTest, so, RabbitListenerTestHarness
bean is not going to appear in the application context.

  • Implement a DeferredImportSelector with an @Order for the
    @EnableRabbit as well as RabbitListenerTest giving higher order to
    the RabbitListenerTestSelector, so RabbitListenerTestBootstrap is
    processed and register its RabbitListenerTestHarness earlier, than it
    is done by the RabbitBootstrapConfiguration

Cherry-pick to 2.1.x

Fixes spring-projects#973

When we use `@EnableRabbit` and `@RabbitListenerTest` in the same
configuration set, e.g. mixing real `@Configuration` and test one for
`@RabbitListenerTest`, we may end up with the case when `@EnableRabbit`
is processed before `@RabbitListenerTest`, so, `RabbitListenerTestHarness`
bean is not going to appear in the application context.

* Implement a `DeferredImportSelector` with an `@Order` for the
`@EnableRabbit` as well as `RabbitListenerTest` giving higher order to
the `RabbitListenerTestSelector`, so `RabbitListenerTestBootstrap` is
processed and register its `RabbitListenerTestHarness` earlier, than it
is done by the `RabbitBootstrapConfiguration`

**Cherry-pick to 2.1.x**
@artembilan artembilan requested a review from garyrussell April 10, 2019 18:44
* Add JavaDocs to new classes
@garyrussell garyrussell merged commit 24e8048 into spring-projects:master Apr 10, 2019
garyrussell pushed a commit that referenced this pull request Apr 10, 2019
* GH-973: Higher order for RabbitListTestBootstrap

Fixes #973

When we use `@EnableRabbit` and `@RabbitListenerTest` in the same
configuration set, e.g. mixing real `@Configuration` and test one for
`@RabbitListenerTest`, we may end up with the case when `@EnableRabbit`
is processed before `@RabbitListenerTest`, so, `RabbitListenerTestHarness`
bean is not going to appear in the application context.

* Implement a `DeferredImportSelector` with an `@Order` for the
`@EnableRabbit` as well as `RabbitListenerTest` giving higher order to
the `RabbitListenerTestSelector`, so `RabbitListenerTestBootstrap` is
processed and register its `RabbitListenerTestHarness` earlier, than it
is done by the `RabbitBootstrapConfiguration`

**Cherry-pick to 2.1.x**

* * Fix Checkstyle
* Add JavaDocs to new classes
@garyrussell
Copy link
Contributor

Cherry-picked as c71ed1e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RabbitListenerTestHarness not autowiring
2 participants