micronaut-client

How to map errorType using Micronaut client annotation

断了今生、忘了曾经 提交于 2021-01-29 13:02:22
问题 How to map errorType using Micronaut client annotation, In case of programatically we can provide body type and errorType objects in case of success and failure. Programmatically calling client: import io.micronaut.core.type.Argument; import io.micronaut.http.HttpRequest; import io.micronaut.http.HttpResponse; import io.micronaut.http.MediaType; import io.micronaut.http.client.DefaultHttpClient; import io.micronaut.http.client.exceptions.HttpClientResponseException; import io.micronaut.http

How to map errorType using Micronaut client annotation

一个人想着一个人 提交于 2021-01-29 12:18:45
问题 How to map errorType using Micronaut client annotation, In case of programatically we can provide body type and errorType objects in case of success and failure. Programmatically calling client: import io.micronaut.core.type.Argument; import io.micronaut.http.HttpRequest; import io.micronaut.http.HttpResponse; import io.micronaut.http.MediaType; import io.micronaut.http.client.DefaultHttpClient; import io.micronaut.http.client.exceptions.HttpClientResponseException; import io.micronaut.http

Global exception handling in micronaut Java

旧时模样 提交于 2021-01-27 19:22:38
问题 Looking for a better solution to handle the global exception in micronaut https://docs.micronaut.io/latest/guide/index.html#errorHandling Controller @Controller("/category") public class CategoryController { @Delete(uri = "/{id}") public Maybe<HttpResponse> delete(@NotBlank String id) { LOG.info(String.format("API --> Deleting the specified category")); return iCategoryManager.Count(id).flatMap(item -> { if (item > 0) { iCategoryManager.Delete(id).subscribe(); return Maybe.just(HttpResponse

Custom Security Rules not working Micronaut 2.2.1

杀马特。学长 韩版系。学妹 提交于 2021-01-05 08:59:46
问题 I am trying to implement the custom security rules with Micronaut 2.2.1, but it is not working. public @interface RequiredPermission { String resourceIdName(); String permission(); } Security Rules @Singleton public class AdminRequirement implements SecurityRule { @Override public SecurityRuleResult check(HttpRequest<?> request, @Nullable RouteMatch<?> routeMatch, @Nullable Map<String, Object> claims) { if (routeMatch instanceof MethodBasedRouteMatch) { MethodBasedRouteMatch

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