We would like to skip the Swagger for unit tests altogether.
One way of doing this is with conditional beans as in :
@Profile("dev,qa,prod")
@Configuration
ref: https://github.com/springfox/springfox/issues/328
But we would like to take that decision not based on profiles but rather on the mere fact that whether we are in a test context or not. How could we achieve that?
Thank you.
I was able to accomplish that using @Profile({ "!test && swagger" }) as:
@Configuration
@Profile({ "!test && swagger" })
@EnableSwagger2
public class SwaggerConfig {
Hope it helps.