Comments (7)
I have managed to have it worked. Here is what my configuration.
- servlet-context.xml
<beans:bean id="documentationController" class="com.mangofactory.swagger.springmvc.controller.DocumentationController"
p:apiVersion="1.0"
p:swaggerVersion="1.0"
p:basePath="http://localhost:8080/mysite" /> - After restart your app server, if no Swagger-UI installed, from the web browser:
http://localhost:8080/mysite/api-docs. You should get JSON back. - Download and install Swagger-UI. In the search box, use http://localhost:8080/mysite/api-docs and Explore.
Hope it helps.
from springfox.
Thank you for the help. Sadly I still don't get any JSON back. This is my bean in the servlet-context.xml:
<bean id="documentationController" class="com.mangofactory.swagger.springmvc.controller.DocumentationController"
p:apiVersion="1.0"
p:swaggerVersion="1.0"
p:basePath="http://localhost:8080/mysite" />
Yet still nothing.
from springfox.
During the server startup, did you see the following msg from the log:
INFO : org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/api-docs/**],methods=[GET],params=[],headers=[],consumes=[],produces=[application/json],custom=[]}" onto public com.mangofactory.swagger.ControllerDocumentation com.mangofactory.swagger.springmvc.controller.DocumentationController.getApiDocumentation(javax.servlet.http.HttpServletRequest)
My case is little bit different because I modified the source code, but you should see the similar output.
You said you did not get JSON back, did you get 404?
If you turn on debug on log4j.xml, you should see more info during startup
from springfox.
Thank you for your response. I appreciate your help a lot. I cannot find anywhere in my logs that maps to /apidocs , /api-docs or the like.
You are correct, when I go where they should be, I get a 404 and the server tells me there is "No mapping found for HTTP request with URI [/mtcservices/apidocs] in DispatcherServlet with name 'mvc-dispatcher'"
I will try the log4j and see if there is any additional data but I should be having JBoss logging pretty much everything already.
Thank you for the help, I may just have to try to get it working with a static .json file (not the best option) but if it works.
from springfox.
The new version doesn't create an /apidoc endpoint but instead something like:
/resource/{apiName}
so try /mtcservices/resources/YOUR_API_NAME.
This can be seen in the logs:
INFO : org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/resources],methods=[GET],params=[],headers=[],consumes=[],produces=[application/json],custom=[]}" onto public com.wordnik.swagger.core.Documentation com.mangofactory.swagger.springmvc.controller.DocumentationController.getResourceListing()
INFO : org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/resources/{apiName}],methods=[GET],params=[],headers=[],consumes=[],produces=[application/json],custom=[]}" onto public com.mangofactory.swagger.ControllerDocumentation com.mangofactory.swagger.springmvc.controller.DocumentationController.getApiDocumentation(java.lang.String)
from springfox.
Which new version? Maybe I missed something. I believe the base directory is still /api-docs:
@RequestMapping('/' + DocumentationController.CONTROLLER_ENDPOINT)
public class DocumentationController implements InitializingBean {
from springfox.
The documentation root should still be /api-docs (not ../resources)
from springfox.
Related Issues (20)
- Incompatible because this component declares a component compatible with Java 11 and the consumer needed a component compatible with Java 8
- Bump Swagger UI Dependency to latest
- springfox-swagger-ui/-boot-starter not found
- WebMvcRequestHandlerProvider should not use @Component HOT 1
- How to add common headers using spring fox 3
- swagger2+nginx reports 404 problem when accessing swagger
- When there are 20,000 controllers, the startup time exceeds two hours.
- Can we use springfox with springboot 3.1.4?? Or any version of springfox is compatible with springboot 3.1.4 HOT 2
- Any springfox version compatible with springboot 3???? HOT 3
- Swagger UI not Showing Map<String, Object> myField ?
- Description of ResponseHeader is blank
- The launch is just around the corner HOT 3
- Need similar way for Open API
- Unable to Access Swagger-UI After Implementing Spring Security Configuration HOT 2
- error and exception`documentationPluginsBootstrapper` when configuring it to my springboot project HOT 4
- Failed to convert value of type 'java.lang.String' to required type 'int'; For input string: "load_form"]
- Failed to start bean 'documentationPluginsBootstrapper' HOT 1
- Springfox 3.0 loading API interfaces is still quite slow
- The configuration information for SpringBoot and Swagger versions is as follows: Unable to start HOT 1
- How to distinguish interfaces with the same interface path
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from springfox.