SlideShare a Scribd company logo
objectcomputing.com
© 2022, Object Computing, Inc. (OCI). All rights reserved. No part of these notes may be reproduced, stored in a retrieval system, or transmitted, in any
form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior, written permission of Object Computing, Inc. (OCI)
Groovy-Powered Microservices
with Micronaut
Zachary Klein, Principal Software Engineer, 2GM Team
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com
❖ Zachary Klein - Developer & Architect
❖ Principal Software Engineer at Object
Computing, Inc
❖ 12+ years of software development experience
❖ OSS contributor
❖ Training instructor
2
About me
Copyright © 2022 Object Computing, Inc. (OCI) All rights reserved.
A modern, JVM-based, full-stack framework for building modular,
easily testable microservice and serverless applications.
Copyright © 2022 Object Computing, Inc. (OCI) All rights reserved.
https://micronaut.io/launch
Copyright © 2022 Object Computing, Inc. (OCI) All rights reserved.
❖ Controller with
Dependency Injection
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com
❖ Micronaut is language-agnostic
❖ 1st Class support for:
❖ Java
❖ Kotlin
❖ Groovy
6
Micronaut and Groovy
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com
❖ Micronaut implements core framework
components using Groovy language features
❖ E.g, Groovy AST transformations are used
for AOT compilation support (vs Annotation
Processors in Java/Kotlin)
❖ Support for Groovy configuration files,
serverless functions, Spock/Geb tests, and
GORM!
7
Micronaut and Groovy
Copyright © 2022 Object Computing, Inc. (OCI) All rights reserved.
❖ Controller with
Dependency Injection
❖ New class files generated
at compilation time (via
AST Transformations) to
implement the controller,
instantiate & supply
dependencies, etc
Copyright © 2022 Object Computing, Inc. (OCI) All rights reserved.
❖ Controller with
Dependency Injection
❖ New class files generated
at compilation time (via
AST Transformations) to
implement the controller,
instantiate & supply
dependencies, etc
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com
❖ Micronaut Launch is the recommended
method for creating Micronaut apps
❖ Choose Groovy as the Language (and
Spock as testing framework, if desired)
❖ Using the CLI:
10
Getting Started
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 11
Getting Started
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 12
Getting Started
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 13
Getting Started
Groovy auto-imports the
groovy.lang.singleton
annotation - make sure you
import from jakarta.inject
!
Copyright © 2022 Object Computing, Inc. (OCI) All rights reserved.
❖ Dependency Injection via
@Inject
Copyright © 2022 Object Computing, Inc. (OCI) All rights reserved.
❖ Micronaut’s HTTP Client
(implemented through
Groovy AST
Transformations)
Copyright © 2022 Object Computing, Inc. (OCI) All rights reserved.
❖ Dependency Injection via
Constructor Injection
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com
❖ YAML is the default, but Groovy
is supported
❖ Groovy allows for powerful,
expressive, programmatic
configuration
❖ Can mix and match!
17
Configuration with Groovy
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 18
Configuration with Groovy
❖ Micronaut accepts
configuration in JSON,
properties, YAML, and
Groovy ConfigSlurper (also
env variables, system
properties)
❖ Note that properties cannot
contain dashes - use
camelCase or snake_case
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com
❖ Micronaut Controllers (and Clients) express routes
declaratively via annotation arguments:
❖ @Controller("/hello")
❖ @Get("/profile “)
❖ Optionally, routes can be expressed
programmatically using the RouteBuilder interface
❖ GroovyRouteBuilder provides an expressive DSL
for routes (similar to Grails UrlMappings)
19
Controller Routes
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 20
Controller Routes
❖ Annotation-based routes
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 21
Controller Routes
❖ GroovyRouteBuilder
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 22
@MicronautTest & Spock
❖ Micronaut is test-framework agnostic - no special
tooling required
❖ E.g, JUnit, Spock
❖ Because of Micronaut’s fast startup time, many
developers prefer integration tests
❖ @MicronautTest automatically starts up the
application context for the test run, and shuts it
down cleanly
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 23
@MicronautTest & Spock
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 24
@MicronautTest & Spock
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 25
@MicronautTest & Spock
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 26
@MicronautTest & Spock
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 27
@MicronautTest & Spock
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 28
Micronaut and GORM
❖ GORM is the persistence framework pioneered by
the Grails framework - https://gorm.grails.org
❖ GORM provides expressive querying, persistence
and domain modeling features, including
validation, multi-tenancy, and more
❖ When configured with Groovy support, Micronaut
apps can leverage GORM’s powerful features in a
comparatively lightweight manner
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 29
Micronaut and GORM
Dependency Description
micronaut-
hibernate-gorm
Configures GORM for Hibernate for Groovy
applications
micronaut-mongo-
gorm
Configures GORM for Mongo DB for Groovy
applications
micronaut-neo4j-
gorm
Configures GORM for Mongo DB for Groovy
applications
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 30
Adding GORM to Micronaut
❖ Using Micronaut Launch
or the CLI command
feature-diff, you can
generate a delta showing
how to add a feature, like
hibernate-gorm
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 31
Adding GORM to Micronaut
❖ Add GORM and JDBC
dependencies - also a
database driver (H2 in this
demo)
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com
Configuring Datasources
❖ Datasource configuration
❖ Standard Hibernate/JDBC
configuration properties -
database credentials,
dialect, etc
❖ Can configure multiple
datasources
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com
Enabling Entity-scanning
❖ Application class needs to
be modified
❖ Application context is
started up using the
builder pattern - the
packages() method
species the package under
which entities are defined
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 34
Creating Domain Classes (aka Entities)
❖ A Domain Class / Entity can
be a simple POGO
annotated with @Entity
❖ Class name will be mapped
as database table name (by
convention)
❖ Properties of the class will be
mapped to columns in the
database table
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 35
Creating Domain Classes (aka Entities)
❖ Additional data-mapping
features (like validation)
can be added by
implementing the
GormEntity<> trait
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 36
GORM Data Services in Micronaut
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 37
GORM Data Services in Micronaut
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 38
GORM Multi-tenancy
https://gorm.grails.org/latest/hibernate/manual/index.html#multiTenancy
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 39
GORM Multi-tenancy
https://gorm.grails.org/latest/hibernate/manual/index.html#multiTenancy
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 40
GORM Multi-tenancy
https://gorm.grails.org/latest/hibernate/manual/index.html#multiTenancy
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 41
GORM Multi-tenancy
https://gorm.grails.org/latest/hibernate/manual/index.html#multiTenancy
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 42
GORM Multi-tenancy Modes
https://gorm.grails.org/latest/hibernate/manual/index.html#multiTenancy
Modes Description Isolation
DATABASE
Separate database with a
separate connection pool is used
to store each tenants data.
HIGHEST
SCHEMA
The same database, but different
schemas are used to store each
tenants’ data.
HIGH
DISCRIMINATOR
The same database is used with
a discriminator used to partition
and isolate data.
LOW
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 43
GORM Multi-tenancy Tenant Resolvers
https://gorm.grails.org/latest/hibernate/manual/index.html#multiTenancy
Name Description
CookieTenantResolver Removes the current tenant from an HTTP cookie
FixedTenantResolver Resolves against a fixed tenant id
HttpHeaderTenantResolver Resolves the current tenant from the request HTTP Header
PrincipalTenantResolver Resolves the current tenant from the authenticated username
SessionTenantResolver Resolves the current tenant from the HTTP Session
SubdomainTenantResolver Resolves the tenant id from the subdomain
SystemPropertyTenantResolver Resolves the tenant id from a system property
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 44
GORM Multi-tenancy: Specify tenantId
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 45
GORM Multi-tenancy Transformations (Annotations)
Transformation Description
@CurrentTenant Resolve the current tenant for the context of a class or method
@Tenant Use a specifc tenant for the context of a class or method
@WithoutTenant Execute logic without a specific tentnat (using the default connection)
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 46
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 47
Micronaut and Grails
❖ Grails is a rapid-application Java web-framework, based on
Groovy and Spring Boot
❖ Since Grails 4, Grails applications include a Micronaut
application context, allowing Micronaut features and libraries
to be integrated with Grails apps
❖ Micronaut HTTP Client & Grails: https://guides.grails.org/
grails-micronaut-http/guide/index.html
❖ Micronaut Kafka & Grails: https://guides.grails.org/grails-
micronaut-kafka/guide/index.html
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com
❖ Micronaut supports Groovy for writing serverless
functions in environments like AWS Lambda, Oracle
Cloud, Microsoft Azure, & Google Cloud Platform.
❖ You can deploy “pure” functions (invoked by events in
the platform) or lightweight “HTTP functions” (with
controllers, REST endpoints, etc)
48
Micronaut and Groovy: Serverless Functions
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 49
Micronaut and Groovy: Serverless Functions
https://micronaut-projects.github.io/
micronaut-gcp/latest/guide/
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 50
Micronaut and Groovy: Serverless Functions
https://micronaut-projects.github.io/
micronaut-aws/latest/guide/
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 51
Micronaut and Groovy: Serverless Functions
https://micronaut-projects.github.io/
micronaut-azure/latest/guide/
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 52
Micronaut and Groovy: Serverless Functions
https://micronaut-projects.github.io/
micronaut-oracle-cloud/latest/guide/
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 53
Micronaut and Groovy: CLI Apps
❖ Micronaut supports creation of Command Line
Applications using the picocli library (https://picocli.info/)
❖ CLI apps can be created using Groovy as well!
❖ Apps can utilize dependency injection, HTTP clients, &
more
❖ Docs: https://micronaut-projects.github.io/micronaut-
picocli/latest/guide/
© 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 54
Micronaut and Groovy: CLI Apps
objectcomputing.com
© 2022, Object Computing, Inc. (OCI). All rights reserved. No part of these notes may be reproduced, stored in a retrieval system, or transmitted, in any
form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior, written permission of Object Computing, Inc. (OCI)
Zachary Klein, Principal Software Engineer, 2GM Team

More Related Content

What's hot

【DL輪読会】Llama 2: Open Foundation and Fine-Tuned Chat Models
【DL輪読会】Llama 2: Open Foundation and Fine-Tuned Chat Models【DL輪読会】Llama 2: Open Foundation and Fine-Tuned Chat Models
【DL輪読会】Llama 2: Open Foundation and Fine-Tuned Chat Models
Deep Learning JP
 
2019年度チュートリアルBPE
2019年度チュートリアルBPE2019年度チュートリアルBPE
2019年度チュートリアルBPE
広樹 本間
 
Pattern Recognition and Machine Learning: Section 3.3
Pattern Recognition and Machine Learning: Section 3.3Pattern Recognition and Machine Learning: Section 3.3
Pattern Recognition and Machine Learning: Section 3.3
Yusuke Oda
 
Ph.D. Defense Presentation Slides (Changhee Han) カリスの東大博論審査会(公聴会)発表スライド Patho...
Ph.D. Defense Presentation Slides (Changhee Han) カリスの東大博論審査会(公聴会)発表スライド Patho...Ph.D. Defense Presentation Slides (Changhee Han) カリスの東大博論審査会(公聴会)発表スライド Patho...
Ph.D. Defense Presentation Slides (Changhee Han) カリスの東大博論審査会(公聴会)発表スライド Patho...
カリス 東大AI博士
 
代数的実数とCADの実装紹介
代数的実数とCADの実装紹介代数的実数とCADの実装紹介
代数的実数とCADの実装紹介
Masahiro Sakai
 
ROSチュートリアル ROBOMECH2018
ROSチュートリアル ROBOMECH2018ROSチュートリアル ROBOMECH2018
ROSチュートリアル ROBOMECH2018
Ryuichi Ueda
 
LLVMで遊ぶ(整数圧縮とか、x86向けの自動ベクトル化とか)
LLVMで遊ぶ(整数圧縮とか、x86向けの自動ベクトル化とか)LLVMで遊ぶ(整数圧縮とか、x86向けの自動ベクトル化とか)
LLVMで遊ぶ(整数圧縮とか、x86向けの自動ベクトル化とか)Takeshi Yamamuro
 
【DL輪読会】Parameter is Not All You Need:Starting from Non-Parametric Networks fo...
【DL輪読会】Parameter is Not All You Need:Starting from Non-Parametric Networks fo...【DL輪読会】Parameter is Not All You Need:Starting from Non-Parametric Networks fo...
【DL輪読会】Parameter is Not All You Need:Starting from Non-Parametric Networks fo...
Deep Learning JP
 
PreadNet
PreadNetPreadNet
PreadNet
Junya Kuwada
 
並列化による高速化
並列化による高速化 並列化による高速化
並列化による高速化
sakura-mike
 
PRML復々習レーン#9 前回までのあらすじ
PRML復々習レーン#9 前回までのあらすじPRML復々習レーン#9 前回までのあらすじ
PRML復々習レーン#9 前回までのあらすじ
sleepy_yoshi
 
Greed is Good: 劣モジュラ関数最大化とその発展
Greed is Good: 劣モジュラ関数最大化とその発展Greed is Good: 劣モジュラ関数最大化とその発展
Greed is Good: 劣モジュラ関数最大化とその発展
Yuichi Yoshida
 
Rosbag search system
Rosbag search systemRosbag search system
Rosbag search system
yusuke shibui
 
MoveItの新機能、 OMPL Constrained Planningを試してみた
MoveItの新機能、 OMPL Constrained Planningを試してみた MoveItの新機能、 OMPL Constrained Planningを試してみた
MoveItの新機能、 OMPL Constrained Planningを試してみた
Ryo Kabutan
 
Papago/N2MT 개발이야기
Papago/N2MT 개발이야기Papago/N2MT 개발이야기
Papago/N2MT 개발이야기
NAVER D2
 
論文に関する基礎知識2018 差分のみ
論文に関する基礎知識2018 差分のみ論文に関する基礎知識2018 差分のみ
論文に関する基礎知識2018 差分のみ
Mai Otsuki
 
myCobotがある生活
myCobotがある生活myCobotがある生活
myCobotがある生活
Ryo Kabutan
 
Pythonの理解を試みる 〜バイトコードインタプリタを作成する〜
Pythonの理解を試みる 〜バイトコードインタプリタを作成する〜Pythonの理解を試みる 〜バイトコードインタプリタを作成する〜
Pythonの理解を試みる 〜バイトコードインタプリタを作成する〜
Preferred Networks
 
確率ロボティクス第二回
確率ロボティクス第二回確率ロボティクス第二回
確率ロボティクス第二回
Ryuichi Ueda
 
劣モジュラ最適化と機械学習 2.0-2.3 劣モジュラ関数の基本性質・例・最適化
劣モジュラ最適化と機械学習 2.0-2.3 劣モジュラ関数の基本性質・例・最適化劣モジュラ最適化と機械学習 2.0-2.3 劣モジュラ関数の基本性質・例・最適化
劣モジュラ最適化と機械学習 2.0-2.3 劣モジュラ関数の基本性質・例・最適化
Akiyoshi Hara
 

What's hot (20)

【DL輪読会】Llama 2: Open Foundation and Fine-Tuned Chat Models
【DL輪読会】Llama 2: Open Foundation and Fine-Tuned Chat Models【DL輪読会】Llama 2: Open Foundation and Fine-Tuned Chat Models
【DL輪読会】Llama 2: Open Foundation and Fine-Tuned Chat Models
 
2019年度チュートリアルBPE
2019年度チュートリアルBPE2019年度チュートリアルBPE
2019年度チュートリアルBPE
 
Pattern Recognition and Machine Learning: Section 3.3
Pattern Recognition and Machine Learning: Section 3.3Pattern Recognition and Machine Learning: Section 3.3
Pattern Recognition and Machine Learning: Section 3.3
 
Ph.D. Defense Presentation Slides (Changhee Han) カリスの東大博論審査会(公聴会)発表スライド Patho...
Ph.D. Defense Presentation Slides (Changhee Han) カリスの東大博論審査会(公聴会)発表スライド Patho...Ph.D. Defense Presentation Slides (Changhee Han) カリスの東大博論審査会(公聴会)発表スライド Patho...
Ph.D. Defense Presentation Slides (Changhee Han) カリスの東大博論審査会(公聴会)発表スライド Patho...
 
代数的実数とCADの実装紹介
代数的実数とCADの実装紹介代数的実数とCADの実装紹介
代数的実数とCADの実装紹介
 
ROSチュートリアル ROBOMECH2018
ROSチュートリアル ROBOMECH2018ROSチュートリアル ROBOMECH2018
ROSチュートリアル ROBOMECH2018
 
LLVMで遊ぶ(整数圧縮とか、x86向けの自動ベクトル化とか)
LLVMで遊ぶ(整数圧縮とか、x86向けの自動ベクトル化とか)LLVMで遊ぶ(整数圧縮とか、x86向けの自動ベクトル化とか)
LLVMで遊ぶ(整数圧縮とか、x86向けの自動ベクトル化とか)
 
【DL輪読会】Parameter is Not All You Need:Starting from Non-Parametric Networks fo...
【DL輪読会】Parameter is Not All You Need:Starting from Non-Parametric Networks fo...【DL輪読会】Parameter is Not All You Need:Starting from Non-Parametric Networks fo...
【DL輪読会】Parameter is Not All You Need:Starting from Non-Parametric Networks fo...
 
PreadNet
PreadNetPreadNet
PreadNet
 
並列化による高速化
並列化による高速化 並列化による高速化
並列化による高速化
 
PRML復々習レーン#9 前回までのあらすじ
PRML復々習レーン#9 前回までのあらすじPRML復々習レーン#9 前回までのあらすじ
PRML復々習レーン#9 前回までのあらすじ
 
Greed is Good: 劣モジュラ関数最大化とその発展
Greed is Good: 劣モジュラ関数最大化とその発展Greed is Good: 劣モジュラ関数最大化とその発展
Greed is Good: 劣モジュラ関数最大化とその発展
 
Rosbag search system
Rosbag search systemRosbag search system
Rosbag search system
 
MoveItの新機能、 OMPL Constrained Planningを試してみた
MoveItの新機能、 OMPL Constrained Planningを試してみた MoveItの新機能、 OMPL Constrained Planningを試してみた
MoveItの新機能、 OMPL Constrained Planningを試してみた
 
Papago/N2MT 개발이야기
Papago/N2MT 개발이야기Papago/N2MT 개발이야기
Papago/N2MT 개발이야기
 
論文に関する基礎知識2018 差分のみ
論文に関する基礎知識2018 差分のみ論文に関する基礎知識2018 差分のみ
論文に関する基礎知識2018 差分のみ
 
myCobotがある生活
myCobotがある生活myCobotがある生活
myCobotがある生活
 
Pythonの理解を試みる 〜バイトコードインタプリタを作成する〜
Pythonの理解を試みる 〜バイトコードインタプリタを作成する〜Pythonの理解を試みる 〜バイトコードインタプリタを作成する〜
Pythonの理解を試みる 〜バイトコードインタプリタを作成する〜
 
確率ロボティクス第二回
確率ロボティクス第二回確率ロボティクス第二回
確率ロボティクス第二回
 
劣モジュラ最適化と機械学習 2.0-2.3 劣モジュラ関数の基本性質・例・最適化
劣モジュラ最適化と機械学習 2.0-2.3 劣モジュラ関数の基本性質・例・最適化劣モジュラ最適化と機械学習 2.0-2.3 劣モジュラ関数の基本性質・例・最適化
劣モジュラ最適化と機械学習 2.0-2.3 劣モジュラ関数の基本性質・例・最適化
 

Similar to Groovy-Powered Microservices with Micronaut

Micronaut: Changing the Micro Future
Micronaut: Changing the Micro FutureMicronaut: Changing the Micro Future
Micronaut: Changing the Micro Future
Zachary Klein
 
Native Cloud-Native: Building Agile Microservices with the Micronaut Framework
Native Cloud-Native: Building Agile Microservices with the Micronaut FrameworkNative Cloud-Native: Building Agile Microservices with the Micronaut Framework
Native Cloud-Native: Building Agile Microservices with the Micronaut Framework
Zachary Klein
 
Protecting data with CSI Volume Snapshots on Kubernetes
Protecting data with CSI Volume Snapshots on KubernetesProtecting data with CSI Volume Snapshots on Kubernetes
Protecting data with CSI Volume Snapshots on Kubernetes
DoKC
 
Quebec - 16 November 2022 - Canada CNCF Meetups.pdf
Quebec - 16 November 2022 - Canada CNCF Meetups.pdfQuebec - 16 November 2022 - Canada CNCF Meetups.pdf
Quebec - 16 November 2022 - Canada CNCF Meetups.pdf
prune1
 
Groovy for Java Devs
Groovy for Java DevsGroovy for Java Devs
Groovy for Java Devs
Zachary Klein
 
DevOps for Mainframe: Open Source Fast Track
DevOps for Mainframe: Open Source Fast TrackDevOps for Mainframe: Open Source Fast Track
DevOps for Mainframe: Open Source Fast Track
DevOps.com
 
Grails 4: Upgrade your Game!
Grails 4: Upgrade your Game!Grails 4: Upgrade your Game!
Grails 4: Upgrade your Game!
Zachary Klein
 
Get the Exact Identity Solution You Need - In the Cloud - Overview
Get the Exact Identity Solution You Need - In the Cloud - OverviewGet the Exact Identity Solution You Need - In the Cloud - Overview
Get the Exact Identity Solution You Need - In the Cloud - Overview
ForgeRock
 
Automate Behavior-driven Development | Stanford WebCamp 2022
Automate Behavior-driven Development | Stanford WebCamp 2022Automate Behavior-driven Development | Stanford WebCamp 2022
Automate Behavior-driven Development | Stanford WebCamp 2022
DOCOMO Innovations, Inc.
 
20160221 va interconnect_pub
20160221 va interconnect_pub20160221 va interconnect_pub
20160221 va interconnect_pub
Canturk Isci
 
Kong Academyを日本語でお届け!#4 ”はじめてのKong”オンラインミートアップKong Developer Portal編
Kong Academyを日本語でお届け!#4 ”はじめてのKong”オンラインミートアップKong Developer Portal編Kong Academyを日本語でお届け!#4 ”はじめてのKong”オンラインミートアップKong Developer Portal編
Kong Academyを日本語でお届け!#4 ”はじめてのKong”オンラインミートアップKong Developer Portal編
Junji Nishihara
 
Oracle ZDM KamaleshRamasamy Sangam2020
Oracle ZDM KamaleshRamasamy Sangam2020Oracle ZDM KamaleshRamasamy Sangam2020
Oracle ZDM KamaleshRamasamy Sangam2020
Kamalesh Ramasamy
 
Oracle Database Migration to Oracle Cloud Infrastructure
Oracle Database Migration to Oracle Cloud InfrastructureOracle Database Migration to Oracle Cloud Infrastructure
Oracle Database Migration to Oracle Cloud Infrastructure
SinanPetrusToma
 
Getting Groovy with JHipster and Micronaut
Getting Groovy with JHipster and MicronautGetting Groovy with JHipster and Micronaut
Getting Groovy with JHipster and Micronaut
Zachary Klein
 
RICOH THETA x IoT Developers Contest : Cloud API Seminar
 RICOH THETA x IoT Developers Contest : Cloud API Seminar RICOH THETA x IoT Developers Contest : Cloud API Seminar
RICOH THETA x IoT Developers Contest : Cloud API Seminar
contest-theta360
 
.NET and Kubernetes: Bringing Legacy .NET Into the Modern World with Pivotal ...
.NET and Kubernetes: Bringing Legacy .NET Into the Modern World with Pivotal ....NET and Kubernetes: Bringing Legacy .NET Into the Modern World with Pivotal ...
.NET and Kubernetes: Bringing Legacy .NET Into the Modern World with Pivotal ...
VMware Tanzu
 
Introduction to GCCP - 2022.pptx
Introduction to GCCP - 2022.pptxIntroduction to GCCP - 2022.pptx
Introduction to GCCP - 2022.pptx
RamSamarthBB
 
Gluecon 2017 - GoMake | Flying Dreams: Real-Time Communication from the Edge ...
Gluecon 2017 - GoMake | Flying Dreams: Real-Time Communication from the Edge ...Gluecon 2017 - GoMake | Flying Dreams: Real-Time Communication from the Edge ...
Gluecon 2017 - GoMake | Flying Dreams: Real-Time Communication from the Edge ...
Jonathan Barton
 
Android Development Workshop
Android Development WorkshopAndroid Development Workshop
Android Development Workshop
Peter Robinett
 
Automate Behavior-driven Development | DrupalCon Portland 2022
Automate Behavior-driven Development | DrupalCon Portland 2022Automate Behavior-driven Development | DrupalCon Portland 2022
Automate Behavior-driven Development | DrupalCon Portland 2022
DOCOMO Innovations, Inc.
 

Similar to Groovy-Powered Microservices with Micronaut (20)

Micronaut: Changing the Micro Future
Micronaut: Changing the Micro FutureMicronaut: Changing the Micro Future
Micronaut: Changing the Micro Future
 
Native Cloud-Native: Building Agile Microservices with the Micronaut Framework
Native Cloud-Native: Building Agile Microservices with the Micronaut FrameworkNative Cloud-Native: Building Agile Microservices with the Micronaut Framework
Native Cloud-Native: Building Agile Microservices with the Micronaut Framework
 
Protecting data with CSI Volume Snapshots on Kubernetes
Protecting data with CSI Volume Snapshots on KubernetesProtecting data with CSI Volume Snapshots on Kubernetes
Protecting data with CSI Volume Snapshots on Kubernetes
 
Quebec - 16 November 2022 - Canada CNCF Meetups.pdf
Quebec - 16 November 2022 - Canada CNCF Meetups.pdfQuebec - 16 November 2022 - Canada CNCF Meetups.pdf
Quebec - 16 November 2022 - Canada CNCF Meetups.pdf
 
Groovy for Java Devs
Groovy for Java DevsGroovy for Java Devs
Groovy for Java Devs
 
DevOps for Mainframe: Open Source Fast Track
DevOps for Mainframe: Open Source Fast TrackDevOps for Mainframe: Open Source Fast Track
DevOps for Mainframe: Open Source Fast Track
 
Grails 4: Upgrade your Game!
Grails 4: Upgrade your Game!Grails 4: Upgrade your Game!
Grails 4: Upgrade your Game!
 
Get the Exact Identity Solution You Need - In the Cloud - Overview
Get the Exact Identity Solution You Need - In the Cloud - OverviewGet the Exact Identity Solution You Need - In the Cloud - Overview
Get the Exact Identity Solution You Need - In the Cloud - Overview
 
Automate Behavior-driven Development | Stanford WebCamp 2022
Automate Behavior-driven Development | Stanford WebCamp 2022Automate Behavior-driven Development | Stanford WebCamp 2022
Automate Behavior-driven Development | Stanford WebCamp 2022
 
20160221 va interconnect_pub
20160221 va interconnect_pub20160221 va interconnect_pub
20160221 va interconnect_pub
 
Kong Academyを日本語でお届け!#4 ”はじめてのKong”オンラインミートアップKong Developer Portal編
Kong Academyを日本語でお届け!#4 ”はじめてのKong”オンラインミートアップKong Developer Portal編Kong Academyを日本語でお届け!#4 ”はじめてのKong”オンラインミートアップKong Developer Portal編
Kong Academyを日本語でお届け!#4 ”はじめてのKong”オンラインミートアップKong Developer Portal編
 
Oracle ZDM KamaleshRamasamy Sangam2020
Oracle ZDM KamaleshRamasamy Sangam2020Oracle ZDM KamaleshRamasamy Sangam2020
Oracle ZDM KamaleshRamasamy Sangam2020
 
Oracle Database Migration to Oracle Cloud Infrastructure
Oracle Database Migration to Oracle Cloud InfrastructureOracle Database Migration to Oracle Cloud Infrastructure
Oracle Database Migration to Oracle Cloud Infrastructure
 
Getting Groovy with JHipster and Micronaut
Getting Groovy with JHipster and MicronautGetting Groovy with JHipster and Micronaut
Getting Groovy with JHipster and Micronaut
 
RICOH THETA x IoT Developers Contest : Cloud API Seminar
 RICOH THETA x IoT Developers Contest : Cloud API Seminar RICOH THETA x IoT Developers Contest : Cloud API Seminar
RICOH THETA x IoT Developers Contest : Cloud API Seminar
 
.NET and Kubernetes: Bringing Legacy .NET Into the Modern World with Pivotal ...
.NET and Kubernetes: Bringing Legacy .NET Into the Modern World with Pivotal ....NET and Kubernetes: Bringing Legacy .NET Into the Modern World with Pivotal ...
.NET and Kubernetes: Bringing Legacy .NET Into the Modern World with Pivotal ...
 
Introduction to GCCP - 2022.pptx
Introduction to GCCP - 2022.pptxIntroduction to GCCP - 2022.pptx
Introduction to GCCP - 2022.pptx
 
Gluecon 2017 - GoMake | Flying Dreams: Real-Time Communication from the Edge ...
Gluecon 2017 - GoMake | Flying Dreams: Real-Time Communication from the Edge ...Gluecon 2017 - GoMake | Flying Dreams: Real-Time Communication from the Edge ...
Gluecon 2017 - GoMake | Flying Dreams: Real-Time Communication from the Edge ...
 
Android Development Workshop
Android Development WorkshopAndroid Development Workshop
Android Development Workshop
 
Automate Behavior-driven Development | DrupalCon Portland 2022
Automate Behavior-driven Development | DrupalCon Portland 2022Automate Behavior-driven Development | DrupalCon Portland 2022
Automate Behavior-driven Development | DrupalCon Portland 2022
 

More from Zachary Klein

Micronaut Launchpad
Micronaut LaunchpadMicronaut Launchpad
Micronaut Launchpad
Zachary Klein
 
Micronaut For Single Page Apps
Micronaut For Single Page AppsMicronaut For Single Page Apps
Micronaut For Single Page Apps
Zachary Klein
 
Grails Launchpad - From Ground Zero to Orbit
Grails Launchpad - From Ground Zero to OrbitGrails Launchpad - From Ground Zero to Orbit
Grails Launchpad - From Ground Zero to Orbit
Zachary Klein
 
Room with a Vue - Introduction to Vue.js
Room with a Vue - Introduction to Vue.jsRoom with a Vue - Introduction to Vue.js
Room with a Vue - Introduction to Vue.js
Zachary Klein
 
Shields Up! Securing React Apps
Shields Up! Securing React AppsShields Up! Securing React Apps
Shields Up! Securing React Apps
Zachary Klein
 
Using React with Grails 3
Using React with Grails 3Using React with Grails 3
Using React with Grails 3Zachary Klein
 

More from Zachary Klein (6)

Micronaut Launchpad
Micronaut LaunchpadMicronaut Launchpad
Micronaut Launchpad
 
Micronaut For Single Page Apps
Micronaut For Single Page AppsMicronaut For Single Page Apps
Micronaut For Single Page Apps
 
Grails Launchpad - From Ground Zero to Orbit
Grails Launchpad - From Ground Zero to OrbitGrails Launchpad - From Ground Zero to Orbit
Grails Launchpad - From Ground Zero to Orbit
 
Room with a Vue - Introduction to Vue.js
Room with a Vue - Introduction to Vue.jsRoom with a Vue - Introduction to Vue.js
Room with a Vue - Introduction to Vue.js
 
Shields Up! Securing React Apps
Shields Up! Securing React AppsShields Up! Securing React Apps
Shields Up! Securing React Apps
 
Using React with Grails 3
Using React with Grails 3Using React with Grails 3
Using React with Grails 3
 

Recently uploaded

FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
Fwdays
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 

Recently uploaded (20)

FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 

Groovy-Powered Microservices with Micronaut

  • 1. objectcomputing.com © 2022, Object Computing, Inc. (OCI). All rights reserved. No part of these notes may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior, written permission of Object Computing, Inc. (OCI) Groovy-Powered Microservices with Micronaut Zachary Klein, Principal Software Engineer, 2GM Team
  • 2. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com ❖ Zachary Klein - Developer & Architect ❖ Principal Software Engineer at Object Computing, Inc ❖ 12+ years of software development experience ❖ OSS contributor ❖ Training instructor 2 About me
  • 3. Copyright © 2022 Object Computing, Inc. (OCI) All rights reserved. A modern, JVM-based, full-stack framework for building modular, easily testable microservice and serverless applications.
  • 4. Copyright © 2022 Object Computing, Inc. (OCI) All rights reserved. https://micronaut.io/launch
  • 5. Copyright © 2022 Object Computing, Inc. (OCI) All rights reserved. ❖ Controller with Dependency Injection
  • 6. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com ❖ Micronaut is language-agnostic ❖ 1st Class support for: ❖ Java ❖ Kotlin ❖ Groovy 6 Micronaut and Groovy
  • 7. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com ❖ Micronaut implements core framework components using Groovy language features ❖ E.g, Groovy AST transformations are used for AOT compilation support (vs Annotation Processors in Java/Kotlin) ❖ Support for Groovy configuration files, serverless functions, Spock/Geb tests, and GORM! 7 Micronaut and Groovy
  • 8. Copyright © 2022 Object Computing, Inc. (OCI) All rights reserved. ❖ Controller with Dependency Injection ❖ New class files generated at compilation time (via AST Transformations) to implement the controller, instantiate & supply dependencies, etc
  • 9. Copyright © 2022 Object Computing, Inc. (OCI) All rights reserved. ❖ Controller with Dependency Injection ❖ New class files generated at compilation time (via AST Transformations) to implement the controller, instantiate & supply dependencies, etc
  • 10. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com ❖ Micronaut Launch is the recommended method for creating Micronaut apps ❖ Choose Groovy as the Language (and Spock as testing framework, if desired) ❖ Using the CLI: 10 Getting Started
  • 11. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 11 Getting Started
  • 12. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 12 Getting Started
  • 13. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 13 Getting Started Groovy auto-imports the groovy.lang.singleton annotation - make sure you import from jakarta.inject !
  • 14. Copyright © 2022 Object Computing, Inc. (OCI) All rights reserved. ❖ Dependency Injection via @Inject
  • 15. Copyright © 2022 Object Computing, Inc. (OCI) All rights reserved. ❖ Micronaut’s HTTP Client (implemented through Groovy AST Transformations)
  • 16. Copyright © 2022 Object Computing, Inc. (OCI) All rights reserved. ❖ Dependency Injection via Constructor Injection
  • 17. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com ❖ YAML is the default, but Groovy is supported ❖ Groovy allows for powerful, expressive, programmatic configuration ❖ Can mix and match! 17 Configuration with Groovy
  • 18. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 18 Configuration with Groovy ❖ Micronaut accepts configuration in JSON, properties, YAML, and Groovy ConfigSlurper (also env variables, system properties) ❖ Note that properties cannot contain dashes - use camelCase or snake_case
  • 19. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com ❖ Micronaut Controllers (and Clients) express routes declaratively via annotation arguments: ❖ @Controller("/hello") ❖ @Get("/profile “) ❖ Optionally, routes can be expressed programmatically using the RouteBuilder interface ❖ GroovyRouteBuilder provides an expressive DSL for routes (similar to Grails UrlMappings) 19 Controller Routes
  • 20. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 20 Controller Routes ❖ Annotation-based routes
  • 21. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 21 Controller Routes ❖ GroovyRouteBuilder
  • 22. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 22 @MicronautTest & Spock ❖ Micronaut is test-framework agnostic - no special tooling required ❖ E.g, JUnit, Spock ❖ Because of Micronaut’s fast startup time, many developers prefer integration tests ❖ @MicronautTest automatically starts up the application context for the test run, and shuts it down cleanly
  • 23. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 23 @MicronautTest & Spock
  • 24. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 24 @MicronautTest & Spock
  • 25. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 25 @MicronautTest & Spock
  • 26. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 26 @MicronautTest & Spock
  • 27. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 27 @MicronautTest & Spock
  • 28. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 28 Micronaut and GORM ❖ GORM is the persistence framework pioneered by the Grails framework - https://gorm.grails.org ❖ GORM provides expressive querying, persistence and domain modeling features, including validation, multi-tenancy, and more ❖ When configured with Groovy support, Micronaut apps can leverage GORM’s powerful features in a comparatively lightweight manner
  • 29. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 29 Micronaut and GORM Dependency Description micronaut- hibernate-gorm Configures GORM for Hibernate for Groovy applications micronaut-mongo- gorm Configures GORM for Mongo DB for Groovy applications micronaut-neo4j- gorm Configures GORM for Mongo DB for Groovy applications
  • 30. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 30 Adding GORM to Micronaut ❖ Using Micronaut Launch or the CLI command feature-diff, you can generate a delta showing how to add a feature, like hibernate-gorm
  • 31. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 31 Adding GORM to Micronaut ❖ Add GORM and JDBC dependencies - also a database driver (H2 in this demo)
  • 32. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com Configuring Datasources ❖ Datasource configuration ❖ Standard Hibernate/JDBC configuration properties - database credentials, dialect, etc ❖ Can configure multiple datasources
  • 33. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com Enabling Entity-scanning ❖ Application class needs to be modified ❖ Application context is started up using the builder pattern - the packages() method species the package under which entities are defined
  • 34. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 34 Creating Domain Classes (aka Entities) ❖ A Domain Class / Entity can be a simple POGO annotated with @Entity ❖ Class name will be mapped as database table name (by convention) ❖ Properties of the class will be mapped to columns in the database table
  • 35. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 35 Creating Domain Classes (aka Entities) ❖ Additional data-mapping features (like validation) can be added by implementing the GormEntity<> trait
  • 36. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 36 GORM Data Services in Micronaut
  • 37. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 37 GORM Data Services in Micronaut
  • 38. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 38 GORM Multi-tenancy https://gorm.grails.org/latest/hibernate/manual/index.html#multiTenancy
  • 39. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 39 GORM Multi-tenancy https://gorm.grails.org/latest/hibernate/manual/index.html#multiTenancy
  • 40. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 40 GORM Multi-tenancy https://gorm.grails.org/latest/hibernate/manual/index.html#multiTenancy
  • 41. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 41 GORM Multi-tenancy https://gorm.grails.org/latest/hibernate/manual/index.html#multiTenancy
  • 42. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 42 GORM Multi-tenancy Modes https://gorm.grails.org/latest/hibernate/manual/index.html#multiTenancy Modes Description Isolation DATABASE Separate database with a separate connection pool is used to store each tenants data. HIGHEST SCHEMA The same database, but different schemas are used to store each tenants’ data. HIGH DISCRIMINATOR The same database is used with a discriminator used to partition and isolate data. LOW
  • 43. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 43 GORM Multi-tenancy Tenant Resolvers https://gorm.grails.org/latest/hibernate/manual/index.html#multiTenancy Name Description CookieTenantResolver Removes the current tenant from an HTTP cookie FixedTenantResolver Resolves against a fixed tenant id HttpHeaderTenantResolver Resolves the current tenant from the request HTTP Header PrincipalTenantResolver Resolves the current tenant from the authenticated username SessionTenantResolver Resolves the current tenant from the HTTP Session SubdomainTenantResolver Resolves the tenant id from the subdomain SystemPropertyTenantResolver Resolves the tenant id from a system property
  • 44. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 44 GORM Multi-tenancy: Specify tenantId
  • 45. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 45 GORM Multi-tenancy Transformations (Annotations) Transformation Description @CurrentTenant Resolve the current tenant for the context of a class or method @Tenant Use a specifc tenant for the context of a class or method @WithoutTenant Execute logic without a specific tentnat (using the default connection)
  • 46. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 46
  • 47. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 47 Micronaut and Grails ❖ Grails is a rapid-application Java web-framework, based on Groovy and Spring Boot ❖ Since Grails 4, Grails applications include a Micronaut application context, allowing Micronaut features and libraries to be integrated with Grails apps ❖ Micronaut HTTP Client & Grails: https://guides.grails.org/ grails-micronaut-http/guide/index.html ❖ Micronaut Kafka & Grails: https://guides.grails.org/grails- micronaut-kafka/guide/index.html
  • 48. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com ❖ Micronaut supports Groovy for writing serverless functions in environments like AWS Lambda, Oracle Cloud, Microsoft Azure, & Google Cloud Platform. ❖ You can deploy “pure” functions (invoked by events in the platform) or lightweight “HTTP functions” (with controllers, REST endpoints, etc) 48 Micronaut and Groovy: Serverless Functions
  • 49. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 49 Micronaut and Groovy: Serverless Functions https://micronaut-projects.github.io/ micronaut-gcp/latest/guide/
  • 50. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 50 Micronaut and Groovy: Serverless Functions https://micronaut-projects.github.io/ micronaut-aws/latest/guide/
  • 51. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 51 Micronaut and Groovy: Serverless Functions https://micronaut-projects.github.io/ micronaut-azure/latest/guide/
  • 52. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 52 Micronaut and Groovy: Serverless Functions https://micronaut-projects.github.io/ micronaut-oracle-cloud/latest/guide/
  • 53. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 53 Micronaut and Groovy: CLI Apps ❖ Micronaut supports creation of Command Line Applications using the picocli library (https://picocli.info/) ❖ CLI apps can be created using Groovy as well! ❖ Apps can utilize dependency injection, HTTP clients, & more ❖ Docs: https://micronaut-projects.github.io/micronaut- picocli/latest/guide/
  • 54. © 2022, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 54 Micronaut and Groovy: CLI Apps
  • 55. objectcomputing.com © 2022, Object Computing, Inc. (OCI). All rights reserved. No part of these notes may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior, written permission of Object Computing, Inc. (OCI) Zachary Klein, Principal Software Engineer, 2GM Team