7

I've been trying to access the generated Swagger-UI of a JHipster generated Spring app. I've tried to access through "/swagger-ui.html" as that worked out just fine with other projects, but not this time. I've also looked up the security configuration class and tried all URLs that reference swagger (like "/swagger-ui/index.html") but none of them work: It's response code 404.

I know that the configuration class gets run, because the console shows the "Started Swagger" message, but still no UI.

Any ideas? Any help will be much appreciated. Thanks.

Unai P. Mendizabal
  • 174
  • 1
  • 1
  • 6

6 Answers6

3

To access the Swagger docs on a JHipster app, you need to go login as an admin and click the "API" link in the admin navbar dropdown.

You can also access it directly at http://localhost:8080/#/docs

Jon Ruddell
  • 6,244
  • 1
  • 22
  • 40
2

Have you made sure that the swagger profile is active? Check your config at src/main/resources/config/application-dev.yml

spring:
    profiles:
        active: dev
        include: swagger

or

spring:
    profiles:
        active: dev, swagger
Tom Nijs
  • 3,835
  • 3
  • 22
  • 40
2

since you are using jhipster, you can find the swagger config @ class SwaggerAutoConfiguration in the jar : jhipster-framework

by default the url is : http://127.0.0.1:8761/swagger-ui/index.html enter image description here

Tiago Medici
  • 1,944
  • 22
  • 22
2

Add this to your build.gradle:

dependencies {
...
compile 'io.springfox:springfox-swagger-ui:2.9.2'

or (maven)

<dependency>
 <groupId>io.springfox</groupId>
 <artifactId>springfox-swagger-ui</artifactId>
 <version>2.9.2</version>
</dependency>

Then you'll be able to reach the UI at

http://localhost:8080/swagger-ui.html

user9869932
  • 6,571
  • 3
  • 55
  • 49
1

have a look under src/main/webapp/swagger-ui to see what resoures have been generated. Also be sure that you run all gulp build stepts, e.g swagger-ui which is included as a task in the build process for the prod environment.

duderoot
  • 977
  • 1
  • 8
  • 23
1

Just created a spring boot JHipster project with v6.10.5. Seems its different now: Login as admin with password admin. Then on the left of the "account" item at the top the "administration" item appears. Beneath click on "API" or just enter http://localhost:8080/admin/docs.