0

I have an issue integrating swagger-ui (swagger2) into my spring-boot application. It seems as though the default location for swagger-ui being on the root is conflicting with an endpoint.

For example, my base path is foobar (full url: locahost:8080/foobar/). One of my endpoints has a path variable that can be any number (making the endpoint url: localhost:8080/foobar/{number} or localhost:8080/foobar/123 as an example). This seems to conflict with swagger-ui.html, as when I then try to hit locahost:8080/foobar/swagger-ui.html, spring complains, thinking 'swagger-ui.html' is the path variable for that endpoint.

I was curious if there was a way to define an explicit mapping for swagger-ui, so that spring won't think that I'm just inputting a path variable to the other endpoint? I ideally don't want to modify the foobar/{number} path at all, and would like to either make an explicit mapping for swagger-ui, or change the path for swagger-ui itself. Any help is appreciated. Thanks!

Su_toL
  • 167
  • 2
  • 15
  • I think you you try `localhost:8080/swagger-ui.html` – blurfus Oct 23 '17 at 16:22
  • that is what it is currently set as... I'm looking to change it from that. – Su_toL Oct 23 '17 at 17:16
  • have a look at other suggestions made by https://stackoverflow.com/a/43699861/600486 – blurfus Oct 23 '17 at 17:26
  • To clarify: I can access swagger-ui with the url: localhost:8080/foobar/swagger-ui.html. I'm looking to define the explicit mapping for it so that it does not conflict with the new route, or change the location of swagger-ui so that it can exist on a new path like locahost:8080/foobar/swagger/swagger-ui.html – Su_toL Oct 24 '17 at 13:20

0 Answers0