Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
  • Sep 01 17:58
    @graemerocher banned @gomezcalvin20_gitlab
  • Apr 28 15:29
    @graemerocher banned @andrew903:matrix.org
  • Apr 12 01:32
    @jameskleeh banned @1948_your_tlv_homo_1488:swirl.funny.cl
  • Aug 17 2021 05:28
    @jameskleeh banned @zxvdgs:jonasled.de
  • Jan 07 2021 17:44
    @jameskleeh banned @GrantEllison15_twitter
  • Jan 06 2021 01:27
    @jameskleeh banned @brittapop_twitter
  • Jan 06 2021 01:19
    @jameskleeh banned @BeApi_io_twitter
  • Jan 04 2021 18:47
    @jameskleeh banned @orubel
  • Jan 04 2021 18:46
    @jameskleeh banned @orubel
  • Jan 04 2021 18:41
    @jameskleeh banned @orubel
  • Jan 04 2021 18:39
    @jameskleeh banned @orubel
  • Jan 04 2021 18:32
    @jameskleeh banned @orubel
  • Jan 04 2021 18:31
    @jameskleeh banned @BeApi_io_twitter
  • Jan 04 2021 18:30
    @jameskleeh banned @BeApi_io_twitter
  • Jan 04 2021 18:28
    @jameskleeh banned @orubel
  • Jan 04 2021 18:23
    @jameskleeh banned @BeApi_io_twitter
  • Jan 04 2021 18:20
    @jameskleeh banned @orubel
  • Jan 04 2021 18:10
    @jameskleeh banned @BeApi_io_twitter
  • Apr 03 2020 13:09
    @jameskleeh banned @orubel
  • Mar 30 2020 18:40
    @graemerocher banned @BeApi_io_twitter
Luís Duarte

Hey everyone,

has anyone ever had this issue:

java: cannot find symbol
  symbol:   method onConstructor_()
  location: @interface lombok.RequiredArgsConstructor
1 reply
@RequiredArgsConstructor(onConstructor_ = @Inject)
public class SomeClass {
  private final SomeDependency dependency;
Sam Gammon
hello friends
i have a quick question about the docker integration with Gradle
what are the tasks i should invoke to make the Dockerfile buildable via regular docker build?
Sam Gammon
if i do optimizedDockerfileNative, and optimizedBuildNativeLayersTask, it doesn't have the JARs ready to build -- otherwise it seems complete
Ivan Knapp
hi everyone, i plug in caffeine cache to my micronaut project, i set expire-after-write: PT5S and get data with schedule in 5sec, too
first call invocate real method, but second and third, etc invocations, get cached data,
i expect that cache will invalidate itself,
What i do wrong? please help
1 reply
If using both @Secured on controllers and a intercept-url-map - which one takes precedence?
I'm trying to serve some static resources with micronaut.router.static-resources. Running the app locally works fine - I can load the static files from the browser. When deployed to my AWS Lambda, I keep getting a 404. Is there some other configuration I'm missing?
I could be reading this wrong but I don't see how the StaticResourceResolver in https://github.com/micronaut-projects/micronaut-aws/blob/master/function-aws-api-proxy/src/main/java/io/micronaut/function/aws/proxy/MicronautLambdaContainerHandler.java is ever used. It's a private field and isn't exposed via any methods. Bug?
It appears that there's already been an issue raised for it - micronaut-projects/micronaut-aws#1361
It looks like the code for resolving static resources was removed. Not sure why. Added a comment to the PR.
Hi all, I'm relatively new to Micronaut and I try to integrate NATS. When I specify cluster in @NatsListener I get this error: Error starting Micronaut server: No bean of type [io.nats.client.Connection] exists for the given qualifier: @Named('abcd'). Can anyone help me to identify the issue? I'm grateful for any help! Thanks
2 replies
Marcos F. Lobo
Hello team! quick question. The Netty parameters to tune the number of threads to use https://docs.micronaut.io/latest/guide/#threadPools. Do they apply for gRPC server as well?
Daniel Nord

Hi, Im trying to use coroutines in Micronaut and struggle a bit with a endpoint returning Flow. Its just returning the first element in the flow and not the rest,

    override suspend fun changeEventUpdates() =
        flow<ChangeEvent> {

and curl -v -H "Accept: application/x-json-stream" http://localhost:8080/changes only prints

< HTTP/1.1 200 OK
< date: Sun, 20 Nov 2022 10:39:17 GMT
< Content-Type: application/x-json-stream
< content-length: 43
< connection: keep-alive
  "payload" : "event1",
  "version" : 1
* Connection #0 to host localhost left intact

Shouldnt that have streamed all of the values from the flow?

2 replies
Logan Kulinski
Matthew Planchant

I'm trying to use Client Credentials flow with my app to authenticate (https://micronaut-projects.github.io/micronaut-security/latest/guide/#clientecredentialshttpclient)

I'm getting the following error:

- Bean [Definition: io.micronaut.security.oauth2.client.clientcredentials.propagation.ClientCredentialsHeaderTokenPropagator] will not be loaded due to failing conditions:
 - * Client credentials header token handler disabled due to a lack of configuration
 - * Custom condition [class io.micronaut.security.oauth2.client.clientcredentials.propagation.ClientCredentialsHeaderPropagatorEnabled] failed evaluation

What am I missing from my config?

     name: my-app
           - https://my-dev.com
       enabled: false
           grant-type: client_credentials
           client-id: myId
           client-secret: mySecret
             service-id-regex: 'my-dev'
             scope: myScope
             url: https://auth-dev.com/oauth2/token
             auth-method: client_secret_post
2 replies
Chris Warth
newbie to frameworks like micronaut and Spring. I would really like to use this JdbcOperations to stream query results. I see example usage in jdbc-example-java (https://github.com/micronaut-projects/micronaut-data/blob/master/doc-examples/jdbc-example-java/src/main/java/example/AbstractBookRepository.java) , but I can’t figure out how jdbcOperations gets initialized and passed in to AbstractBookRepository. I don't actually see any uses of the AbstractBookRepository class in that project. Including @JdbcRepository annotations in my own code does not cause errors, but also does not initialize and pass jdbcOperations to the constructor.
How can I configure my service to use JdbcOperations in micronaut?
7 replies
Nahuel Rodríguez

Hi everyone, I am struggling with the following situation, and I would like to see if any of you could give me a hand:
I am building a service that exposes unprotected endpoints, but it calls another service that does require authentication and authorization via JWT.
Since the callers of my new service will be sending a JWT token, my idea is to use JWT token propagation to reduce boilerplate code (as of now, I have done it manually, receiving a @Header("Authorization") final String auth parameter in each controller handler), but I don't know how to properly configure my service to grab the JWT token and propagate it without asking for authentication at the endpoints level.
I tried adding the dependency:

  • annotating the endpoints with @Secured(SecurityRule.IS_ANONYMOUS) + adding security.token.propagation.enabled: true in the application.yml file +

But I still receive 401 Unauthorized.
Any help and/or example will be welcomed. Thank you.

14 replies
Logan Kulinski
Hi team, is there anyway I can access properties defined in application.yaml from the logback config? I have attempted to add <property resource="application.yml"/> with no luck.
Noé Fernández

Hi, is it possible with micronaut data to use different data sources for different repositories? Something like this

    url: 'blah'
    username: 'blah'
    ... rest of the config ...
    url: 'blah'
    ... rest of the config ...

And then I have two repositories

 public interface RepositoryA extends CrudRepository<EntityA, EntityAKey> {}

  public interface RepositoryB extends CrudRepository<EntityB, EntityAKey> {}

would be possible to configure jpa to use the lowPrio pool whenever I save something with RepositoryB and use the default pool when doing so with RepositoryA?

Patrick Lightbody
Hey -- does anyone have any advice on how to best use OpenTelemetry with Micrometer? We've got the basics going, but I really would like all the IO instrumentation that comes with the Java agent (https://github.com/open-telemetry/opentelemetry-java-instrumentation). The issue I'm finding is that when I incorporate that, it loads up the otel configuration prior to Micronaut starting up and thus it doesn't use the config in my application.yml. Any advice? (Also I'm curious what the posture is on this instrumentation given that it uses bytecode manipulation, which Micronaut tends to shun)
1 reply
Patrick Lightbody
s/Micrometere/Micronaut =P
Logan Kulinski
Is anyone using Google AutoValue or Immutables with Micronaut request beans? I keep running into an InstantiationError likely due to no public constructors. Is there an easy way around this?
Patrick Lightbody
Follow-up question on Micrometer/OpenTracing: we're seeing that the span for HTTP requests are getting the name from HttpAttributes.ROUTE_INFO, which has variables in it and makes grouping impossible for any dynamic route. It seems like it would have been better off using HttpAttributes.URI_TEMPLATE. Unfortunately, it's not easy to swap this logic out because it's wedged into MicronautHttpServerAttributesGetter which is a package-protected enum marked with @Internal. But what I can do is make a high precedence filter that replaces HttpAttributes.ROUTE_INFO contents in the request attributes with the contents of HttpAttributes.URI_TEMPLATE, but I worry that this might break other things. Any ideas on what other options I have?
1 reply
Marcel Linnenfelser
Hey -- I started using test-resources. In most cases it is helpful, but I am not able to deactivate it by configuration in application-<env>.yml. Is there a way to accomplish that other than commenting it out in build.gradle?
Patrick Lightbody
Another Micronaut/OpenTracing question: how does one disable the tracing module, such as during testing?
1 reply
Hallvard Trætteberg
I’m experimenting with Micronaut in combination with JavaFX ala SupernautFX. I’ve implemented a custom scope and corresponding annotation for views, so I can have several instances of a workbench-like pane. It works well, so far. However, I haven’t found a way to register a manually created scope «singleton», a bit like BeanContext.registerSingleton, but it should be registered on the current scope. Is there an API for this?
Fabio Rafael da Rosa
Hi all, good day. Im trying to find information about how to use micronaut rabbit/kafka and reactive consumers ... using coroutines to be more precise, but I cannot find any documentation or example. Can someone point me to where I can find that info (or if thats no currently supported) ?
Is there an easy way to copy the body from one HttpResponse (R1) to a new HttpMutableResponse (R2)?
Where the R1 content is Json but got as raw to avoid decoding and R2 has json contentType but avoids encoding?
(kind of proxy, but I don't want use the ProxyHttpClient as it seems the connection reusing is not happening)
1 reply
can someone point me to example to setup kafka testcontainers using maven?

Hi guys, question, I'm getting a 403 when trying to change the log level by using the loggers endpoint. Basically if I don't send the Bearer token I get a 401, and if I send a valid token, I get a 403, no useful info in the DEBUG log. Any idea?

2022-11-24T11:04:58.957562+00:00 app[web.1]: 11:04:58.957 [default-nioEventLoopGroup-1-10] DEBUG i.m.s.rules.InterceptUrlMapRule - No url map pattern exact match found for path [/loggers/io.micronaut.security.token] and method [POST]. Searching in patterns with no defined method.
2022-11-24T11:04:58.957669+00:00 app[web.1]: 11:04:58.957 [default-nioEventLoopGroup-1-10] DEBUG i.m.s.rules.InterceptUrlMapRule - No url map pattern match found for path [/loggers/io.micronaut.security.token]. Returning unknown.
2022-11-24T11:04:58.957880+00:00 app[web.1]: 11:04:58.957 [default-nioEventLoopGroup-1-10] DEBUG i.m.security.filters.SecurityFilter - Authorized request POST /loggers/io.micronaut.security.token. No rule provider authorized or rejected the request.
2022-11-24T11:04:58.961546+00:00 at=info method=POST path="/loggers/io.micronaut.security.token" host=myhost.com request_id=9164-4072-87f1-3f017bcd5741 fwd="" service=12ms status=403 bytes=115 protocol=https

This is my endpoint loggers config:

    enabled: true
    sensitive: false
    details-visible: ANONYMOUS
    enabled: true
    sensitive: false
    write-sensitive: false


4 replies

Hi guys, I have updated micronaut version from 3.6.3 to 3.7.4 and now, during the gradle build each module log some debug info. See here:

> Task :sources:services:user-service:compileGroovy
14:40:37.531 [/ to / workers] DEBUG io.micronaut.context.env.DefaultEnvironment - Environment deduction is using the default of: true
14:40:37.533 [/ to / workers] INFO io.micronaut.context.env.DefaultEnvironment - Established active environments: [gcp, cloud]
14:40:37.535 [/ to / workers] DEBUG io.micronaut.context.env.DefaultEnvironment - Starting environment io.micronaut.openapi.visitor.AnnProcessorEnvironment@f86f03 for active names [gcp, cloud]
14:40:37.539 [/ to / workers] DEBUG io.micronaut.context.env.AbstractPropertySourceLoader - No PropertySource found for file name: application.VCAP_APPLICATION
14:40:37.539 [/ to / workers] DEBUG io.micronaut.context.env.AbstractPropertySourceLoader - No PropertySource found for file name: application-gcp.VCAP_APPLICATION
14:40:37.539 [/ to / workers] DEBUG io.micronaut.context.env.AbstractPropertySourceLoader - No PropertySource found for file name: application-cloud.VCAP_APPLICATION
14:40:37.540 [/ to / workers] DEBUG io.micronaut.context.env.AbstractPropertySourceLoader - No PropertySource found for file name: application.json
14:40:37.540 [/ to / workers] DEBUG io.micronaut.context.env.AbstractPropertySourceLoader - No PropertySource found for file name: application-gcp.json

Can these be disabled? I have tried to disable gradle log and my logback.xml print only INFO.

Matthew Planchant
I'm following the guidelines (https://micronaut-projects.github.io/micronaut-test/latest/guide/#kotest5) for 'Mocking Collaborators' with kotest but the collaborator bean is used in the @PostConstruct of the bean under test. This is failing as it seems that the mock has not been injected at this point. Is there a work around I can use here?
Sergio del Amo
You can always create a bean in your test class path annotate it with @Replaces and @Requires and replace the bean you want to mock in a test
Matthew Planchant
Thanks @sdelamo:matrix.org. I'll check this out.
Sergio del Amo
do you have a reproducible example with a failing test?
Sergio del Amo
micronaut security by design respond 401 or 403 (if authenticated if you are authenticated) for 404. We do that to give an attacker less information about which routes exists or not. There is a setting you can toggle if you prefer to receive 404 instead.
Stijepo Vrdoljak

Hi, I'm having issues parsing a body from a HttpClientResponseException:

    public HttpResponse<InvalidPathSegmentProblem> error(HttpRequest<?> r, InvalidPathSegmentProblem e) {
        return HttpResponse.<String>status(HttpStatus.BAD_REQUEST).body(e);

I'm throwing a custom exception and then transform it to a BAD REQUEST and attach the exception to the body.
BUT it's always empty on the other side:

        client.exchange(payload, Argument.of(Payload.class), Argument.of(InvalidPathSegmentProblem.class))
            .awaitDone(5, TimeUnit.SECONDS)
            .assertError(throwable -> {
                var httpClientResponseException = (HttpClientResponseException) throwable;
                var err = httpClientResponseException.getResponse().getBody(InvalidPathSegmentProblem.class).get();
                System.out.println("BODY: " + err);
                return true;
Stijepo Vrdoljak
I also tried with the blocking approach like in your documentation. Same result...
public void afterAnHttpClientExceptionTheResponseBodyCanBeBoundToAPOJO() {
    try {
                Argument.of(Book.class), // 
                Argument.of(CustomError.class)); // 
    } catch (HttpClientResponseException e) {
        assertEquals(HttpStatus.UNAUTHORIZED, e.getResponse().getStatus());
        Optional<CustomError> jsonError = e.getResponse().getBody(CustomError.class);
        assertEquals(401, jsonError.get().status);
        assertEquals("Unauthorized", jsonError.get().error);
        assertEquals("No message available", jsonError.get().message);
        assertEquals("/books/1680502395", jsonError.get().path);
Sergio del Amo

Have you verified by logging with

<logger name="io.micronaut.http.client" level="TRACE"/>

the error body payload is being returned

Stijepo Vrdoljak
Cannot construct instance of `InvalidPathSegmentProblem` (no Creators, like default constructor, exist): Throwable needs a default constructor, a single-String-arg constructor; or explicit @JsonCreator
Error decoding HTTP error response body:
Sergio del Amo
if InvalidPathSegmentProblem has multiple constructors annotate the one you want to use in deserialization with @Creator
or an empty constructor
from the error messsage
Stijepo Vrdoljak
We are using problem+json from zalando. There are a lot of constructors.
Andrew Malyhin

Hello! Is there a something like inter-service auth in security?
I use security sessions, and I'd like to propagate info about user to other micro-services.

  • Let's say we have a case when service A have to retrieve some secure info about user from service B.
  • User have session and interact with the A. the A have to send request to the B but should prove that it isn't just crafted by 3rd party.
  • So, looks like we have to have a layer when user session is replaces to something like JWT (signed by the A) and is used to make request to the B (user info is propagated).

If there are no such mechanics, how can I create something similar to it?

2 replies