We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
After upgrading to 2.6.0 a @WebMvcTest controller test for an unauthenticated endpoint no longer works, because a 401 instead of a 200 is returned.
This looks similar to the @SpringBootTest issue #28759
Minimal repro:
@Order(1) @Configuration public class Security extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http.cors().and().antMatcher("/test/**").authorizeRequests() .antMatchers("/test").permitAll() .anyRequest().authenticated(); } } @Order(2) @Configuration public class BaseSecurity extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests() .anyRequest().authenticated(); } } @RestController public class Controller { @GetMapping("/test") public String test() { return "test"; } } @WebMvcTest(Controller.class) class ControllerTest { @Autowired private MockMvc mockMvc; @Test void test() throws Exception { mockMvc.perform(get("/test")).andExpect(status().isOk()); } }
The text was updated successfully, but these errors were encountered:
Thanks for the report. This is a duplicate of #28759 (@WebMvcTest uses @AutoConfigureMockMvc under the covers).
@WebMvcTest
@AutoConfigureMockMvc
Sorry, something went wrong.
No branches or pull requests
After upgrading to 2.6.0 a @WebMvcTest controller test for an unauthenticated endpoint no longer works, because a 401 instead of a 200 is returned.
This looks similar to the @SpringBootTest issue #28759
Minimal repro:
The text was updated successfully, but these errors were encountered: