Reputation: 174
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.
Upvotes: 7
Views: 14357
Reputation: 191
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.
Upvotes: 1
Reputation: 7337
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
Upvotes: 2
Reputation: 2194
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
Upvotes: 2
Reputation: 3950
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
Upvotes: 2
Reputation: 6352
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
Upvotes: 3
Reputation: 987
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.
Upvotes: 1