Questions tagged [micronaut-rest]
85 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
7
votes
1 answer
Micronaut: How to print traceId and spanId in logs?
I've been using Spring Boot for a long time. I'm working on Micronaut now.
I'm used to using Sleuth to print trace and span IDs automatically on logs. What is the sleuth equivalent in Micronaut?
If there is no equivalent, how to print the trace and…

Anoop Hallimala
- 625
- 1
- 11
- 25
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
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
1 answer
How do I disable the http server in a micronaut application
I have a micronaut application that is supposed to run a SQS listener in one container and a regular HTTP server on the other. How do I achieve this via configuration? I can use the following app properties to enable/disable the…

I.M.MK.XLII
- 43
- 3
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…

Jeferson Leonardo
- 149
- 1
- 8
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
2
votes
1 answer
How to write a byte array to a cloud destination using Micronaut?
I'm converting a small Spring method to Micronaut. The purpose of this method is to write a byte array to a destination in the cloud. To identify the destination, a URI is passed as argument to the Spring method. This is the implementation using…

m-oliv
- 419
- 11
- 27
2
votes
1 answer
Micronaut doesn't return default HTTP error representation for Flux return types
I have simple Micronaut controller with 2 similar GET methods which return different reactive types.
@Controller
public class MyController {
@Get(uri = "/a", produces = MediaType.APPLICATION_JSON_STREAM)
public Flux getA() {
…

Sergey Prokofiev
- 1,815
- 1
- 12
- 21
2
votes
1 answer
Validate model from other module with micronaut gives "No bean introspection present."
When I try to send object in body of POST method to micronaut application I get:
model: Cannot validate com.example.Model. No bean introspection present. Please add @Introspected to the class and ensure Micronaut annotation processing is…

Daniel Stefanik
- 23
- 5
2
votes
2 answers
Micronaut-Core: How to create dynamic endpoints
Simple question. Is it possible to create endpoints without @Endpoint?
I want to create rather dynamic endpoints by a file and depending on the content to its context.
Thanks!
Update about my idea. I would to create something like a plugin system,…

Thraax.Session
- 63
- 10
2
votes
0 answers
Issue with GormEntity in Micronaut 3.0.3
I have a simple micronaut 3.0.3 application built with hibernate-gorm.
I get the following error when attempting to send a GET request like this http://localhost:8080/?commentId=1
Failed to convert argument [command] for value [null] due to:…

maun
- 134
- 1
- 1
- 13
2
votes
1 answer
Add a request ID to slf4j logging in Micronaut
Question
When a request comes into the server I would like to interrogate the headers and see if there is a specific header, if so I want to grab that headers value and add it to the SLF4Js MDC, if it doesn't exist I will generate my own (see code…

Jim M.
- 909
- 1
- 12
- 29
2
votes
1 answer
Required Body [file] not specified Micronaut Multipart upload
Trying to upload the file using declarative HTTP client as below
Http CLient
@Client("http://localhost:8080/product")
public interface IHttpClient {
@Post(consumes = MediaType.MULTIPART_FORM_DATA, produces = MediaType.MULTIPART_FORM_DATA)
…

San Jaisy
- 15,327
- 34
- 171
- 290