Swagger-UI does not show my controllers from different modules?

Viewed 1334

I'm using swagger with Spring Boot and the UI does not shows the controllers. My project looks like: I have a few gradle modules in root project. There are two of them for REST:

  • documentation (in this module I have package *.documentation and there I have a few interfaces with swagger annotations)
  • rest (in this module I have package *.controller and there each controller implements documentation interface from module documentation)

When I'm trying to run swagger-ui there is no resources on the UI. BUT! when I move my controllers into documentation module then everything works fine or when I move interfaces with swagger annotations to rest module. Problem is only when I use two modules, one for swagger annotations and one to implement those interfaces.

What should I do to make it works with two modules? I tried also ComponentScan annotation in my SwaggerConfig class(this class is also in documentation module) but it does not works too.

My project structure:

|-- Project
|   |-- app
|       |-- src/main/java
|          |-- mypackage
|             |-- App.java
|   |-- documentation
|       |-- src/main/java
|          |-- mypackage
|             |-- config
|                |-- SwaggerConfig.java
|             |-- documentation
|                |-- ProductSwaggerInterface.java
|   |-- rest
|       |-- src/main/java
|          |-- mypackage
|             |-- controller
|                |-- ProductController.java

In 'app' module I just run the SpringBoot app, in 'documentation' module I have interfaces with swagger annotations and in module 'rest' I implementing those interfaces in my controller.

0 Answers
Related