flapdoodle-oss / de.flapdoodle.embed.mongo.spring

embedded mongo spring integration
Apache License 2.0
30 stars 7 forks source link

Cannot set version via IFeatureAwareVersion bean #27

Closed chillb0nes closed 10 months ago

chillb0nes commented 1 year ago

Hello! I'm developing a custom boot starter for my team which configures some common dev dependencies. I want to set embedded mongodb version in this boot starter auto-configuration, so that the de.flapdoodle.mongodb.embedded.version property does not have to be set in every project that uses it.

I tried to define version bean as follows:

@Bean
public IFeatureAwareVersion embeddedMongoVersion() {
    return Version.V4_4_16;
}

but I still got an error: java.lang.IllegalStateException: Set the de.flapdoodle.mongodb.embedded.version property or define your own IFeatureAwareVersion bean to use embedded MongoDB.

I think the IFeatureAwareVersion bean in your auto-configuration https://github.com/flapdoodle-oss/de.flapdoodle.embed.mongo.spring/blob/0fda9e0e9cea0099089134d25a4dc698c4104615/src/main/java/de/flapdoodle/embed/mongo/spring/autoconfigure/EmbeddedMongoAutoConfiguration.java#L119-L122 is missing @ConditionalOnMissingBean annotation, so it can't be overridden.

michaelmosmann commented 1 year ago

@chillb0nes ah..ok.. i think i can change that.

chillb0nes commented 10 months ago

Hello @michaelmosmann

I can look into this if you don't have time. I just didn't see any other contributors in the commit history, so I wasn't sure if this kind of contribution would be appropriate.

michaelmosmann commented 10 months ago

@chillb0nes .. I do welcome every contribution:)

chillb0nes commented 10 months ago

Looks like this was already fixed with https://github.com/flapdoodle-oss/de.flapdoodle.embed.mongo.spring/commit/7f25beec41cdf3f0323de90caf0a8e3f750bc1ae. I checked original case with newer version, and it works now.

michaelmosmann commented 10 months ago

@chillb0nes .. i think i forgot that i fixed that already.. sorry.. :)