Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Getting Started with the Micronaut Framework

Getting Started with the Micronaut Framework

Presentation at Community Over Code EU 2024.

Sergio del Amo

June 05, 2024
Tweet

More Decks by Sergio del Amo

Other Decks in Programming

Transcript

  1. 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
  2. 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.
  3. 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
  4. 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.
  5. Copyright © 2024 by Micronaut Framework All rights reserved. ❖

    RxJava 2 ❖ RxJava 3 ❖ Project Reactor REACTIVE LIBRARY AGNOSTIC 12
  6. Copyright © 2024 by Micronaut Framework All rights reserved. VIEWS

    20 Server Side View Redendering Pebble Rocker Soy
  7. Copyright © 2024 by Micronaut Framework All rights reserved. SECURITY

    23 Security OAuth 2.0 OpenID Connect LDAP BasicAuth JWT
  8. 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
  9. Copyright © 2024 by Micronaut Foundation All rights reserved. ROUTING

    ❖ @Controller ❖ @Get @Post @Patch @Update @Delete ❖ JAX-RS 26
  10. © 2019, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com

    28 MICRONAUT IS WRITTEN WITH JAVA. IT IS TESTED WITH SPOCK
  11. © 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
  12. © 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
  13. 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