content: package ljl.bilibili.search.config;
  
  import com.fasterxml.jackson.databind.ObjectMapper;
  import com.fasterxml.jackson.databind.PropertyNamingStrategies;
  import com.fasterxml.jackson.databind.PropertyNamingStrategy;
  import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
  import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
  import org.springframework.context.annotation.Bean;
  import org.springframework.context.annotation.Configuration;
  
  import java.time.LocalDateTime;
  import java.time.format.DateTimeFormatter;
  
  @Configuration
  public class JacksonConfig {
      /**
       *将es中查出来的响应转换成java对象时配置驼峰命名装备策略并添加对Time模块的支持
       */
      @Bean
      public ObjectMapper objectMapper() {
          ObjectMapper mapper = new ObjectMapper();
          JavaTimeModule module = new JavaTimeModule();
          LocalDateTimeSerializer localDateTimeSerializer = new LocalDateTimeSerializer(DateTimeFormatter.ISO_LOCAL_DATE_TIME);
          module.addSerializer(LocalDateTime.class, localDateTimeSerializer);
  //        mapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE);
          mapper.setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE);
          mapper.registerModule(module);
          return mapper;
      }
  }
  