Class ReactiveMongoSessionRepository

java.lang.Object
org.springframework.session.data.mongo.ReactiveMongoSessionRepository
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationEventPublisherAware, org.springframework.session.ReactiveSessionRepository<MongoSession>
Direct Known Subclasses:
ReactiveMongoOperationsSessionRepository

public class ReactiveMongoSessionRepository extends Object implements org.springframework.session.ReactiveSessionRepository<MongoSession>, org.springframework.context.ApplicationEventPublisherAware, org.springframework.beans.factory.InitializingBean
A ReactiveSessionRepository implementation that uses Spring Data MongoDB.
Since:
2.2.0
  • Field Details

    • DEFAULT_INACTIVE_INTERVAL

      public static final int DEFAULT_INACTIVE_INTERVAL
      The default time period in seconds in which a session will expire.
      See Also:
    • DEFAULT_COLLECTION_NAME

      public static final String DEFAULT_COLLECTION_NAME
      The default collection name for storing session.
      See Also:
  • Constructor Details

    • ReactiveMongoSessionRepository

      public ReactiveMongoSessionRepository(org.springframework.data.mongodb.core.ReactiveMongoOperations mongoOperations)
  • Method Details

    • createSession

      public reactor.core.publisher.Mono<MongoSession> createSession()
      Creates a new MongoSession that is capable of being persisted by this ReactiveSessionRepository.

      This allows optimizations and customizations in how the MongoSession is persisted. For example, the implementation returned might keep track of the changes ensuring that only the delta needs to be persisted on a save.

      Specified by:
      createSession in interface org.springframework.session.ReactiveSessionRepository<MongoSession>
      Returns:
      a new MongoSession that is capable of being persisted by this ReactiveSessionRepository
    • save

      public reactor.core.publisher.Mono<Void> save(MongoSession session)
      Specified by:
      save in interface org.springframework.session.ReactiveSessionRepository<MongoSession>
    • findById

      public reactor.core.publisher.Mono<MongoSession> findById(String id)
      Specified by:
      findById in interface org.springframework.session.ReactiveSessionRepository<MongoSession>
    • deleteById

      public reactor.core.publisher.Mono<Void> deleteById(String id)
      Specified by:
      deleteById in interface org.springframework.session.ReactiveSessionRepository<MongoSession>
    • afterPropertiesSet

      public void afterPropertiesSet()
      Do not use ReactiveIndexOperations to ensure indexes exist. Instead, get a blocking IndexOperations and use that instead, if possible.
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
    • setApplicationEventPublisher

      public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher eventPublisher)
      Specified by:
      setApplicationEventPublisher in interface org.springframework.context.ApplicationEventPublisherAware
    • getMaxInactiveIntervalInSeconds

      public Integer getMaxInactiveIntervalInSeconds()
    • setMaxInactiveIntervalInSeconds

      public void setMaxInactiveIntervalInSeconds(Integer maxInactiveIntervalInSeconds)
    • getCollectionName

      public String getCollectionName()
    • setCollectionName

      public void setCollectionName(String collectionName)
    • setMongoSessionConverter

      public void setMongoSessionConverter(AbstractMongoSessionConverter mongoSessionConverter)
    • setBlockingMongoOperations

      public void setBlockingMongoOperations(org.springframework.data.mongodb.core.MongoOperations blockingMongoOperations)