mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-17 12:09:16 +00:00
Polish
This commit is contained in:
+6
-7
@@ -32,7 +32,7 @@ import org.springframework.data.mongodb.core.convert.DefaultDbRefResolver;
|
||||
import org.springframework.data.mongodb.core.convert.MappingMongoConverter;
|
||||
import org.springframework.data.mongodb.core.convert.MongoConverter;
|
||||
import org.springframework.data.mongodb.core.convert.MongoCustomConversions;
|
||||
import org.springframework.data.mongodb.core.convert.MongoCustomConversions.BigDecimalRepresentation;
|
||||
import org.springframework.data.mongodb.core.convert.MongoCustomConversions.MongoConverterConfigurationAdapter;
|
||||
import org.springframework.data.mongodb.core.convert.NoOpDbRefResolver;
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
import org.springframework.data.mongodb.core.mapping.MongoMappingContext;
|
||||
@@ -77,12 +77,11 @@ class MongoDataConfiguration {
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
MongoCustomConversions mongoCustomConversions() {
|
||||
return MongoCustomConversions.create((configurer) -> {
|
||||
BigDecimalRepresentation bigDecimaRepresentation = this.properties.getRepresentation().getBigDecimal();
|
||||
if (bigDecimaRepresentation != null) {
|
||||
configurer.bigDecimal(bigDecimaRepresentation);
|
||||
}
|
||||
});
|
||||
return MongoCustomConversions.create(this::configureConversions);
|
||||
}
|
||||
|
||||
private void configureConversions(MongoConverterConfigurationAdapter configurer) {
|
||||
PropertyMapper.get().from(this.properties.getRepresentation()::getBigDecimal).to(configurer::bigDecimal);
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
Reference in New Issue
Block a user