use of org.springframework.core.convert.support.ConfigurableConversionService in project spring-data-mongodb by spring-projects.
the class MongoConvertersUnitTests method convertsUrisToString.
// DATAMONGO-2210
@Test
void convertsUrisToString() {
MongoCustomConversions conversions = new MongoCustomConversions();
assertThat(conversions.getSimpleTypeHolder().isSimpleType(URI.class)).isTrue();
ConfigurableConversionService conversionService = new DefaultConversionService();
conversions.registerConvertersIn(conversionService);
assertThat(conversionService.convert(URI.create("/segment"), String.class)).isEqualTo("/segment");
assertThat(conversionService.convert("/segment", URI.class)).isEqualTo(URI.create("/segment"));
}
use of org.springframework.core.convert.support.ConfigurableConversionService in project spring-framework by spring-projects.
the class AbstractPropertyResolver method getConversionService.
@Override
public ConfigurableConversionService getConversionService() {
// Need to provide an independent DefaultConversionService, not the
// shared DefaultConversionService used by PropertySourcesPropertyResolver.
ConfigurableConversionService cs = this.conversionService;
if (cs == null) {
synchronized (this) {
cs = this.conversionService;
if (cs == null) {
cs = new DefaultConversionService();
this.conversionService = cs;
}
}
}
return cs;
}
Aggregations