I have a Spring Boot application which use swagger-ui to expose it's apis. Now, till I was using springfox-swagger-ui version 2.6.1 my code was working properly. But when I updated the version to 2.7.0 it throws an error that ApiInfo method is deprecated. Can anyone tell me an alternative which will modify the existing code as less as possible and successfully run the application with the Info still there in the Swagger UI as description. I'm giving the existing code of swagger config here...
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Bean
public Docket productApi() {
return new Docket(DocumentationType.SWAGGER_2)
.useDefaultResponseMessages(false)
.select()
.apis(RequestHandlerSelectors.basePackage("com.xyz.abc"))
.paths(regex("/api.*"))
.build()
.apiInfo(apiInfo());
}
private ApiInfo apiInfo() {
return new ApiInfo(
"My-Project Api",
"Api for My Project",
"V1",
"NA terms of service url",
new Contact("Team Name", "www.somexyzteamcontact.com, "NA"),
"A license given",
"NA");
}
}
And gradle dependency for swagger which I used in My Project:
compile group: 'io.springfox', name: 'springfox-swagger2', version: '2.7.0'
compile group: 'io.springfox', name: 'springfox-swagger-ui', version: '2.7.0'