发表于: 2021-12-01 23:19:55
0 751
通过swagger2 来测试接口,入参和返回值
简单的文件上传
遇到的问题:无法加载或实例化TagLibraryValidator类的问题,加入jstl-impl 问题解决。写完代码git到码云以后 swagger 突然404 ,一直提示找不到,然后自己就去百度找解决方案,都没解决,然后自己去找日志看,
09:29:02,629DEBUGDispatcherServlet:869-DispatcherServlet with name 'springmvc' processing GET request for [/artistdemo/swagger-ui.html]
09:29:02,657DEBUGPropertySourcedRequestMappingHandlerMapping:310-Looking up handler method for path /swagger-ui.html
09:29:02,665DEBUGPropertySourcedRequestMappingHandlerMapping:108-looking up handler for path: /swagger-ui.html
09:29:02,670DEBUGPropertySourcedRequestMappingHandlerMapping:320-Did not find handler method for [/swagger-ui.html]
09:29:02,670DEBUGRequestMappingHandlerMapping:310-Looking up handler method for path /swagger-ui.html
09:29:02,684DEBUGRequestMappingHandlerMapping:317-Returning handler method [public java.lang.String com.artist.controller.loginController.loginPage(java.lang.String)]
09:29:02,685DEBUGDefaultListableBeanFactory:251-Returning cached instance of singleton bean 'loginController'
09:29:02,687DEBUGDispatcherServlet:955-Last-Modified value for [/artistdemo/swagger-ui.html] is: -1
09:29:02,748DEBUGDefaultListableBeanFactory:1671-Invoking afterPropertiesSet() on bean with name 'swagger-ui'
09:29:02,749DEBUGDispatcherServlet:1280-Rendering view [org.springframework.web.servlet.view.JstlView: name 'swagger-ui'; URL [/WEB-INF/jsp/swagger-ui.jsp]] in DispatcherServlet with name 'springmvc'
09:29:02,750DEBUGJstlView:433-Added model object 'login' of type [java.lang.String] to request in view with name 'swagger-ui'
09:29:02,763DEBUGJstlView:166-Forwarding to resource [/WEB-INF/jsp/swagger-ui.jsp] in InternalResourceView 'swagger-ui'
09:29:02,772DEBUGDispatcherServlet:1000-Successfully completed request
09:29:02,778DEBUGDefaultListableBeanFactory:251-Returning cached instance of singleton bean 'sqlSessionFactory'
通过仔细看日志发现,把swagger-ui 请求都方法请求到loginController 上去来。修改loginController 到login 方法,问题解决。
评论