0

I'm working on Spring Webflux, Kotlin, Mongo Project.

I'm using EmbeddedMongoDB to back DB in test codes.

Because spring tests automatically use EmbeddedMongoDB when not configured, we had to always exclude it like this post suggests.

spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.mongo.embedded.EmbeddedMongoAutoConfiguration

For test cases that needs EmbeddedMongoDB, I made a custom annotation class just like this post's answer.

@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.CLASS)
@Import(EmbeddedMongoAutoConfiguration::class)
annotation class EnableEmbeddedMongo

But when I ran tests that don't need EmbeddedMongoDB on Apple Silicon M1 macbooks, the default exclusion doesn't work, and embeddedMongoDB would just start even when I didn't attached EnableEmbeddedMongo annotation.

What could be the problem?

Kyoo Sik Lee
  • 363
  • 4
  • 19

1 Answers1

0

I don't think this is related to Apple Silicon. The only thing I encountered in a little over year working with M1 is that you need to update your JVM to a M1 capable.

Probably this will do the trick for you:

@TestPropertySource(properties = "spring.mongodb.embedded.version=3.5.5")

See https://stackoverflow.com/a/70443590/6500730

nykon
  • 504
  • 4
  • 18