Adding Swagger to a REST service causes 404 errors

I needed to create a small Spring Boot application to provide a REST service.

I have it working as expected and then I added the Swagger to document the service. I followed a couple of examples in the web, but mostly I have followed the same pattern as this.

My problem is not the swagger urls that aren't working, they are, but my service stopped working.

This only happens when I add the @EnableSwagger2 to my configuration class. If I comment this line, the service is back in business.

I don't really know what I'm doing wrong.

1 answer

  • answered 2018-07-15 15:56 Hugo Dias

    I found my error. I forgot to add a ComponentScan to search my service in a different package. Something that was working without swagger