首页 > 解决方案 > 您需要在 Dropwizard 中提供 SwaggerBundleConfiguration 的实例

问题描述

我通过使用此模块https://github.com/smoketurner/dropwizard-swagger将 swagger 与 dropwizard 一起使用

我已按照所有相关步骤操作,当我运行应用程序时出现此错误

java.lang.IllegalStateException:需要提供 SwaggerBundleConfiguration 的实例

我在这里config.yml遇到了类似的问题。并在文件中添加了以下几行

swagger:
  resourcePackage: io.demo.backendservices.resources

但它仍然无法正常工作。请帮助

标签: javaswaggerdropwizard

解决方案


可能是因为您没有在 Configuration 类中创建 SwaggerBundleConfiguration 实例吗?我已经使用 swagger 和所有其他东西创建了 dropwizard 项目示例,也许你可以检查一下,看看它是否对你有帮助。该项目在这里:

https://github.com/rsatrio/dropwizard-modern-example


推荐阅读