EmbedMongo - Spring Factory

A builder and Spring FactoryBean for EmbedMongo

License

License

MIT
GroupId

GroupId

cz.jirutka.spring
ArtifactId

ArtifactId

embedmongo-spring
Last Version

Last Version

1.3.1
Release Date

Release Date

Type

Type

jar
Description

Description

EmbedMongo - Spring Factory
A builder and Spring FactoryBean for EmbedMongo
Project URL

Project URL

https://github.com/jirutka/embedmongo-spring
Source Code Management

Source Code Management

https://github.com/jirutka/embedmongo-spring

Download embedmongo-spring

How to add to project

<!-- https://jarcasting.com/artifacts/cz.jirutka.spring/embedmongo-spring/ -->
<dependency>
    <groupId>cz.jirutka.spring</groupId>
    <artifactId>embedmongo-spring</artifactId>
    <version>1.3.1</version>
</dependency>
// https://jarcasting.com/artifacts/cz.jirutka.spring/embedmongo-spring/
implementation 'cz.jirutka.spring:embedmongo-spring:1.3.1'
// https://jarcasting.com/artifacts/cz.jirutka.spring/embedmongo-spring/
implementation ("cz.jirutka.spring:embedmongo-spring:1.3.1")
'cz.jirutka.spring:embedmongo-spring:jar:1.3.1'
<dependency org="cz.jirutka.spring" name="embedmongo-spring" rev="1.3.1">
  <artifact name="embedmongo-spring" type="jar" />
</dependency>
@Grapes(
@Grab(group='cz.jirutka.spring', module='embedmongo-spring', version='1.3.1')
)
libraryDependencies += "cz.jirutka.spring" % "embedmongo-spring" % "1.3.1"
[cz.jirutka.spring/embedmongo-spring "1.3.1"]

Dependencies

compile (4)

Group / Artifact Type Version
de.flapdoodle.embed : de.flapdoodle.embed.mongo jar 1.46.4
de.flapdoodle.embed : de.flapdoodle.embed.process jar 1.40.1
org.mongodb : mongo-java-driver jar 2.13.0
org.slf4j : slf4j-api jar 1.7.10

provided (1)

Group / Artifact Type Version
org.springframework : spring-beans jar 3.0.0.RELEASE

test (3)

Group / Artifact Type Version
org.spockframework : spock-core jar 1.0-groovy-2.3
ch.qos.logback : logback-classic jar 1.1.2
org.codehaus.groovy : groovy jar 2.3.9

Project Modules

There are no modules declared in this project.

Spring Factory Bean for EmbedMongo

Build Status Maven Central

Spring Factory Bean for EmbedMongo that runs “embedded” MongoDB as managed process to use in integration tests (especially with CI). Unlike EmbedMongo default settings, this factory uses Slf4j for all logging by default so you can use any logging implementation you want.

Since v1.2 a convenient builder for Java-based configuration is also provided. This builder isn’t tied with the Spring Framework, so it can be useful even for non-Spring projects.

EmbedMongo isn’t truly embedded Mongo as there’s no Java implementation of the MongoDB. It actually downloads original MongoDB binary for your platform and runs it. See embedmongo.flapdoodle.de for more information.

Usage

<bean id="mongo" class="cz.jirutka.spring.embedmongo.EmbeddedMongoFactoryBean"
      p:version="2.4.5"
      p:bindIp="127.0.0.1"
      p:port="12345" />
@Bean(destroyMethod="close")
public Mongo mongo() throws IOException {
    return new EmbeddedMongoBuilder()
            .version("2.4.5")
            .bindIp("127.0.0.1")
            .port(12345)
            .build();
}

All properties are optional and have usable default values.

Maven

Released versions are available in The Central Repository. Just add this artifact to your project:

<dependency>
    <groupId>cz.jirutka.spring</groupId>
    <artifactId>embedmongo-spring</artifactId>
    <version>1.3.1</version>
</dependency>

However if you want to use the last snapshot version, you have to add the Sonatype OSS repository:

<repository>
    <id>sonatype-snapshots</id>
    <name>Sonatype repository for deploying snapshots</name>
    <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    <snapshots>
        <enabled>true</enabled>
    </snapshots>
</repository>

Note: If you’re stuck on Java 6 for any absurd reason, use version 1.2.2.

License

This project is licensed under MIT License.

Versions

Version
1.3.1
1.3.0
1.2.2
1.2.1
1.2
1.1
1.0