If you don't care about your in async mode, you can disable the @async configuration at all (run your test synchronously)
Create your async configuration class:
@Configuration
@EnableAsync
@ConditionalOnProperty(name = "async.enabled", havingValue = "true")
public class SpringAsyncConfig {
// Your configuration here
}
the annotation `@ConditionalOnProperty` here will create this bean if only the configuration value `async.enabled` is `true`
Then in the configuration file if you are going to run the integration test you can set the value to false
`async.enabled = false`
or if you are using Spring profiles you can always set the value to `true` in other profiles configuration files like `application.properties`, `application-dev` and set to `false` in `application-integration.properties`
Create your async configuration class:
@Configuration
@EnableAsync
@ConditionalOnProperty(name = "async.enabled", havingValue = "true")
public class SpringAsyncConfig {
// Your configuration here
}
the annotation `@ConditionalOnProperty` here will create this bean if only the configuration value `async.enabled` is `true`
Then in the configuration file if you are going to run the integration test you can set the value to false
`async.enabled = false`
or if you are using Spring profiles you can always set the value to `true` in other profiles configuration files like `application.properties`, `application-dev` and set to `false` in `application-integration.properties`