swagger: production: false basic: enable: true username: admin password: taihaolian@admin和鉴权代码 http.authorizeRequests() .antMatchers("/miniapp/login", "/user/login").permitAll() .antMatchers("/swagger-ui.html", "/swagger-resources/", "/v2/api-docs", "/webjars/").permitAll() .anyRequest().authenticated() .and() .formLogin().loginPage("/login").defaultSuccessUrl("/dashboard").permitAll() .and() .logout().logoutUrl("/logout").permitAll();,报错would dispatch back to the current handler URL [/error] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.) at org.springframework.web.servlet.view.InternalResourceView.prepareForRendering(InternalResourceView.java:210) at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:148) at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:317) at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1373) at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1118) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1057) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898),原因是什么?如何解决?访问swagger2的地址是多少?
时间: 2024-04-26 15:24:50 浏览: 152
这个错误是由于缺少视图解析器导致的。你需要在Spring MVC配置文件中添加视图解析器,Spring Boot中默认已经配置好了,但如果你使用的是传统的Spring MVC,则需要手动添加。
要访问Swagger2,你需要在浏览器中输入"http://[host]:[port]/[context-path]/swagger-ui.html",其中[host]是你的服务器地址,[port]是你的应用程序端口,[context-path]是你的应用程序上下文路径。
阅读全文