-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
Milestone
Description
I think this might be more of a setup problem however the api-docs endpoint offers only an empty map and the endpoints for the documentation result in a 404.
The logs for my app show that the controllers are being scanned.
My configuration class:
package com.myorg.enterprise.docs;
import com.google.common.base.Predicate;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
* A Configuration file that allows the generation of Swagger
*/
@Configuration
@EnableWebMvc
@EnableSwagger2
public class MyOrgSwaggerConfig {
/**
* Every SwaggerSpringMvcPlugin bean is picked up by the swagger-mvc framework - allowing for multiple
* swagger groups i.e. same code base multiple swagger resource listings.
*
* @return SwaggerSpringMvcPlugin
*/
@Bean
public Docket customImplementation() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(getApiInfo())
.select()
.paths(paths())
.build()
.pathMapping("/");
}
private Predicate<String> paths() {
return PathSelectors.any();
}
/**
* A method that returns the API Info
* @return ApiInfo The Information including description
*/
public ApiInfo getApiInfo() {
return new ApiInfo(
"My REST API",
"This REST API allows the user to manage domain objects",
"1e",
"",
"support@mysite.com",
null,
null
);
}
}
The versions I'm using are:
<!-- Swagger -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-spring-web</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-common</artifactId>
<version>2.1.1</version>
</dependency>
<!-- End of Swagger -->
The application is running as ROOT context so there shouldn't be any problems with
My logs contain:
Created resource listing Path: /default/my-controller
However this is not accessible on http://localhost:8080/v2/api-docs/default/my-controller as expected.
Accessing http://localhost:8080/v2/api-docs returns:
{}
Please note I have had this working using the old com.mangofactory version and followed the migration documentation
Finally the swagger-ui.html is trying to access undefined:
http://localhost:8080undefined/
Any help or advice would be gratefully received
Reactions are currently unavailable