It's my first post so feel free to leave some feedback or if i do something wrong :)
I am using spring-boot and resteasy :
<!-- Spring Boot -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.1.0.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.paypal.springboot</groupId>
<artifactId>resteasy-spring-boot-starter</artifactId>
<version>2.3.4-RELEASE</version>
</dependency>
I am trying to use Swagger to have a view of my endpoints, so I added this dependency :
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
This dependencies are loaded to my repo, everything looks good.
I added this class to make the easiest config class :
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build();
}
}
When i Launch the app in the debug mod I enter in this previous Bean. Evrything looks fine.
When I launch the Spring app :
@SpringBootApplication
@EnableAutoConfiguration(exclude={MongoAutoConfiguration.class,RabbitAutoConfiguration.class})
public class SituationServicesApplication implements CommandLineRunner {
public static void main(String[] args) {
SpringApplication.run(SituationServicesApplication.class, args);
}
@Override
public void run(String... args) throws Exception {
}
}
Everything looks fine :
2019-07-06 15:43:27.222 INFO 6336 --- [ main] pertySourcedRequestMappingHandlerMapping : Mapped URL path [v2/api-docs] onto method [public org.springframework.http.ResponseEntity<springfox.documentation.spring.web.json.Json> springfox.documentation.swagger2.web.Swagger2Controller.getDocumentation(java.lang.String,javax.servlet.http.HttpServletRequest)]
But when I try to reach the swagger-ui.html :
http://localhost:8092/test/v2/api-docs
or
http://localhost:8092/test/swagger-ui.html
I've got a 404 error :
"RESTEASY003210: Could not find resource for full path: http://localhost:8092/test/v2/api-docs".
I tried to modify the default URL by adding a property : springfox.documentation.swagger.v2.path=v2/api-docs-test
It stills 404.
I tried from scratch with a new empty project and it worked just fine. Something is wrong with my project I guess.
I am sure of the URL used.
Do you know how I can debug this issue? Can I see some created source from Swagger? If I can put some log on it to know where the issue comes from?
/test
path defined? – Corncrib@Component @ApplicationPath("/test/") public class SituationServicesJaxrsApplication extends ServiceApplication { }
– Jilolo.apis(RequestHandlerSelectors.any()) .paths(PathSelectors.any())
– Jilolo