All Downloads are FREE. Search and download functionalities are using the official Maven repository.

edu.byu.hbll.spring.common.ObjectMapperAutoConfiguration Maven / Gradle / Ivy

The newest version!
package edu.byu.hbll.spring.common;

import edu.byu.hbll.json.ObjectMapperFactory;
import edu.byu.hbll.json.UncheckedObjectMapper;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;

/**
 * Configuration class that registers a new {@link UncheckedObjectMapper} as a spring bean. This can
 * be disabled by setting the property denoted in the ConditionalOnProperty annotation to false.
 */
@ConditionalOnClass(UncheckedObjectMapper.class)
@ConditionalOnMissingBean(UncheckedObjectMapper.class)
@ConditionalOnProperty(name = "byuhbll.spring-common.object-mapper.enabled", matchIfMissing = true)
public class ObjectMapperAutoConfiguration {

  /**
   * Registers a new {@link UncheckedObjectMapper} as a spring bean.
   *
   * @return a new {@link UncheckedObjectMapper}
   */
  @Bean
  public UncheckedObjectMapper objectMapper() {
    return ObjectMapperFactory.newUnchecked();
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy