Share
Embed
Getting Started with the Micronaut Framework
Presentation at Community Over Code EU 2024.
Sergio del Amo
June 05, 2024
Transcript
36 slides
-
Bratislava, Slovakia. June 3-5, 2024 Getting Started with the Micronaut
Framework Sergio del Amo Caballero -
Copyright © 2024 by Micronaut Foundation All rights reserved. Sergio
del Amo https://sergiodelamo.com @sdelamo Member of the Micronaut Foundation Board of Directors Micronaut Developer Advocate Involved with Micronaut since its inception. Micronaut Core committer. Micronaut Guides. Micronaut Starter, Security, AWS, Views, RSS, Problem+JSON, Email, 2 -
Copyright © 2024 by Micronaut Framework All rights reserved. OPEN-SOURCE
LICENSE 4 Apache 2.0 -
Copyright © 2024 by Micronaut Framework All rights reserved. SUPPORTED
JAVA VERSIONS 6 21 17 -
Copyright © 2024 by Micronaut Foundation All rights reserved. Modern
JVM Framework ❖ Micronaut was designed from scratch in 2017, focused on modern architectures like microservices and serverless, with the cloud in mind. 7 All application types ❖ Micronaut is a complete solution for any type of application: microservices, message-driven producers or consumers, command-line apps, serverless functions Highly optimized ❖ Micronaut leverages Java annotation processors and other optimizations to compute the framework infrastructure at compile-time, drastically reducing startup time and memory consumption. -
Copyright © 2024 by Micronaut Foundation All rights reserved. AOT:
Ahead of Time Micronaut computes at build time: ‣ All dependency and configuration injection ‣ Annotation metadata (meta annotations) ‣ AOP proxies ‣ Bean introspections ‣ All other framework infrastructure At runtime ‣ No reflection. ‣ No proxy generation. ‣ No dynamic classloading. ‣ No classpath scanning. 8 -
Copyright © 2024 by Micronaut Foundation All rights reserved. Configuration
Dependency Injection ❖ Can use JSR-330 (@Inject) annotations 9 ❖ Properties, YAML, TOML, Groovy, Config4K. Validation support ❖ Built-in reflection free, faster startup, smaller JAR, reduced memory. ❖ Hibernate Validation: full Bean Validation API compliance. AOP: Aspect-Oriented Programing ❖ Compile-time, reflection free. HTTP Client ❖ Micronaut includes an HTTP client that has both a low-level API and a higher-level AOP-driven API. -
Copyright © 2024 by Micronaut Framework All rights reserved. TEST
FRAMEWORK AGNOSTIC 11 -
Copyright © 2024 by Micronaut Framework All rights reserved. ❖
RxJava 2 ❖ RxJava 3 ❖ Project Reactor REACTIVE LIBRARY AGNOSTIC 12 -
Copyright © 2024 by Micronaut Framework All rights reserved. DATABASE
MIGRATION TOOLS 18 -
Copyright © 2024 by Micronaut Framework All rights reserved. VIEWS
20 Server Side View Redendering Pebble Rocker Soy -
Copyright © 2024 by Micronaut Framework All rights reserved. SECURITY
23 Security OAuth 2.0 OpenID Connect LDAP BasicAuth JWT -
Copyright © 2024 by Micronaut Foundation All rights reserved. Error
Handling ❖ Vnd.Error ❖ Problem+JSON 24 -
Copyright © 2024 by Micronaut Foundation All rights reserved. Monitoring
❖ Micrometer ❖ JMX 25 API ❖ GRAPHQL ❖ GRPC ❖ Open API Containers ❖ Kubernetes K8S MISC ❖ Cache ❖ Email ❖ Picocli ❖ RSS Search ❖ Elasticsearch ❖ OpenSearch -
Copyright © 2024 by Micronaut Foundation All rights reserved. ROUTING
❖ @Controller ❖ @Get @Post @Patch @Update @Delete ❖ JAX-RS 26 -
© 2019, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com
27 Micronaut + Groovy ♥ -
© 2019, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com
28 MICRONAUT IS WRITTEN WITH JAVA. IT IS TESTED WITH SPOCK -
© 2019, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com
29 MICRONAUT LAUNCH - GROOVY/SPOCK -
© 2019, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com
30 MICRONAUT CLI - GROOVY/SPOCK -
© 2019, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com
31 Groovy Specific Modules Dependency Description micronaut-inject-groovy Include AST transformations to generate bean definitions. Should be compileOnly on your classpath. micronaut-runtime-groovy Adds the ability to specify configuration placed in src/main/resources in Groovy format (i.e. application.groovy) micronaut-function-groovy Include AST transforms that make it easier to write Functions for AWS Lambda -
© 2019, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com
32 Groovy Specific Modules -
© 2019, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com
33 Singleton ⚠ Make sure to use jakarta.inject.Singleton when declaring a singleton bean. Groovy automatically imports groovy.lang.Singleton -
Copyright © 2024 by Micronaut Foundation All rights reserved. RESOURCES
❖ https://micronaut.io ❖ https://docs.micronaut.io ❖ https://guides.micronaut.io ❖ https://micronaut.io/blog ❖ https://github.com/micronaut-projects ❖ https://micronaut.io/foundation ❖ https://micronaut.io/commercial-support 36