Skip to content

Commit

Permalink
feat: 전역 jackson 설정 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
JiHongKim98 committed Nov 20, 2024
1 parent 4d45731 commit 9f47571
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/main/java/com/example/daobe/common/config/JacksonConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.example.daobe.common.config;

import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class JacksonConfig {

@Bean
public ObjectMapper objectMapper() {
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.registerModule(new JavaTimeModule());
objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
objectMapper.setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE);
return objectMapper;
}
}

0 comments on commit 9f47571

Please sign in to comment.