package <%=packageName%>.config;

import com.mongodb.Mongo;<% if (authenticationType == 'oauth2') { %>
import <%=packageName%>.config.oauth2.OAuth2AuthenticationReadConverter;<% } %>
import <%=packageName%>.domain.util.JSR310DateConverters.*;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.core.convert.converter.Converter;
import org.springframework.data.mongodb.MongoDbFactory;
import org.springframework.data.mongodb.config.AbstractMongoConfiguration;
import org.springframework.data.mongodb.core.convert.CustomConversions;
import org.springframework.data.mongodb.core.mapping.event.ValidatingMongoEventListener;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;

import javax.inject.Inject;
import java.util.ArrayList;
import java.util.List;

@Configuration
@EnableMongoRepositories("<%=packageName%>.repository")
@Profile(Constants.SPRING_PROFILE_CLOUD)
public class CloudMongoDbConfiguration extends AbstractMongoConfiguration  {

    private final Logger log = LoggerFactory.getLogger(CloudDatabaseConfiguration.class);

    @Inject
    private MongoDbFactory mongoDbFactory;

    @Bean
    public ValidatingMongoEventListener validatingMongoEventListener() {
        return new ValidatingMongoEventListener(validator());
    }

    @Bean
    public LocalValidatorFactoryBean validator() {
        return new LocalValidatorFactoryBean();
    }

    @Bean
    public CustomConversions customConversions() {
        List<Converter<?, ?>> converterList = new ArrayList<>();;<% if (authenticationType == 'oauth2') { %>
        converterList.add(new OAuth2AuthenticationReadConverter());<% } %>
        converterList.add(DateToZonedDateTimeConverter.INSTANCE);
        converterList.add(ZonedDateTimeToDateConverter.INSTANCE);
        converterList.add(DateToLocalDateConverter.INSTANCE);
        converterList.add(LocalDateToDateConverter.INSTANCE);
        converterList.add(DateToLocalDateTimeConverter.INSTANCE);
        converterList.add(LocalDateTimeToDateConverter.INSTANCE);
        return new CustomConversions(converterList);
    }

    @Override
    protected String getDatabaseName() {
        return mongoDbFactory.getDb().getName();
    }

    @Override
    public Mongo mongo() throws Exception {
        return mongoDbFactory().getDb().getMongo();
    }
}

@@ -27,16 +27,53 @@
 onfig;%0A%0A
+import com.github.mongobee.Mongobee;%0A
 import c
@@ -2386,32 +2386,431 @@
 erList);%0A    %7D%0A%0A
+    @Bean%0A    public Mongobee mongobee() throws Exception %7B%0A        log.debug(%22Configuring Mongobee%22);%0A        Mongobee mongobee = new Mongobee(mongo());%0A        mongobee.setDbName(getDatabaseName());%0A        // package to scan for migrations%0A        mongobee.setChangeLogsScanPackage(%22io.github.jhipster.cms.config.dbmigrations%22);%0A        mongobee.setEnabled(true);%0A        return mongobee;%0A    %7D%0A%0A
     @Override%0A  

Add MongoBee support for CloudFoundry