Relative Content

Tag Archive for spring-bootspring-boot-test

Is it possible to conveniently override/remove an annotation from a @Component annotated class when running a SpringBootTest?

I have @Component named RequestInterceptor, which is also annotated with @RestartScope. Problem is, since I’m running integration tests with SpringBootTest and clearing contexts with @DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_EACH_TEST_METHOD – I’m still fiddling with it), whenever a test bumps into a bean method called from the RequestInterceptor, I get the following exception thrown: