Questions tagged [micronaut-client]

104 questions
9
votes
4 answers

Global exception handling in micronaut Java

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…
San Jaisy
  • 15,327
  • 34
  • 171
  • 290
6
votes
1 answer

Micronaut HttpClients exchange body is always null

I have setup a simple test Controller: @Controller("/test") public class SampleController { @Get(value = "1", produces = MediaType.TEXT_PLAIN) public String helloWorld1() { return "Hello, World!"; } @Get(value = "2", produces =…
twobiers
  • 1,057
  • 1
  • 11
  • 27
5
votes
1 answer

Download File with Micronaut

My Client should receive a File from the Controller. The problem is that the Client is only receiving a string. How can I get the returned stream from the Controller? This is my Controller: @Get("/{databaseName}") MutableHttpResponse < Object >…
davebo92123
  • 95
  • 2
  • 9
5
votes
1 answer

Configuring database for integration tests in micronaut

I am trying to write an integration test in micronaut. I have a controller class: @Controller("/hello") public class HelloController { @Inject private HelloRepository helloRepository; @Get("/") public HttpResponse get() { …
Rajshree Rai
  • 533
  • 7
  • 14
4
votes
0 answers

Micronaut - Error encoding object to JSON: No serializer found for class io.netty.handler.codec.http.cookie.ServerCookieEncoder

Using Micronaut micronautVersion=3.4.3 getting an below exception for the below code @Validated public interface ICategoryOperation { @Get(value = "/{?searchCriteria*}") @Secured(SecurityRule.IS_ANONYMOUS) Flux get(CategoryFilterModel…
San Jaisy
  • 15,327
  • 34
  • 171
  • 290
4
votes
2 answers

Micronaut Read Timeout with HttpClient

I'm struggling to use the Micronaut HTTPClient for multiple calls to a third-party REST service without receiving a io.micronaut.http.client.exceptions.ReadTimeoutException To remove the third-party dependency, the problem can be reproduced using a…
PaulB
  • 105
  • 1
  • 8
4
votes
2 answers

How can I set param as not required in micronaut GET request?

I need to set a param as Not Required in my request. I tried: @Get(value = "/list/{username}") HttpResponse list(String username, @QueryValue(value = "actionCode") String actionCode) { ... } When I send the request…
4
votes
4 answers

Cloud Run app responds with "503 Service Unavailable" when using Micronaut HTTP Client

My application is based on Micronaut and GraalVM (java 11) and does a simple call to http://httpbin.org/get: @Controller("/api") class HelloWorld( @Client("http://httpbin.org") private val httpClient: RxHttpClient ) { private val logger…
VaclavDedik
  • 1,960
  • 4
  • 20
  • 27
3
votes
0 answers

Micronaut: Urlencoded Form List

I'm trying Micronaut framework and i'm struggling with Form Urlencoded list I've tried: public record Request( String someThing, @JsonFormat(shape = JsonFormat.Shape.ARRAY,pattern = "messages\\[.*?\\]") String[] messages, …
Paul
  • 63
  • 1
  • 6
3
votes
2 answers

Micronaut Declarative HttpClient Timeout

I have this declarative client: @Retryable(attempts = "5", multiplier = "1.2") @Client("\${client-url}") @Headers( Header(name = USER_AGENT, value = "Micronaut Http Client"), ) interface MyApiClient { @Get("/locations?location={location}") …
user1984190
  • 135
  • 2
  • 5
3
votes
0 answers

HttpResponse.notFound with error message in Micronaut

I have a simple Rest API where it checks the category id is present or not in the database as below @Controller("/sub-category") public class SubCategoryController implements ISubCategoryOperation { @Post public Maybe
San Jaisy
  • 15,327
  • 34
  • 171
  • 290
3
votes
1 answer

Include null and empty properties in JSON from Micronaut rest end point

Micronuat default configuration for JSON serialization is JsonInclude.Include.NON_EMPTY which doesn't include an empty or null value. However, I have a requirement to include the empty and null value, so what I did so far…
San Jaisy
  • 15,327
  • 34
  • 171
  • 290
3
votes
0 answers

Micronaut Swagger redirect not working with OAuth 2 with Authorization code + PKCE

I am using swagger open API 3 in the Micronaut application with Authorization + PKCE flow as below @SecurityScheme(name = "Open Id Connect", type = SecuritySchemeType.OAUTH2, scheme = "bearer", bearerFormat = "jwt", …
San Jaisy
  • 15,327
  • 34
  • 171
  • 290
3
votes
1 answer

Can Micronaut Circuit Breakers be skipped for some HTTP status codes?

Is there a way to configure the Micronaut Circuit Breaker so that it is not opened for specific HTTP status codes? If I for instance do a lookup on an item and that item is not found, then a server might return HTTP status 404. This might be a…
3
votes
2 answers

Micronaut declarative client with base url per environment

I'd like to be able to use Micronaut's declarative client to hit an a different endpoint based on whether I'm in a local development environment vs a production environment. I'm setting my client's base uri in application.dev.yml: myserviceclient: …
Jim Wharton
  • 1,375
  • 3
  • 18
  • 41
1
2 3 4 5 6 7