[BUG]对象字段大小写转换不一致
- Dominant language
- Java
- Stars
- 4.4k
- Forks
- 613
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 6
Description
### 问题描述
字段首字母小写第二个字母大写,转换后第二个字母变成小写
### 环境信息
*请填写以下信息:*
- JDK信息: 1.8
- 版本信息:2.0.14
### 重现步骤
定义对象
1. springboot配置
```java
@Configuration
public class JsonCounfig implements WebMvcConfigurer {
@Override
public void configureMessageConverters(List> converters) {
//删除jackson的消息转换器
converters.removeIf(item -> item instanceof MappingJackson2HttpMessageConverter);
//定义一个converters转换消息的对象
FastJsonHttpMessageConverter fastJsonHttpMessageConverter = new FastJsonHttpMessageConverter();
//添加fastjson的配置信息,比如: 是否需要格式化返回的json数据
FastJsonConfig fastJsonConfig = new FastJsonConfig();
fastJsonConfig.setDateFormat(DatePattern.NORM_DATETIME_PATTERN);
//在converter中添加配置信息
fastJsonHttpMessageConverter.setFastJsonConfig(fastJsonConfig);
List mediaTypes = new ArrayList<>();
mediaTypes.add(MediaType.valueOf(MediaType.APPLICATION_JSON_VALUE + ";charset=UTF-8"));
fastJsonHttpMessageConverter.setSupportedMediaTypes(mediaTypes);
//fastjson转换器必须放在StringHttpMessageConverter之后,不然接口返回值如果是字符串,会多加一对双引号
converters.add(fastJsonHttpMessageConverter);
}
}
```
2.定义对象Demo
```java
public class Demo{
private String eAccId;
}
```
3.Controller请求返回
```json
"result": {
"EAccId": "张三"
}
```
### 期待的正确结果
```json
"result": {
"eAccId": "张三"
}
```
Contributor guide
Research direction
Reproduce the issue with the shown Spring Boot converter configuration and the Demo class containing the eAccId field. Trace the Java field-name serialization path, then verify that the response property remains eAccId rather than becoming EAccId.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring-boot
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100