-
Notifications
You must be signed in to change notification settings - Fork 40.2k
New issue
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
Enable AopAutoConfiguration by default for slice tests #33415
Comments
Can you please share a minimal sample that reproduces the problem? |
https://github.com/raddatzk/spring-boot-33415 The |
Thanks for the sample. When you're using When you're using @WebMvcTest(PeopleController.class)
@Import(SecurityConfig.class)
@ImportAutoConfiguration(AopAutoConfiguration.class)
public class PeopleControllerTest { I'd like to discuss the need for this with the rest of the team. Ideally, it wouldn't be needed but I am not sure that we should include |
I've recently encountered this issue, and found this after some search. It will be nice if this is being mentioned in the docs under |
When looking at this, we may need to revisit |
Affected Version: 2.7.5
I created a
@WebMvcTest
for a controller that implements a generated interface from an openapi spec.When one of the implemented handlers for example is annotated with
@PreAuthorized
, in case of a@WebMvcTest
spring will create a JdkProxy, in the case when starting this application regularly it will create a cglib proxy.Unfortunately spring will not detect any handlers in the case of a
@WebMvcTest
, as it can't find any annotations on the JdkProxy (RequestMappingHandlerMapping:isHandler(Class<?>)
) and the test will fail with a 404.I would expect that both cases will behave similar
The text was updated successfully, but these errors were encountered: