spring - Swagger endpoint not accessible -
i have spring mvc project uses gradle build project.
i used steps described here in project.
the build.gradle file has following entry swagger:
compile (libraries.swagger){ exclude group:'org.slf4j', module:'slf4j-log4j12' exclude group:'org.slf4j', module:'slf4j-api' exclude group:'junit', module:'junit' }
the configuration swagger done in project build.gradle below:
swagger: "com.knappsack:swagger4spring-web:0.3.3"
my controller documetation end point is:
import com.knappsack.swagger4springweb.controller.apidocumentationcontroller; import com.wordnik.swagger.model.apiinfo; import org.springframework.stereotype.controller; import org.springframework.web.bind.annotation.requestmapping; import org.springframework.web.bind.annotation.requestmethod; /** * example of how might extend apidocumentationcontroller in order set * own requestmapping (instead of default "/api") among other possibilities. going route, * not have define controller in servlet context. */ @controller @requestmapping(value = "/documentation") public class swaggerdocumentationcontroller extends apidocumentationcontroller { public swaggerdocumentationcontroller() { setbasecontrollerpackage("com.controller"); setbasemodelpackage("com.domain"); setapiversion("v1"); apiinfo apiinfo = new apiinfo("swagger", "this basic web app demonstrating swagger", "http://localhost:9999/terms", "http://localhost:9999/contact", "mit", "http://opensource.org/licenses/mit"); setapiinfo(apiinfo); } @requestmapping(value = "/", method = requestmethod.get) public string documentation() { return "documentation"; } }
and try access endpoints documentation as: http://localhost:9999/myapp/documentation/test
test
mapping mentioned inside controller below:
@api(value = "test", description = "a test controller see if services , running.") @requestmapping(value = {"/test"}, method = {requestmethod.get})
i 404 not found error while accessing documentation url above. missing something?
please let me know if more information required.
please !!
i have user swagger-springmvc , working fine. can try following url https://github.com/martypitt/swagger-springmvc
Comments
Post a Comment