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-3467: Fix KafkaListenerAnnotationBeanPostProcessor for early BF access #3468

Merged
merged 1 commit into from
Aug 29, 2024

Conversation

artembilan
Copy link
Member

Fixes: #3467

The KafkaListenerAnnotationBeanPostProcessor.afterPropertiesSet() get access to BeanFactory for other beans which causes a warning into logs like:

is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor

The rule of thumb is to not have any bean factory access from BeanPostProcessor initialization phase

  • Fix KafkaListenerAnnotationBeanPostProcessor to buildEnhancer() i lazy manner. Therefore remove an afterPropertiesSet() altogether

Auto-cherry-pick to 3.2.x & 3.1.x

…` for early BF access

Fixes: spring-projects#3467

The `KafkaListenerAnnotationBeanPostProcessor.afterPropertiesSet()` get access to `BeanFactory`
for other beans which causes a warning into logs like:
```
is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor
```

The rule of thumb is to not have any bean factory access from `BeanPostProcessor` initialization phase

* Fix `KafkaListenerAnnotationBeanPostProcessor` to `buildEnhancer()` i lazy manner.
Therefore remove an `afterPropertiesSet()` altogether

**Auto-cherry-pick to `3.2.x` & `3.1.x`**
@sobychacko sobychacko merged commit 4a135a1 into spring-projects:main Aug 29, 2024
3 checks passed
spring-builds pushed a commit that referenced this pull request Aug 29, 2024
…access (#3468)

Fixes: #3467

#3467

The `KafkaListenerAnnotationBeanPostProcessor.afterPropertiesSet()` gets access to `BeanFactory`
for other beans which causes a warning into logs like:
```
is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor
```

The rule of thumb is not to have any bean factory access from `BeanPostProcessor` initialization phase.

* Fix `KafkaListenerAnnotationBeanPostProcessor` to `buildEnhancer()` in lazy manner.
Therefore remove an `afterPropertiesSet()` altogether.

(cherry picked from commit 4a135a1)
spring-builds pushed a commit that referenced this pull request Aug 29, 2024
…access (#3468)

Fixes: #3467

#3467

The `KafkaListenerAnnotationBeanPostProcessor.afterPropertiesSet()` gets access to `BeanFactory`
for other beans which causes a warning into logs like:
```
is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor
```

The rule of thumb is not to have any bean factory access from `BeanPostProcessor` initialization phase.

* Fix `KafkaListenerAnnotationBeanPostProcessor` to `buildEnhancer()` in lazy manner.
Therefore remove an `afterPropertiesSet()` altogether.

(cherry picked from commit 4a135a1)
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.

Warning log when using AnnotationEnhancer
2 participants