I would like extend database mongo configuration about UuidRepresentation STANDARD. I want also use by default all possible 'spring.data.mongodb.*...' properties in *.yml files. I did try this way:
@Configuration
public class MongoConfig {
@Bean
public MongoClient mongo() {
MongoClientOptions.Builder builder = MongoClientOptions.builder();
CodecRegistry codecRegistry = fromRegistries(fromCodecs(new UuidCodec(UuidRepresentation.STANDARD)),
MongoClient.getDefaultCodecRegistry());
builder.codecRegistry(codecRegistry);
MongoClientOptions options = builder.build();
return new MongoClient(new ServerAddress(), options);
}
}
Uuid representation was changed successful but was created new MongoClient bean without implementation value from .yml file for example uri. I can use needed properties by mapping it to new MongoClient but when anyone will tray use other default properties from 'spring.data.mongodb.*...' must also remember map this value to new Bean.
It is possible to change default MongoClient configuration only about change UuidRepresentation without create new MongoClien Bean ?
I use SpringBoot 2.1.3 with java 8.