I encountered a similar error when doing this test scenario (which worked in spring boot 3.2.5 but not anymore in spring boot 3.5.2):
@SpringBootTest
@AutoConfigureMockMvc
class DefaultApiSecurityTest {
@Autowired private WebApplicationContext context;
private MockMvc mvc;
@BeforeEach
public void init() {
this.mvc = MockMvcBuilders.webAppContextSetup(context).apply(springSecurity()).build();
}
@Test
void accessToPublicRoutesAsAnonymousShouldBeGranted() throws Exception {
this.mvc.perform(MockMvcRequestBuilders.get("/v3/api-docs")).andExpect(status().isOk());
}
}
The solution was to follow https://stackoverflow.com/a/79322542/7059810, maybe the problem here was similar where the update ended up making the test scenario call a method which was now returning a 500 error.