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

com.gitlab.oliverlj.jsonapi.configuration.JsonApiHttpMessageConvertersConfiguration Maven / Gradle / Ivy

Go to download

A spring boot starter which brings json api converter (https://github.com/jasminb/jsonapi-converter) for your great spring project

There is a newer version: 0.4.0
Show newest version
package com.gitlab.oliverlj.jsonapi.configuration;

import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import com.github.jasminb.jsonapi.ResourceConverter;

/**
 * Configuration for HTTP Message converters that use json api.
 * 
 * @author Olivier LE JACQUES ([email protected])
 *
 */
@Configuration
@ConditionalOnClass(ResourceConverter.class)
@ConditionalOnProperty(name = JsonApiHttpMessageConvertersConfiguration.PREFERRED_MAPPER_PROPERTY, havingValue = "json-api")
@EnableConfigurationProperties(SpringBootStaterJsonApiProperties.class)
@Import({JsonApiResponseEntityExceptionHandler.class, FilterParametersConfiguration.class})
public class JsonApiHttpMessageConvertersConfiguration {

  static final String PREFERRED_MAPPER_PROPERTY = "spring.http.converters.preferred-json-mapper";

  @Bean
  public HttpMessageConverters jsonApiHttpMessageConverter(SpringBootStaterJsonApiProperties springBootStaterJsonApiProperties) {
    return new HttpMessageConverters(new JsonApiHttpMessageConverter(springBootStaterJsonApiProperties));
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy