Class SpringDataMongoBundle<C extends io.dropwizard.Configuration>

  • All Implemented Interfaces:
    io.dropwizard.ConfiguredBundle<C>

    public class SpringDataMongoBundle<C extends io.dropwizard.Configuration>
    extends java.lang.Object
    implements io.dropwizard.ConfiguredBundle<C>
    • Method Detail

      • initialize

        public void initialize​(io.dropwizard.setup.Bootstrap<?> bootstrap)
        Specified by:
        initialize in interface io.dropwizard.ConfiguredBundle<C extends io.dropwizard.Configuration>
      • run

        public void run​(C configuration,
                        io.dropwizard.setup.Environment environment)
        Specified by:
        run in interface io.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 in run(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 interface
        S - the type of the entity
        ID - 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