Skip to content

GH-914: Honor AllowBeanDefOverriding = false #915

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

Merged
merged 2 commits into from
Feb 22, 2019

Conversation

artembilan
Copy link
Member

Fixes #914

  • Rework RabbitBootstrapConfiguration into the ImportBeanDefinitionRegistrar
    and check for bean definitions presence it is going to register.
    This way an override from the RabbitListenerTestBootstrap is going to
    have a precedence and its RabbitListenerTestHarness won't allow a
    regular RabbitListenerAnnotationBeanPostProcessor to be registered
  • Rework TestRabbitTemplate to gather all the listener container
    from the ContextRefreshedEvent instead of the SmartInitializingSingleton.
    Looks like Spring doesn't care about their order, therefore we need to
    be sure that RabbitListenerAnnotationBeanPostProcessor has populated
    its registry with containers before.
  • Demonstrate that allowBeanDefinitionOverriding = false works well
    now in the ExampleRabbitListenerCaptureTest
  • Optimize checkTestConfigs and updateCopyrights Gradle tasks for
    their inputs and outputs for better UP-TO-DATE handling

Cherry-pick to 2.1.x without build.gradle changes

Fixes spring-projects#914

* Rework `RabbitBootstrapConfiguration` into the `ImportBeanDefinitionRegistrar`
and check for bean definitions presence it is going to register.
This way an override from the `RabbitListenerTestBootstrap` is going to
have a precedence and its `RabbitListenerTestHarness` won't allow a
regular `RabbitListenerAnnotationBeanPostProcessor` to be registered
* Rework `TestRabbitTemplate` to gather all the listener container
from the `ContextRefreshedEvent` instead of the `SmartInitializingSingleton`.
Looks like Spring doesn't care about their order, therefore we need to
be sure that `RabbitListenerAnnotationBeanPostProcessor` has populated
its `registry` with containers before.
* Demonstrate that `allowBeanDefinitionOverriding = false` works well
now in the `ExampleRabbitListenerCaptureTest`
* Optimize `checkTestConfigs` and `updateCopyrights` Gradle tasks for
their `inputs` and `outputs` for better `UP-TO-DATE` handling

**Cherry-pick to 2.1.x without `build.gradle` changes**
@garyrussell
Copy link
Contributor

See travis errors.

@artembilan
Copy link
Member Author

Looks like now its' green.

@garyrussell garyrussell merged commit 89446a2 into spring-projects:master Feb 22, 2019
garyrussell pushed a commit that referenced this pull request Feb 22, 2019
* GH-914: Honor AllowBeanDefOverriding = false

Fixes #914

* Rework `RabbitBootstrapConfiguration` into the `ImportBeanDefinitionRegistrar`
and check for bean definitions presence it is going to register.
This way an override from the `RabbitListenerTestBootstrap` is going to
have a precedence and its `RabbitListenerTestHarness` won't allow a
regular `RabbitListenerAnnotationBeanPostProcessor` to be registered
* Rework `TestRabbitTemplate` to gather all the listener container
from the `ContextRefreshedEvent` instead of the `SmartInitializingSingleton`.
Looks like Spring doesn't care about their order, therefore we need to
be sure that `RabbitListenerAnnotationBeanPostProcessor` has populated
its `registry` with containers before.
* Demonstrate that `allowBeanDefinitionOverriding = false` works well
now in the `ExampleRabbitListenerCaptureTest`
* Optimize `checkTestConfigs` and `updateCopyrights` Gradle tasks for
their `inputs` and `outputs` for better `UP-TO-DATE` handling

**Cherry-pick to 2.1.x without `build.gradle` changes**

* * Fix typo in the `ExampleRabbitListenerCaptureTest`
@garyrussell
Copy link
Contributor

And cherry-picked as 5fccf26 after removing gradle changes.

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.

spring-rabbit-test: rabbitListenerAnnotationProcessor has already been defined
2 participants