Slide 1

Slide 1 text

Developer experience in a modern Java framework Álvaro Sánchez-Mariscal Principal Member of Technical Staff Oracle @alvaro_sanchez

Slide 2

Slide 2 text

Copyright © 2024, Oracle and/or its affiliates 2 About me • Coming from Madrid • Developer since 2001 (Java stack) • Micronaut core developer since its inception (2017). • Author: Maven Plugin, Object Storage, Kubernetes, Cache, Control Panel. • Others: Core, Gradle, AWS, GCP, Azure, Security, Test, etc. • Currently at Oracle Labs: • Micronaut and Graal Development Kit for Micronaut (GDK). • GraalVM Native Build Tools. @alvaro_sanchez

Slide 3

Slide 3 text

Slides available on Speaker Deck 3 Copyright © 2024, Oracle and/or its affiliates

Slide 4

Slide 4 text

Copyright © 2024, Oracle and/or its affiliates. Micronaut® is a registered trademark of Object Computing, Inc. Use is for referential purposes and does not imply any endorsement or affiliation with any third-party product. 4

Slide 5

Slide 5 text

Introduction to Micronaut Copyright © 2024, Oracle and/or its affiliates 5 Micronaut is a complete solution for any type of application: microservices, message-driven producers or consumers, command-line apps, serverless functions, etc. All application types Micronaut leverages Java annotation processors and other optimisations to compute the framework infrastructure at compile-time, drastically reducing startup time and memory consumption. Highly optimised Modern, open-source Java Framework Micronaut has been designed from scratch in 2017, focused on modern architectures like microservices and serverless, and with the cloud in mind.

Slide 6

Slide 6 text

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. AOT: Ahead Of Time Copyright © 2024, Oracle and/or its affiliates 6 Source code @Singleton class MySvc {} Bytecode class $MySvc$Definition {} class $MySvc$Definition$Reference {} Source code @Builder record Person() {} Source code @Generated class PersonBuilder() {} compilation compilation

Slide 7

Slide 7 text

7 Any language, build tool, test framework, reactive library, cloud, … Copyright © 2024, Oracle and/or its affiliates

Slide 8

Slide 8 text

Micronaut Hello World 8 Copyright © 2024, Oracle and/or its affiliates

Slide 9

Slide 9 text

Micronaut features: HTTP Client 9 Copyright © 2024, Oracle and/or its affiliates Implemented at compile time

Slide 10

Slide 10 text

Micronaut features: message-driven applications Kafka • Producers. • Consumers. • Kafka Streams. RabbitMQ • Producers. • Consumers. • RPC. MQTT • Publishers. • Subscribers. NATS • Producers. • Consumers. Copyright © 2024, Oracle and/or its affiliates 10

Slide 11

Slide 11 text

Micronaut features: data access 11 Copyright © 2024, Oracle and/or its affiliates

Slide 12

Slide 12 text

Micronaut features: data access 12 Copyright © 2024, Oracle and/or its affiliates Interface implemented at compile time Query generated from the method name, compile-time validated Can have custom queries, inserts, etc

Slide 13

Slide 13 text

Micronaut unique features: Test Resources 1. Automatic provisioning of external resources needed during development or testing. • Containers, binaries, etc. 2. Built-in support: 3. Integrated with JUnit Platform (JUnit / Spock / Kotest) for zero-configuration Testcontainers. 13 Copyright © 2024, Oracle and/or its affiliates • MariaDB • MySQL • Oracle • PostgreSQL • SQL Server • Elasticsearch • Redis • MongoDB • Neo4j • Hashicorp Vault • Kafka • RabbitMQ • MQTT • Localstack

Slide 14

Slide 14 text

Micronaut unique features: Serialization 1. Drop-in replacement for Jackson Databind, compile-time and reflection free. 2. Supports (most of) Jackson, JSON-B and BSON annotations. 3. Why? • Memory performance: 10x smaller runtime footprint. • Security: serializable classes must be opt-in. • Type-safety: Micronaut Serialization performs checks at compile-time (vs Jackson runtime exceptions). • Runtime portability: Micronaut Serialization at runtime supports different annotation sets. 14 Copyright © 2024, Oracle and/or its affiliates

Slide 15

Slide 15 text

Micronaut unique features: Validation 1. Built-in alternative for Jakarta Bean Validation. • Spec features that require reflection are not supported. • Use Hibernate Validator if needed. 2. Supported universally across the framework. • Configuration classes, entities, controllers, etc. 3. Benefits: • Reflection and runtime proxy free. • Smaller footprint (1.4MB less). • Faster startup (200+ ms less). • Compile-time validation. • GraalVM support out of the box. 15 Copyright © 2024, Oracle and/or its affiliates

