[Postman] lowCamelCase JSON 데이터 보내기

Jimin·2022년 11월 21일
0

//application.yml

  jackson:
    property-naming-strategy: com.d138.wheere.controller.Guava.CustomNamingStrategy
    mapper:
      use-std-bean-naming: true

package com.d138.wheere.controller.Guava;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;

public class CustomNamingStrategy extends PropertyNamingStrategies.NamingBase {
    @Override
    public String translate(String input) {

        if (input == null || input.isEmpty()) {
            return input;
        }

        char c = input.charAt(0);
        char lc = Character.toLowerCase(c);

        if (c == lc) {
            return input;
        }

        StringBuilder sb = new StringBuilder(input);
        sb.setCharAt(0, lc);

        return sb.toString();
    }
}

0개의 댓글