Skip to content

Add support for testing overriden DispatcherServlet instances in mvc test framework [SPR-10426] #15059

@spring-projects-issues

Description

@spring-projects-issues

Anthony Gerrard opened SPR-10426 and commented

Status Quo

Because the MVC test framework uses a subclass of DispatcherServlet it makes it difficult to test functionality if your application overrides the DispatcherServlet.

Proposal

It would be nice if you could pass in a DispatcherServlet say like this:

this.mockMvc = MockMvcBuilders
                .webAppContextSetup(applicationContext, new MyDispatcherServlet())
                .build();

You'd obviously need to tweak what is done under the covers. Maybe switching TestDispatcherServlet to be a decorator?


Affects: 3.2.2

Issue Links:

1 votes, 4 watchers

Metadata

Metadata

Assignees

Labels

in: testIssues in the test modulein: webIssues in web modules (web, webmvc, webflux, websocket)status: declinedA suggestion or change that we don't feel we should currently applytype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions