Search in sources :

Example 1 with DefaultMongoConfiguration

use of io.micronaut.configuration.mongo.core.DefaultMongoConfiguration in project micronaut-mongodb by micronaut-projects.

the class MongoProcessFactory method onCreated.

@Override
public DefaultMongoConfiguration onCreated(BeanCreatedEvent<DefaultMongoConfiguration> event) {
    DefaultMongoConfiguration configuration = event.getBean();
    try {
        Optional<ConnectionString> connectionString = configuration.getConnectionString();
        startEmbeddedMongoIfPossible(connectionString.orElse(null), null);
    } catch (IOException e) {
        throw new ConfigurationException("Error starting Embedded MongoDB server: " + e.getMessage(), e);
    }
    return configuration;
}
Also used : ConfigurationException(io.micronaut.context.exceptions.ConfigurationException) IOException(java.io.IOException) ConnectionString(com.mongodb.ConnectionString) DefaultMongoConfiguration(io.micronaut.configuration.mongo.core.DefaultMongoConfiguration)

Aggregations

ConnectionString (com.mongodb.ConnectionString)1 DefaultMongoConfiguration (io.micronaut.configuration.mongo.core.DefaultMongoConfiguration)1 ConfigurationException (io.micronaut.context.exceptions.ConfigurationException)1 IOException (java.io.IOException)1