Hello I recently updated my spring boot application and noticed new feature ( DirtiesContext.ClassMode.BEFORE_CLASS), that seems fit my needs, because I had the problem with reloading bean with method annotated @RabbitListener, for some reason Spring reloaded that bean, but old bean was using as rabbit listener. (See here)
My code:
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes ={ServerConfig.class,ServerThroughAMQPBrokerRabbitMQIntegrationTestConfig.class})
@Category({IntegrationTest.class})
@TestPropertySource("classpath:test.properties")
@DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS)
@TestExecutionListeners(listeners = {DirtiesContextBeforeModesTestExecutionListener.class, DirtiesContextTestExecutionListener.class})
public class ServerThroughAMQPBrokerRabbitMQIntegrationTest {
The issue that,after adding DirtiesContext.ClassMode.BEFORE_CLASS Spring stops loading beans from:
@SpringApplicationConfiguration(classes ={ServerConfig.class,ServerThroughAMQPBrokerRabbitMQIntegrationTestConfig.class})
So the questions:
How should I load spring context with DirtiesContext.ClassMode.BEFORE_CLASS ?