Class SpringDataMongoBundle<C extends io.dropwizard.Configuration>
- java.lang.Object
-
- org.sdase.commons.server.spring.data.mongo.SpringDataMongoBundle<C>
-
- All Implemented Interfaces:
io.dropwizard.ConfiguredBundle<C>
public class SpringDataMongoBundle<C extends io.dropwizard.Configuration> extends java.lang.Object implements io.dropwizard.ConfiguredBundle<C>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SpringDataMongoBundle.Builder<T extends io.dropwizard.Configuration>
static interface
SpringDataMongoBundle.CaCertificateConfigProviderBuilder<C extends io.dropwizard.Configuration>
static interface
SpringDataMongoBundle.CustomConverterBuilder<C extends io.dropwizard.Configuration>
static interface
SpringDataMongoBundle.FinalBuilder<C extends io.dropwizard.Configuration>
static interface
SpringDataMongoBundle.InitialBuilder
static interface
SpringDataMongoBundle.MorphiaCompatibilityBuilder<C extends io.dropwizard.Configuration>
static interface
SpringDataMongoBundle.ScanPackageBuilder<C extends io.dropwizard.Configuration>
-
Constructor Summary
Constructors Constructor Description SpringDataMongoBundle(MongoConfigurationProvider<C> configurationProvider)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SpringDataMongoBundle.InitialBuilder
builder()
<T extends org.springframework.data.repository.Repository<S,ID>,S,ID extends java.io.Serializable>
TcreateRepository(java.lang.Class<T> repositoryType)
org.springframework.data.mongodb.core.MongoOperations
getMongoOperations()
void
initialize(io.dropwizard.setup.Bootstrap<?> bootstrap)
com.mongodb.client.MongoClient
mongoClient()
void
run(C configuration, io.dropwizard.setup.Environment environment)
-
-
-
Constructor Detail
-
SpringDataMongoBundle
public SpringDataMongoBundle(MongoConfigurationProvider<C> configurationProvider)
-
-
Method Detail
-
builder
public static SpringDataMongoBundle.InitialBuilder builder()
-
initialize
public void initialize(io.dropwizard.setup.Bootstrap<?> bootstrap)
- Specified by:
initialize
in interfaceio.dropwizard.ConfiguredBundle<C extends io.dropwizard.Configuration>
-
run
public void run(C configuration, io.dropwizard.setup.Environment environment)
- Specified by:
run
in interfaceio.dropwizard.ConfiguredBundle<C extends io.dropwizard.Configuration>
-
mongoClient
public com.mongodb.client.MongoClient mongoClient()
- Returns:
- the
MongoClient
that is connected to the MongoDB cluster. The client may be used for raw MongoDB operations. Usually the Morphia getMongoOperations() should be preferred for database operations. - Throws:
java.lang.IllegalStateException
- if the method is called before the mongoClient is initialized inrun(Configuration, Environment)
-
getMongoOperations
public org.springframework.data.mongodb.core.MongoOperations getMongoOperations()
- Returns:
- the
MongoOperations
that can be used to interact with your MongoDB instance
-
createRepository
public <T extends org.springframework.data.repository.Repository<S,ID>,S,ID extends java.io.Serializable> T createRepository(java.lang.Class<T> repositoryType)
- Type Parameters:
T
- the repository class or interfaceS
- the type of the entityID
- the type of primary key of the entity- Parameters:
repositoryType
- the type of the repository that is created- Returns:
- a new Spring Data Mongo repository
-
-