Slide 16

Slide 16 text

Getting Started: Micronaut Guides 16 Copyright © 2024, Oracle and/or its affiliates https://guides.micronaut.io

Slide 17

Slide 17 text

Getting Started: Micronaut Launch 17 Copyright © 2024, Oracle and/or its affiliates https://launch.micronaut.io

Slide 18

Slide 18 text

Getting Started: Micronaut CLI 18 Copyright © 2024, Oracle and/or its affiliates

Slide 19

Slide 19 text

Getting Started: Intellij IDEA 19 Copyright © 2024, Oracle and/or its affiliates

Slide 20

Slide 20 text

Getting Started: Visual Studio Code 20 Copyright © 2024, Oracle and/or its affiliates

Slide 21

Slide 21 text

Graal A full stack for the development and deployment of high performance Java cloud native applications

Slide 22

Slide 22 text

Copyright © 2024, Oracle and/or its affiliates 22

Slide 23

Slide 23 text

What is Graal Development Kit for Micronaut? Copyright © 2024, Oracle and/or its affiliates 23 BUILT FOR GRAALVM NATIVE IMAGE Easily compile ahead-of-time with GraalVM Native Image into small executables that start instantly, and use less memory/CPU. CLOUD-AGNOSTIC MODULES A curated set of Micronaut modules that provide platform-independent support for core cloud services – object store, secrets, streaming, and more. DEV TOOLS AND VS CODE EXTENSIONS Dev tools to generate multicloud application starter templates. VS Code extensions for local development and cloud deployment.

Slide 24

Slide 24 text

24 Copyright © 2024, Oracle and/or its affiliates

Slide 25

Slide 25 text

25 Copyright © 2024, Oracle and/or its affiliates

Slide 26

Slide 26 text

Copyright © 2024, Oracle and/or its affiliates 26

Slide 27

Slide 27 text

What is GraalVM 27 Copyright © 2024, Oracle and/or its affiliates

Slide 28

Slide 28 text

Native Image Goals Low Resource Usage Start Fast Compact Packaging Minimize Vulnerability Copyright © 2024, Oracle and/or its affiliates 28

Slide 29

Slide 29 text

Micronaut and GraalVM 6ms As low as startup time 18MB Consuming memory footprint >30% Increased throughput up to and reduced latency

Slide 30

Slide 30 text

Micronaut and GraalVM 1. The best integration possibly, supported by teams working together at Oracle Labs. • GraalVM EE includes optimisations for Micronaut for increased performance and throughput. • GraalVM EE license included in Oracle Cloud. 2. Micronaut is ready for GraalVM Native Image since day 1. • No reflection, no runtime proxies, no bytecode generation, no dynamic classloading. 3. GraalVM tooling for Visual Studio Code and Intellij IDEA. 30 Copyright © 2024, Oracle and/or its affiliates

Slide 31

Slide 31 text

GraalVM Reachability Metadata Repository Community-driven collection of GraalVM reachability metadata for open-source libraries. • Actively maintained by a collective effort of VMware, Oracle and others. • Enabled in GraalVM Native Build Tools (Maven and Gradle plugins). • Integrated by default in Spring Boot and Micronaut. 31 Copyright © 2024, Oracle and/or its affiliates

Slide 32

Slide 32 text

Micronaut is the fastest to startup 32 Copyright © 2024, Oracle and/or its affiliates Source: https://speakerdeck.com/mraible/comparing-native-java-rest-api-frameworks-jchampions-conference-2024

Slide 33

Slide 33 text

Micronaut is the fastest to startup 33 Copyright © 2024, Oracle and/or its affiliates Source: https://speakerdeck.com/mraible/comparing-native-java-rest-api-frameworks-jchampions-conference-2024

Slide 34

Slide 34 text

Micronaut consumes the less memory 34 Copyright © 2024, Oracle and/or its affiliates Source: https://speakerdeck.com/mraible/comparing-native-java-rest-api-frameworks-jchampions-conference-2024

Slide 35

Slide 35 text

Micronaut and GraalVM powering Disney+ 35 Copyright © 2024, Oracle and/or its affiliates https://aws.amazon.com/blogs/opensource/improving-developer-productivity-at-disney-with-serverless-and-open-source/

Slide 36

Slide 36 text

Copyright © 2024, Oracle and/or its affiliates 36 Demo Micronaut and GraalVM

Slide 37

Slide 37 text

Álvaro Sánchez-Mariscal @alvaro_sanchez

Slide 38

Slide 38 text

Copyright © 2024, Oracle and/or its affiliates 38 Q &A

Slide 39

Slide 39 text

No content