How does Ruoyi microservice swagger not display the interface document of a certain module?

In the Raoyi microservice project, if you do not want to expose the swagger interface document of a certain module, what should you do?

This article uses the ruoyi-gen module as an example.

 

 By default, you can see that the ruoyi-gen module is included here. What we need to do is to hide ruoyi-gen.

The final expected result is shown in the figure below. As you can see, the module ruoyi-gen is not included in the figure below. So what configuration should we modify specifically to achieve this effect?

 Solution:

It is not difficult to achieve this effect. First, the data of this list comes from the defined modules in ruoyi-gateway-dev.yml.

But to achieve this effect, we can't achieve this effect simply by modifying the nacos configuration file. 

We only have to modify the code in the SwaggerProvider.java class.

上界位用:ruoyi-gateway/src/main/java/com/ruoyi/gateway/config/SwaggerProvider.java

After the modification is completed, restart the gateway service to achieve the desired effect. 

 

Guess you like

Origin blog.csdn.net/qq_19309473/article/details/131269343