Example usage for org.springframework.data.repository.support DomainClassConverter setApplicationContext

List of usage examples for org.springframework.data.repository.support DomainClassConverter setApplicationContext

Introduction

In this page you can find the example usage for org.springframework.data.repository.support DomainClassConverter setApplicationContext.

Prototype

public void setApplicationContext(ApplicationContext context) 

Source Link

Usage

From source file:org.springframework.data.web.config.SpringDataWebConfiguration.java

@Override
public void addFormatters(FormatterRegistry registry) {

    registry.addFormatter(DistanceFormatter.INSTANCE);
    registry.addFormatter(PointFormatter.INSTANCE);

    if (!(registry instanceof FormattingConversionService)) {
        return;/*from  ww  w.  j a va2  s. c o m*/
    }

    FormattingConversionService conversionService = (FormattingConversionService) registry;

    DomainClassConverter<FormattingConversionService> converter = new DomainClassConverter<>(conversionService);
    converter.setApplicationContext(context);
}

From source file:org.springframework.data.rest.tests.RepositoryTestsConfig.java

@Bean
public DefaultFormattingConversionService defaultConversionService() {

    DefaultFormattingConversionService conversionService = new DefaultFormattingConversionService();

    DomainClassConverter<FormattingConversionService> converter = new DomainClassConverter<FormattingConversionService>(
            conversionService);//  ww  w .  j  a  va  2 s  .co  m
    converter.setApplicationContext(appCtx);

    return conversionService;
}