Class MongoConfig

java.lang.Object
com.beassolution.rule.config.MongoConfig

@Configuration public class MongoConfig extends Object
MongoDB configuration class for the Beas Rule Engine.

This class configures the MongoDB connection and template settings including:

  • Custom MongoTemplate configuration
  • Type mapper settings for document serialization
  • Event listener registration
  • Converter configuration

The configuration ensures proper handling of MongoDB documents and enables lifecycle events for data operations.

Since:
1.0
Version:
1.0
Author:
Beas Solution Team
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.data.mongodb.core.MongoTemplate
    mongoTemplate(org.springframework.data.mongodb.MongoDatabaseFactory mongodbDbFactory, org.springframework.data.mongodb.core.mapping.MongoMappingContext mongoMappingContext, org.springframework.context.support.AbstractApplicationContext context, MongoEventListeners mongoEventListeners)
    Creates and configures the MongoTemplate with custom settings.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MongoConfig

      public MongoConfig()
  • Method Details

    • mongoTemplate

      @Bean public org.springframework.data.mongodb.core.MongoTemplate mongoTemplate(org.springframework.data.mongodb.MongoDatabaseFactory mongodbDbFactory, org.springframework.data.mongodb.core.mapping.MongoMappingContext mongoMappingContext, org.springframework.context.support.AbstractApplicationContext context, MongoEventListeners mongoEventListeners)
      Creates and configures the MongoTemplate with custom settings.

      This bean configures the MongoTemplate with specific converter and type mapper settings optimized for the rule engine application.

      Configuration includes:

      • Custom MappingMongoConverter with type mapper
      • Entity lifecycle events enabled
      • Event listener registration
      Parameters:
      mongodbDbFactory - MongoDB database factory
      mongoMappingContext - MongoDB mapping context
      context - Spring application context
      mongoEventListeners - MongoDB event listeners
      Returns:
      Configured MongoTemplate instance