Search code examples
javamicronaut

Upgrading from Micronaut 3 to Micronaut 4 stops endpoints from being loaded


We have a Micronaut application running on Micronaut version 3.x. This application is using a shared library, which contains a few controllers (@Endpoint classes) which are part of every application. An example is this:

@Endpoint(id = "ping", defaultSensitive = false)
public class PingEndpoint {

    @Read
    public String ping() {
        return "pong";
    }

}

Now that we've attempted an upgrade to Micronaut 4, this controller is no longer being loaded. In Micronaut 3 I can see the following output:

2023-08-15 16:01:31.805 DEBUG --- [    Test worker] i.m.web.router.DefaultRouteBuilder       : Created Route to @Endpoint monitoring.PingEndpoint: GET /transactions/ping -> PingEndpoint#ping () 

In Micronaut 4, I see my Endpoints being created too, but not this one. I couldn't find anything related to this in the breaking changes. Any advice would be appreciated.


Solution

  • Unfortunately, a recompilation of your shared library using Micronaut 4 is required in order to make Micronaut 4 discover your beans.

    See also: https://github.com/micronaut-projects/micronaut-core/discussions/9414