Micronaut 微服务框架学习 - swaggerui

tech2024-04-18  86

启动类

@OpenAPIDefinition( info = @Info( title = "接口文档", version = "1.0", description = "接口文档", contact = @Contact(url = "http://cooker.github.com") ) ) public class Application { public static void main(String[] args) { Micronaut.build(args).run(Application.class); } }

application.yml

micronaut: router: static-resources: swagger: paths: classpath:META-INF/swagger mapping: /swagger/** swagger-ui: paths: classpath:META-INF/swagger/views/swagger-ui mapping: /swagger-ui/**

maven 添加配置

<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <fork>true</fork> <compilerArgs> <arg>-J-Dmicronaut.openapi.views.spec=rapidoc.enabled=true,swagger-ui.enabled=true,swagger-ui.theme=flattop</arg> </compilerArgs> </configuration> </plugin> </plugins> </build>

 

最新回复(0)