Micronaut is a modern, JVM-based, fullstack framework for building modular, easily testable microservice and serverless applications. Micronaut provides a simple compile-time aspect-oriented programming API, which is very similar to Spring, but does not use reflection.
Build configuration
The integration with Micronaut is contained in the kvision-server-micronaut module. It has to be added as the dependency in the common target. This module depends on the micronaut-inject, micronaut-http, micronaut-router and micronaut-websocket. Any other dependencies can be added to build.gradle.kts and then be used in your application.
The standard way to configure Micronaut application is src/jvmMain/resources/application.yml file. It contains options needed for optional dependencies. It can be empty if they are not used.
Implementation
Service class
The implementation of the service class comes down to implementing required interface methods and making it a Micronaut @Prototype component.
Micronaut IoC (Inversion of Control) allows you to inject resources and other Micronaut components into your service class. You can use standard @Inject annotation or constructor based injection.
Note: The new instance of the service class will be created by Micronaut for every server request. Use session or request objects to store your state with appropriate scope.
Blocking code
Since Micronaut architecture is asynchronous and non-blocking, you should not block threads in your application code. If you have to use some blocking code (e.g. blocking I/O, JDBC) use the dedicated coroutine dispatcher.
To allow KVision work with Micronaut you have to pass all instances of the KVServiceManager objects (defined in common code) to the Micronaut environment. You do this by defining a provider method for the KVManagers instance in the main application class.
To secure your application you can use different Micronaut components and ready to use modules. See Micronaut Security guide for details. You can apply different security settings for different services by defining custom SecurityRule using KVision matches helper function.