MockServerWebExchange
does not have an ApplicationContext
and the constructor that accepts it in the base class isn't visible, so the only workaround is to create your own DefaultServerWebExchange
and override getApplicationContext()
.
Spring Security requires the ApplicationContext
, so they apparently have this workaround in their test code, but it would be useful to share it.