alibaba / alibaba/spring-context-support
ConfigurationBeanBindingPostProcessor无法对serialization-name类型的配置进行驼峰转换并注入属性
- Dominant language
- Java
- Stars
- 155
- Forks
- 87
- PR merge metrics
- No merged PRs in 30d
Description
### 版本为:1.0.10
### 使用方式:
1. application.properties的配置如下:
```properties
envoy.protocol.id=huangfu3
envoy.protocol.port=22123
envoy.protocol.serialization-name=123
```
2. 对应的实体类如下:
```java
/**
* 协议名称
*/
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 完成注入
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by inspecting ConfigurationBeanBindingPostProcessor and reproduce the reported binding with the application.properties keys and entity fields shown in the issue. Trace how serialization-name is resolved compared with serializationName; done when the hyphenated property binds correctly without the reported manual BeanPostProcessor workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100