Skip to content

hzpz/mongeez-spring-boot-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Maven Central Build Status Codacy Badge

Spring Boot Starter for Mongeez

Mongeez is a change management tool for Mongo databases. This project is a starter for Spring Boot that can automatically configure Mongeez and run migration scripts. The auto-configuration makes sure that the migrations happen before any Spring Data Mongo beans are initialized.

Usage

  • Make sure Spring Data Mongo is configured properly.
  • Add dependency to the Mongeez Spring Boot starter:
<dependency>
    <groupId>io.github.hzpz.spring.boot</groupId>
    <artifactId>mongeez-spring-boot-starter</artifactId>
    <version>2.0.1</version>
</dependency>

Configuration

Mongeez can be configured by setting properties with the prefix mongeez or by using the MongeezProperties bean directly.

Disable auto-configuration

To disable the auto-configuration of Mongeez completely, set the property mongeez.enabled to false.

Location of migration script

The default expected location of the migration script (see Create a mongeez.xml file that includes all change logs) is db/mongeez.xml. The simplest way to override the location is by setting the property mongeez.location.

Database

By default, the auto-configuration will configure Mongeez to use the same database that is configured for Spring Data Mongo (either by setting the property spring.data.mongodb.database or by using the MongoProperties bean directly). Override the database by setting the property mongeez.database.

Authentication

If the database requires authentication you need to set username and password twice, for Spring Data Mongo and for Mongeez (either by setting the properties mongeez.username and mongeez.password or by using the MongeezProperties bean directly). This is because Spring Data Mongo clears the password from MongoProperties after using it.