Micronaut

Micronaut (Gradle & Java) - Swagger Integration Views not accessible with security enabled

北战南征 提交于 2020-06-17 15:57:26
问题 Following the documentation over here - https://micronaut-projects.github.io/micronaut-openapi/latest/guide/index.html I configured my build.gradle to include compile time tasks for swagger yaml generation as follows- tasks.withType(JavaCompile){ options.fork = true options.forkOptions.jvmArgs << '-Dmicronaut.openapi.views.spec=rapidoc.enabled=true,swagger-ui.enabled=true,swagger-ui.theme=flattop' options.encoding = "UTF-8" options.compilerArgs.add('-parameters')} This is how my application

Swagger for Micronaut with maven

隐身守侯 提交于 2020-05-25 23:54:24
问题 I want to switch to the Micronaut framework from Spring Boot 2. And I am struggling with the Swagger settings. In Spring Boot 2 project I have the following dependencies: <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>2.6.1</version> </dependency> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger-ui</artifactId> <version>2.6.1</version> </dependency> and SwaggerConfig.class: @Configuration @EnableSwagger2 public class

Swagger for Micronaut with maven

家住魔仙堡 提交于 2020-05-25 23:53:30
问题 I want to switch to the Micronaut framework from Spring Boot 2. And I am struggling with the Swagger settings. In Spring Boot 2 project I have the following dependencies: <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>2.6.1</version> </dependency> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger-ui</artifactId> <version>2.6.1</version> </dependency> and SwaggerConfig.class: @Configuration @EnableSwagger2 public class

How can I test a micronaut Service with junit5?

三世轮回 提交于 2020-05-24 05:14:30
问题 I tried to run the mathService example presented under: https://micronaut-projects.github.io/micronaut-test/latest/guide/#junit5 which should explain testing a micronaut service with junit5. I added testAnnotationProcessor "io.micronaut:micronaut-inject-java" testCompile "io.micronaut.test:micronaut-test-junit5:1.1.3" testCompile "org.mockito:mockito-junit-jupiter:2.22.0" testRuntime "org.junit.jupiter:junit-jupiter-engine:5.1.0" to my dependencies. I coded MathService, MathServiceImpl in src

Multiple Datasource with Micronautor or Quarkus

匆匆过客 提交于 2020-05-16 05:54:31
问题 I want to migrate to Micronaut or Quarkus from Spring Boot, but in Spring boot there is one feature as AbstractRoutingDataSource, which in runtime change datasouce. Is there anything similar or any mechanism in micronaut or quarkus which gives opportunity to work with multiple datasources in runtime?? Spring-boot feature for reference https://medium.com/innomizetech/dynamic-multi-database-application-with-spring-boot-7c61a743e914 回答1: You can define multiple data sources in properties. And

Getting cognito user pool username from cognito identity pool identityId

十年热恋 提交于 2020-05-14 16:12:51
问题 I am using AWS Congito User Pools for account management with a Cognito Identity Pool that has this User Pool as the Identity Provider. I'm using this to control access to an API through API Gateway that sends requests to Lambda. My Lambda is implemented with Java 8 using Micronaut. All of this is working fine. In the Lambda, I'm getting the name from the Principal in the HttpRequest : protected String resolveUser( HttpRequest request ){ String ret = null; Optional<Principal> principal =

Getting cognito user pool username from cognito identity pool identityId

梦想与她 提交于 2020-05-14 16:12:43
问题 I am using AWS Congito User Pools for account management with a Cognito Identity Pool that has this User Pool as the Identity Provider. I'm using this to control access to an API through API Gateway that sends requests to Lambda. My Lambda is implemented with Java 8 using Micronaut. All of this is working fine. In the Lambda, I'm getting the name from the Principal in the HttpRequest : protected String resolveUser( HttpRequest request ){ String ret = null; Optional<Principal> principal =

How do I use the Grails environment settings in micronaut client @Header?

旧城冷巷雨未停 提交于 2020-04-18 03:21:24
问题 I have an environment-specific header property in my Grails application.yml , configured like so: environments: development: apiKey: 'foo' How do I use this setting in a @Header for the micronaut HTTP declarative client? I tried this: // property placeholder resolver seems to interprept 'apiKey' property as 'api-key' @Header(name = 'apikey', value = '${api-key}') but I got this error: io.micronaut.context.exceptions.ConfigurationException: Could not resolve placeholder ${api-key} at io

IDEA 正式版终于支持中文版和 JDK 直接下载了(太方便了)附介绍视频

北城余情 提交于 2020-04-13 15:13:05
【今日推荐】:为什么一到面试就懵逼!>>> IDEA 2020.1 经过了漫长的打磨终于发布正式版了,而这次的版本不止直接支持 Java 14,还带来了两个重量级的功能,官方中文版支持和 JDK 直接下载。 在之前的开发中,当我们需要下载 JDK 时,通常的步骤是这样的:首先去 Oracle 的官网,查到相关的版本下载地址,然后输入用户输入密码登录成功之后才能下载相应的 JDK,尤其是对于那些经常忘记密码的用户老说非常之不便,而这次 IDEA 更新之后,我们就可以一键下载 JDK 了,可谓非常之便利。 IDEA 2020.1 下载地址: https://www.jetbrains.com/idea/download/index.html JDK 直接下载 点击 File -> Project Structure -> SDKs 点击添加按钮,如下图所示: 或者使用 Ctrl+Alt+Shfit+S 快捷键快速打开面板,之后选择相关的 JDK 类型和版本进行下载即可,如下图所示: 这样就轻松的完成了 JDK 的下载了。 中文版预览 先来看下中文版汉化的效果吧,如下图所示: 可以看出大部分的菜单已经汉化的好了,还有少数没有汉化的菜单。 中文版设置 中文版的支持需要借助 JetBrains 官方提供的 Chinese (Simplified) Language Pack EAP 插件

How to call another rest api from my controller in Micronaut like in Spring-Boot RestTemplate?

主宰稳场 提交于 2020-02-07 05:10:30
问题 I have the following function from Spring Boot. I cannot do it with declarative client thus my uri domain changed after every call so i need a RestTemplate like in Spring Boot. How can i achieve the same in Micronaut? private static void getEmployees() { final String uri = "http://localhost:8080/springrestexample/employees.xml"; RestTemplate restTemplate = new RestTemplate(); String result = restTemplate.getForObject(uri, String.class); System.out.println(result); } 回答1: Something like this