Skip to content

Modify MongoClientSettings while using auto configuration with mongodb #20195

@heyarny

Description

@heyarny

First off, I'm not using reactive driver.
There are examples using a MongoClientSettingsBuilderCustomizer bean to access the settings builder for modifications. But they don't seem to work with synchronous drivers, which is very confusing, even though they share the same settings.

Right now I'm kinda forced to create my own MongoClient bean to inject custom settings which will break all auto configuration.

I'm trying to register default codec for pojos, because I need them for some special cases.


	@Bean
	public MongoClientSettingsBuilderCustomizer customizer() {
		return (builder) -> {
			CodecRegistry pojoCodecRegistry = CodecRegistries.fromRegistries(
				MongoClientSettings.getDefaultCodecRegistry(),
				CodecRegistries.fromProviders(PojoCodecProvider.builder().automatic(true).build()));
			
			builder.codecRegistry(pojoCodecRegistry);
		};
	}

Would appreciate any workaround for this, if this is not supported yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: supersededAn issue that has been superseded by another

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions