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
6
votes
2 answers

Micronaut 3: How to use PubSubEmulatorContainer

Update: Link to repo is moved to answer because repo is now updated with code from answer below. Problem description Current code is working, but it is using gcloud beta emulators pubsub from google/cloud-sdk for integration tests. Integration…
Roar S.
  • 8,103
  • 1
  • 15
  • 37
6
votes
1 answer

Micronaut Cannot Build Native Image Graalvm

I'm trying out the Micronaut Application as a Graalvm native image found here. But when I'm running the ./gradlew buildNativeLambda I'm having these exception: Error: Image build request failed with exit status…
berty
  • 160
  • 9
6
votes
0 answers

Testcontainers: FileNotFoundException: .testcontainers.properties

I am getting issues with running integration tests (using JUnit5) of my micronaut app on my Windows 10 Pro machine. My tests depend on two containers, that I defined using Testcontainers java library: RabbitMQ and MS SQL server. The Docker version…
Hutsul
  • 1,535
  • 4
  • 31
  • 51
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
6
votes
1 answer

No such property: count for class: com.github.jengelman.gradle.plugins.shadow.transformers.ServiceFileTransformer

Creating a new application with the latest version of Micronaut using Intellj throws an exception during the build process. * Exception is: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':shadowJar'. at…
San Jaisy
  • 15,327
  • 34
  • 171
  • 290
6
votes
1 answer

How to use variables from .env in Micronaut application.yml?

I am very new to Micronaut and I just want to ask because I couldnt get any answers from the offical docs I have a .env file on the root of my folder. Here's my .env PORT=8081 I tried to access the PORT variable on my application.yml but it is not…
6
votes
2 answers

How to specify if a header param is mandatory or optional in micronaut

I am passing two headers in controller as below @Header("x-correlationId") String correlationId, @Header(name = "x-consumedBy") String consumedBy where x-correlationId is mandatory and x-consumedBy is optional. I am not able to specify this. In…
Amaresh
  • 61
  • 2
6
votes
1 answer

How to load external application.yml into the app developed with Micronaut Picocli?

Java: 11.0.7 Micronaut: 2.1.2 Micronaut profile: cli-app I have an application developed with micronaut framework in cli-app profile. My application uses Hibernate and GORM packages, so there are relevant configurations in application.yml In the…
wureka
  • 731
  • 1
  • 11
  • 26
6
votes
1 answer

Get bean by name in Micronaut

I have an interface that looks like. interface Task { void run(String param); } And I have many implementations annotated with @Named("same_name") I want to get an implementation similar to Spring: @Inject ApplicationContext appContext void…
Henrique Luiz
  • 191
  • 1
  • 12
6
votes
5 answers

Micronaut and JUnit rollback

I have some tests written for a micronaut micro service. I would want that after my tests are done all the changes in the DB are reverted (rollback). Firstly I have written a simple example which seems to work. Changes are reverted. But when I run a…
Jacob
  • 3,580
  • 22
  • 82
  • 146
6
votes
1 answer

Micronaut Data DTO projection with properties from joined entities

I use Micronaut Data with JPA and have two entities. The first one is Recipe: @Entity public class Recipe { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; private String name; @ManyToOne private…
cgrim
  • 4,890
  • 1
  • 23
  • 42
6
votes
5 answers

ConstraintViolationException handler isn't executed in Micronaut

I have a ConstraintViolationException handler class that looks like this: @Produces @Singleton @Requires(classes = {ConstraintViolationException.class, ExceptionHandler.class}) public class ConstraintsViolationsExceptionHandler implements…
Shankha057
  • 1,296
  • 1
  • 20
  • 38
6
votes
4 answers

How to Set Micronaut Context Path

How does one go about setting a context path for a micronaut microservice? I want to do something similar to what is available in the Spring Framework where you can set the 'server.servlet.contextPath' property. I haven't been able to find…
Clay Kirk
  • 61
  • 1
  • 3
5
votes
2 answers

'Batch update returned unexpected row count from update' - after update to Micronaut 3.1+

I'm attempting to upgrade to Micronaut 3.2, but starting from 3.1 some write operations on the db started failing. I have created a sample project to showcase this: https://github.com/dpozinen/optimistic-lock furthermore I have created an issue at…
dpozinen
  • 131
  • 7
5
votes
3 answers

Gradle upgrade 7.2 > 7.3 breaks with "The value for this property is final and cannot be changed any further" (with Micronaut plugin?)

I'm using Micronaut 3.1.3 together with Gradle 7.2 to build my project. After switching to Gradle 7.3, built breaks emitting some context-free error message: $ ./gradlew clean build Executed by Gradle 7.3 - using Java 11.0.13 - using Kotlin 1.5.31 -…
Christian
  • 293
  • 2
  • 14