Avoid Controllers initialization when testing spring boot HandlerInterceptor
问题 I'm trying to find the right configuration for testing HandlerInterceptor of a Spring-boot application, with @MockBean dependencies, but without initializing the whole Bean pool, because some Controllers have @PostConstruct calls that can't be mocked (knowing that @Before call comes after @PostContruct Controller call). For now I have come to this syntax : @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest(classes = Application.class) public class MyHandlerInterceptorTest { @Autowired