Document how to downgrade dependencies to use embedded Jetty 11
See original GitHub issueIn addition to downgrading the Servlet API to 5.0, we also need to cover the impact that this will have on testing. Framework’s Servlet-related mocks require Servlet 6.0 and will fail due to the absence of ServletConnection when run against the Servlet 5.0 API. Similarly, Jetty requires Servlet 5.0 and will fail due to the absence of HttpSessionContext when run against the Servlet 6.0 API. This leaves us with two arrangements that will work:
- Tests use the Servlet 6.0 API and avoid starting Jetty by only using a mock web environment
- Tests use the Servlet 5.0 API and avoid using Framework’s Servlet mocks by only using a full-blown web environment
If a mixture of web environments is required by an application’s tests, it can be done but it may require some structural changes to separate the two web environments. With Gradle this could be done with different source sets or separate modules. With Maven, I believe separate modules will always be required.
Issue Analytics
- State:
- Created 10 months ago
- Comments:15 (9 by maintainers)

Top Related StackOverflow Question
Yes, I believe that will work as your dependency management for
jakarta.servlet-apiis nearer to the root so it will take precedence over what’s in the importedspring-boot-dependencies.Hi @wilkinsona,
I’m facing this issue in a real application, not only in tests. Do you know how to fix it?
Starters added:
Version: 3.0.0-RC2
Error trace: