我正在运行grails 3.2.1,并想为我的REST端点创建Swagger文档。我通过添加以下内容将SwaggyDoc插件添加到build.gradle脚本的依赖项中:
compile "org.grails.plugins:swaggydoc-grails3:0.28.0"
并通过
https://rahulsom.github.io/swaggydoc/
对其进行配置。在IntelliJ中,我看到Swaggydoc依赖性已添加到我的库列表中。
通过grails run-app命令启动我的Grails应用程序并通过输入
http://localhost:8080/api/
打开我的应用程序后,我得到了swagger-ui index.html,但是在控制台日志中发现错误(如图所示)。console log errors
而这在grails中是异常(exception)。
ERROR org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[grailsDispatcherServlet] - Servlet.service() for servlet [grailsDispatcherServlet] in context with path [] threw exception
org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object '[Digest Input Stream] MD5 Message Digest from SUN
最佳答案
回答
当我们在intellij中创建grails应用程序时,我们将在application.yaml
文件中获得以下依赖关系。
runtime "com.bertramlabs.plugins:asset-pipeline-grails:2.11.6"
我们需要将其替换为以下内容:
runtime "org.grails.plugins:asset-pipeline"
该错误将得到解决。
关于grails - Swaggydoc插件grails 3.2.1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40891543/