Skip to content

perf: @Bean初始化优化, 以消除日志:is not eligible for getting processed by all BeanPostProcessors#608

Merged
huayanYu merged 1 commit into
baomidou:masterfrom
qxo:fix-not-eligible
Jan 2, 2024
Merged

perf: @Bean初始化优化, 以消除日志:is not eligible for getting processed by all BeanPostProcessors#608
huayanYu merged 1 commit into
baomidou:masterfrom
qxo:fix-not-eligible

Conversation

@qxo

@qxo qxo commented Dec 23, 2023

Copy link
Copy Markdown
Contributor
  1. 由于Advisor会优先初始化,故相关@bean应加: @ROLE(BeanDefinition.ROLE_INFRASTRUCTURE) 以消除:is not eligible for getting processed by all BeanPostProcessors

  2. 去除@EnableConfigurationProperties(DynamicDataSourceProperties.class) 改为static方式配置是为了加@ROLE(BeanDefinition.ROLE_INFRASTRUCTURE)

  3. spring 5.2+ 配置类如不内部不存在@bean方法引用应加: proxyBeanMethods = false 以去除不必要代理类 肖:ie: @Configuration(proxyBeanMethods = false)

此PR是了消除启动时的以下日志:

 [restartedMain] INFO  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker[376] - Bean 'spring.datasource.dynamic-com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceProperties' of type [com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
12-23 09:29:16.779 [restartedMain] INFO  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker[376] - Bean 'dsProcessor' of type [com.baomidou.dynamic.datasource.processor.DsHeaderProcessor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style
  • Refactor
  • Doc
  • Other, please describe:

The description of the PR:
@bean初始化优化, 以消除日志:is not eligible for getting processed by all BeanPostProcessors

Other information:

…anPostProcessors

1. 由于Advisor会优先初始化,故相关@bean应加: @ROLE(BeanDefinition.ROLE_INFRASTRUCTURE)
以消除:is not eligible for getting processed by all BeanPostProcessors

2. 去除@EnableConfigurationProperties(DynamicDataSourceProperties.class) 改为static方式配置是为了加@ROLE(BeanDefinition.ROLE_INFRASTRUCTURE)

3. spring 5.2+ 配置类如不内部不存在@bean方法引用应加: proxyBeanMethods = false 以去除不必要代理类
 ie: `@Configuration(proxyBeanMethods = false)`

此PR是了消除启动时的以下日志:

```
 [restartedMain] INFO  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker[376] - Bean 'spring.datasource.dynamic-com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceProperties' of type [com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
12-23 09:29:16.779 [restartedMain] INFO  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker[376] - Bean 'dsProcessor' of type [com.baomidou.dynamic.datasource.processor.DsHeaderProcessor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
```
@huayanYu huayanYu merged commit b6d2595 into baomidou:master Jan 2, 2024
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.

2 participants