Overview
Spring Session MongoDB is a library that allows Spring-based applications to store HTTP session data in MongoDB. This integration between Spring Session and MongoDB provides reliable and scalable sessions for applications that run on multiple servers or containers, because any instance can access the same session data. When using MongoDB for session storage, you can maintain sessions after your application restarts and share sessions across a cluster with minimal configuration.
Spring Session 4.0 introduces the first MongoDB-maintained release of the Spring Session MongoDB integration. When working with the integration, you can now receive direct support from the MongoDB engineers who develop the MongoDB Java Driver. This change ensures that Spring Session MongoDB aligns with the latest Java driver releases and API improvements.
Getting Started
You can use the MongoDB-maintained Spring Session integration in your application by creating a new Spring Boot application, or by updating an existing application that uses an earlier version of Spring Session MongoDB.
Create a New Application
To learn how to create a Spring Boot application that uses Spring Session MongoDB to manage user session information, follow the Get Started with Spring Session MongoDB tutorial.
Migrate Your Application
If you have an existing application that uses the Spring Session MongoDB integration maintained by Spring, migrate to the MongoDB-maintained integration by performing the following updates:
Update your Maven artifact from
org.springframework.session:spring-session-data-mongodbtoorg.mongodb:mongo-spring-session. To learn more about the new artifact, see mongodb-spring-session in Maven Central.Change the API namespace from
org.springframework.session.data.mongotoorg.mongodb.spring.session. Ensure that your import statements use the new namespace.Because Jackson 2 support is now deprecated, update your application to use
JacksonMongoSessionConverter. This is the Jackson 3 session converter.
Issues & Help
Bugs / Feature Requests
If you have feedback about Spring Session MongoDB, visit the Frameworks section of the MongoDB Feedback Engine. You can propose improvements, report issues, and provide other types of feedback by using this site.
You can also open a case in Jira, our issue management tool, to identify bugs or propose improvements. The following steps describe how to create a Jira issue:
Visit the MongoDB Jira issue tracker and click the signup link. Create an account, and then log in to Jira.
Navigate to the JAVAF Jira project.
Click Create to create a ticket. Provide as much information as possible about the issue or request in the ticket.
Note
Bug reports in the JAVAF Jira project are publicly viewable.
If you’ve identified a security vulnerability in any official MongoDB product, you can report it according to the instructions found in the Create a Vulnerability Report page.
Pull Requests
We are happy to accept contributions to help improve Spring Session MongoDB. We will guide user contributions to ensure they meet the standards of the codebase. Ensure that any pull requests include documentation, tests, and pass the gradle checks.
To contribute to the integration, run the following commands to check out the source repository and work on a branch:
git clone https://github.com/mongodb/mongo-spring-session.git cd mongo-spring-session git checkout -b myNewFeature
Then, ensure that the code passes gradle checks by running the following command:
./gradlew clean check
Compatibility
To view compatibility information for the MongoDB-maintained Spring Session module, see the compatibility page.
Additional Information
To learn more about Spring Session MongoDB, see the following resources:
Spring Session MongoDB source code
Spring Session documentation