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

ConfigurationBeanBindingPostProcessor无法对serialization-name类型的配置进行驼峰转换并注入属性 #49

Open
huangfusuper opened this issue Mar 30, 2022 · 0 comments

Comments

@huangfusuper
Copy link

版本为:1.0.10

使用方式:

  1. application.properties的配置如下:
envoy.protocol.id=huangfu3
envoy.protocol.port=22123
envoy.protocol.serialization-name=123
  1. 对应的实体类如下:
    /**
     * 协议名称
     */
    private String protocolName = ProtocolNameEnum.NETTY.getName();

    /**
     * 序列化名称
     */
    private String serializationName = SerializationNameEnum.FAST_JSON.getName();

已经使用 @EnableConfigurationBeanBinding 进行绑定该实体类

但是上述配置无法注入 serialization-name 属性,当属性转变为 serializationName 注入成功

期望

spring 中默认会使用驼峰转换的方式,当配置中制定为 xx-xx的时候希望能够注入到 xxXx属性中!

现阶段的处理方式

手动实现一个BeanPostProcessor优先级高于 ConfigurationBeanBindingPostProcessor ,自己向BeanDefinition的attribute中增加一个 驼峰转换后的值,最后再经由ConfigurationBeanBindingPostProcessor 完成注入

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

No branches or pull requests

1 participant