I am trying to run a DAO test using
@RunWith(SpringRunner.class)
@DataJpaTest
I have my Application class.
@SpringBootApplication
@EnableAspectJAutoProxy
@EnableTransactionManagement
@EnableJpaRepositories(basePackages="com.eeposit.lattice.dao")
@EnableAsync
@EnableScheduling
@ComponentScan({"com.eeposit.lattice"})
@ImportResource("classpath:config/transactional.xml")
@EnableJpaAuditing
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
@Bean
public Executor getAsyncExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(7);
executor.setMaxPoolSize(42);
executor.setQueueCapacity(11);
executor.initialize();
return executor;
}
}
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.basePackage("com.eeposit.lattice.controller"))
.paths(PathSelectors.any())
.build()
.apiInfo(apiInfo());
}
private ApiInfo apiInfo() {
return new ApiInfo(
"Lattice API",
"Description of APIs",
"v1",
"Terms of Service",
new Contact("EeposIT Services", "", ""),
"License of API", "API license URL", Collections.emptyList());
}
}
When I try to run the test it shows error with SpringFox Swagger bean error. By searching, I found many suggestions to separate the Swagger configuration class from application(which I already had). But didn't solve the issue.
How can this error be solved ? I am using Spring Boot 2.0.2 and Swagger 2.8.0.
Aucun commentaire:
Enregistrer un commentaire