Skip to content

Embedded Mongo Autoconfiguration does not work with flapdoodle.embed.mongo > 3.0.0 #28538

Closed
@IsNull

Description

@IsNull

Currently the Embedded Mongo Autoconfigurer uses the outdated de.flapdoodle.embed.mongo:3.0.0, which is from October 2020. (https://search.maven.org/artifact/de.flapdoodle.embed/de.flapdoodle.embed.mongo)

There seem to be breaking changes, so the Autoconfiguration has to be updated for the latest de.flapdoodle.embed.mongo 3.2.0. Simply overwriting the the version wont work:

Caused by: java.lang.InstantiationError: de.flapdoodle.embed.process.config.io.ProcessOutput
	at org.springframework.boot.autoconfigure.mongo.embedded.EmbeddedMongoAutoConfiguration$RuntimeConfigConfiguration.embeddedMongoRuntimeConfig(EmbeddedMongoAutoConfiguration.java:203)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)

https://github.com/spring-projects/spring-boot/blob/main/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java#L207

Motivation

Since MongoDb changed the download urls and the package format, the new version of flapdoodle is required to support anything > than mongodb 4.0...


Fix looks simple, replace ...

ProcessOutput processOutput = new ProcessOutput(
  Processors.logTo(logger, Slf4jLevel.INFO),
  Processors.logTo(logger, Slf4jLevel.ERROR),
  Processors.named("[console>]", Processors.logTo(logger, Slf4jLevel.DEBUG))
);

... with ...

ProcessOutput processOutput = ProcessOutput.named("[console>]", logger);

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