I have a springboot application and I want to convert to Micronaut, but how I config the openapi via code, like in this article
Code snippet:
@Configuration
public class OpenApiConfig {
@Bean
public OpenAPI customOpenAPI(OpenApiProperties properties) {
var openApi = new OpenAPI()
.info(getInfo(properties));
return openApi;
}
private Info getInfo(OpenApiProperties properties) {
return new Info()
.title(properties.getProjectTitle())
.description(properties.getProjectDescription())
.version(properties.getProjectVersion())
.license(getLicense());
}
private License getLicense() {
return new License()
.name("Unlicense")
.url("https://unlicense.org/");
}
}
Currently, I have already done the ff:
- Replace @Bean as @Singleton, Failed
- Adding @Factory to the class, Failed
** The application compiles, but on run time the OpenApi definition is not set on the swagger ui