Latest news about Bitcoin and all cryptocurrencies. Your daily crypto news habit.
Micronaut is a new full-stack framework build from the ground by the Grails team officially announced at Greach 2018. It focuses on modularity, minimal memory footprint and startup time which makes it a perfect solution for running on AWS lambda or similar environments. Server written in Java requires less than one second to start with minimal JAR size of 8 MB. Micronaut supports Java, Groovy and Kotlin language.
body[data-twttr-rendered="true"] {background-color: transparent;}.twitter-tweet {margin: auto !important;}
Key things to note about @micronautfw from @graemerocher #micronautfw #grailsfw #groovylang #greach18
function notifyResize(height) {height = height ? height : document.documentElement.offsetHeight; var resized = false; if (window.donkey && donkey.resize) {donkey.resize(height); resized = true;}if (parent && parent._resizeIframe) {var obj = {iframe: window.frameElement, height: height}; parent._resizeIframe(obj); resized = true;}if (window.location && window.location.hash === "#amp=1" && window.parent && window.parent.postMessage) {window.parent.postMessage({sentinel: "amp", type: "embed-size", height: height}, "*");}if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.resize) {window.webkit.messageHandlers.resize.postMessage(height); resized = true;}return resized;}twttr.events.bind('rendered', function (event) {notifyResize();}); twttr.events.bind('resize', function (event) {notifyResize();});if (parent && parent._resizeIframe) {var maxWidth = parseInt(window.frameElement.getAttribute("width")); if ( 500 < maxWidth) {window.frameElement.setAttribute("width", "500");}}
The main advantage of Micronaut is that there are no runtime penalty for holding metadata for configuration and dependency injection. You can think about Micronaut as Spring without any runtime reflection. Every information is handled at compile time using Groovy AST transformation or AST processors for Java and Kotlin. Micronaut uses internal dependency injection module inspired by Spring which leverages the official JSR-330 Context and Dependency Injection annotations.
Micronaut code looks very similar to Spring Boot with Spring Cloud enabled. You can write HTTP servers and HTTP clients with seamless load balancing. There is out-of-box support for service discovery, Hystrix, trace logging, caching, fault tolerance and circuit breaker pattern. Reactive Streams support is integral part of the framework so your controllers and clients can use for example RxJava 2 objects for input and output such as Single<MyObject>.
Controller Example
@Controller("/") class HelloController { @Get("/hello/{name}") String hello(String name) { return "Hello $name" }}
Client Example
@Client("/") interface HelloClient { @Get('/hello/{name}') Single<String> hello(String name)}
Fallback Client Example
@Fallback class HelloFallbackClient { Single<String> hello(String name) { return Single.just("Hello fallback $name") }}
Similar to Spring Boot you can declare your own auto-configurable beans using @Requires annotation. It also shares the configuration properties with Spring Boot. You can even use SPRING_APPLICATION_JSON environment property for backend compatibility. You can use environment-specific properties for example application-aws.yml for deployment to AWS.
Micronaut shares some of the parts with Grails — you will be able to use for example GORM from within your Micronaut microservice.
Micronaut is not available to public yet. The release is planned in Q2 2018 which means it will be probably released at Gr8Conf EU, which will also host talks dedicated to this new framework. Companies interested to try Micronaut may ask OCI for beta access.
You can see more details about Micronaut in following slides by Álvaro Sánchez-Mariscal:
What is Micronaut? was originally published in Hacker Noon on Medium, where people are continuing the conversation by highlighting and responding to this story.
Disclaimer
The views and opinions expressed in this article are solely those of the authors and do not reflect the views of Bitcoin Insider. Every investment and trading move involves risk - this is especially true for cryptocurrencies given their volatility. We strongly advise our readers to conduct their own research when making a decision.