In MockMvc
tests all filters end up with empty-string filterName
, breaking OncePerRequestFilter
#31474
Labels
Milestone
As discovered in
spring-boot:3.2.0-RC1
(previous milestone unaffected) changes to populate init parameters and dispatch types in MockMvc auto-configuration have led to all filters (or those without explicit registration?) ending up with empty-string as theirgetFilterName
. This ultimately breaks the OncePerRequestFilter behavior because all filters use.FILTERED
as their request attribute so only the first one runs.The stack here I believe is something like:
So we end up with
MockMvcFilterDecorator
even though we aren't doing any filtering/otherwise -- this is change from last milestone.Then in
MockMvcFilterDecorator#initIfRequired
we create aMockFilterConfig
which always has an empty-string filterName.@wilkinsona had suggestions over here about different approaches to harmonizing this between framework and boot:
spring-projects/spring-boot#37835 (comment)
The text was updated successfully, but these errors were encountered: