Questions tagged [micronaut]

Micronaut is a JVM framework for building web applications with a strong focus on microservice applications.

Micronaut is an open source framework for the JVM designed for rapid development of web applications, particularly microservices. Micronaut supports building applications in Java, Groovy, and Kotlin.

1684 questions
5
votes
1 answer

Building Micronaut docker image in GitlabRunner with docker executor

TLDR: How can one build docker images with Gradle inside a Openjdk container? The problem We are building a Micronaut based suite of microservices in a multi-module Gradle project using GitLab pipelines. Currently our pipeline builds docker images…
Roland Tepp
  • 8,301
  • 11
  • 55
  • 73
5
votes
3 answers

Micronaut Kafka: Health check fails with "Cluster authorization failed"

I am trying to consume messages from a Kafka cluster external to my organization, which requires authentication. I am receiving messages, so presumably things are partly correct, but I'm getting this error message in the logs: 08:54:50.840…
Imre Kerr
  • 2,388
  • 14
  • 34
5
votes
1 answer

Use @ConfigurationProperties in Annotation parameter/ argument? (must be compile-time constant)

I´m trying to use a Configuration in an Annotation, like so: @ConfigurationProperties("scheduling") interface SchedulingConfiguration { val initialDelay: String val fixedDelay: String } @Singleton class Worker( private val…
stk
  • 6,311
  • 11
  • 42
  • 58
5
votes
1 answer

Micronaut nested Json input Validation

How do you validate Json Body { "name": "good student", "marks": { "math": "122", "english": "12" } } This Doesn't works, It accepts with or without marks in JSON body, even if @NotNull etc are added to marks in Student…
Ayush Ghosh
  • 487
  • 2
  • 10
5
votes
0 answers

Expose Spring Beans to a Micronaut Application

Is it possible to Expose Spring Beans to a Micronaut Application and use them with @Autowired or @Inject them into the Micronaut Application with the Spring Beans project added as Maven Dependency to the Micronaut Project via Maven pom.xml? The…
shravind
  • 51
  • 2
5
votes
1 answer

Micronaut: How do I map all the properties values in HashMap?

I have been learning micronaut for sake of learning and for a small scale project and I have been stuck on a problem. So assume I have this data in application.yml file output: -file: name: PDF size: 50000 -file: …
5
votes
2 answers

How to write integration tests for Micronaut APIs?

Let's say I have an API to GET list of users. Controller -> Service -> Repository. Coming from Spring background, where for writing test for this API, in test, we could declare the repository with @Autowired and insert the user data using this…
AmitB10
  • 425
  • 6
  • 16
5
votes
1 answer

Serving static resources with Micronaut, with directory hierarchy

Given the following configuration in application.yml, I would expect to be able to serve files from both of the following paths: http://localhost/static/image.png (from /root/static/image.png) http://localhost/static/folder/image.png (from…
psyklopz
  • 2,283
  • 4
  • 24
  • 29
5
votes
2 answers

error: invalid source release 14 with --enable-preview

I am using Micronaut2.0.2 application with IntelliJ IDE 2020.2.2. I have enabled the preview feature in from the language level in IDE And in the Gradle file I have the below option java { sourceCompatibility = JavaVersion.toVersion('14') …
San Jaisy
  • 15,327
  • 34
  • 171
  • 290
5
votes
1 answer

Use LocalDateTime in Micronaut Kotlin Data Class DTO

I got this DTO: @Introspected data class SomeDTO( val someLocalDateTime: LocalDateTime, val someString: String ) And I want to use it in a Micronaut Controller like this: @Post @Status(HttpStatus.CREATED) fun somePostCall( …
user7715234
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
3 answers

Micronaut ReadTimeoutException

I have a Grails 4 application providing a REST API. One of the endpoints sometimes fail with the following exception: io.micronaut.http.client.exceptions.ReadTimeoutException: Read Timeout at…
Heschoon
  • 2,915
  • 9
  • 26
  • 55
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
5
votes
2 answers

Micronaut decrypting property value

I am trying to move from spring to micronaut. Some of the property values are encrypted, and we are currently using the spring-boot-jasypt, described below, to help decrypt the property values when injecting into the spring application. However, I…
fzhong
  • 51
  • 1
5
votes
3 answers

When is it appropriate to use @Singleton and @Prototype in Micronauts?

I read so many bad things about singleton pattern (What is so bad about singletons?), however, @Singleton is used everywhere in this Micronaut doc to illustrate inversion of control https://docs.micronaut.io/1.3.0.M2/guide/index.html#ioc When is it…
user12300055
  • 53
  • 1
  • 3