Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Grails 4 and Micronaut at Devnexus 2019
1. GRAILS 4 AND MICRONAUT
Getting the best out of Grails 4 and Micronaut
2. About Me
• Graeme Rocher
• Creator of Grails and Micronaut
• Principal Engineer at Object Computing
• Oracle Groundbreaker Award Winner
3. Agenda
• Introduction to Micronaut
• Introduction to Grails 4
• Grails vs Micronaut
• Using Micronaut Features in Grails
• Demos
4. Micronaut for Grails
Developers
• Micronaut a Foundational Library for
building applications of any type
• Focuses on Small Memory Footprint
and Speed
• Eliminates Reflection, Runtime
Proxies and Runtime Analysis
5. Why Micronaut?
• Micronaut is uses no reflection, no
runtime proxies, no runtime byte
code generation etc.
• Eliminating these leads to reduced
memory consumption and faster
startup
• Increasingly important for
Microservices, Serverless, IoT, any
low-memory footprint environment
6. Micronaut vs Grails
Micronaut Grails
Range of Runtimes Servlet Only
General Purpose Traditional Servlet Web Apps
DI, AOP etc. Spring for DI, AOP etc.
Java, Kotlin, Groovy, GraalVM Groovy Only
Client and Server Server Only
7. Grails 4 and
Micronaut
• Micronaut the Parent
ApplicationContext
• Made possible by
• http://github.com/micronaut-
projects/micronaut-spring
• Micronaut Libraries become usable
in Grails
• Anything we build for Micronaut
benefits Grails
8. What Can/Should
You Do
• Build Configurations (Instead of
Plugins)
• Use Declarative Clients
• HTTP
• Kafka
• RabbitMQ
9. Configurations vs
Plugins
• Consider Building Configurations
instead of Plugins
• Work with Micronaut, Spring (with
micronaut-spring) and Grails
• Plugins only work with Grails
• ... although some things only
possible with Plugins (Views, taglibs
etc.)
13. @Requires
Conditional Beans Made Easy
@Requires(property="example.enabled")
@Requires(beans=DataSource)
@Requires(missingBeans=Example)
@Singleton
class DefaultExampleBean implements Example {
...
}
def context = ApplicationContext.run("example.enabled":"true")
Example example = context.getBean(Example)
14. @Replaces
Easily Replace Beans by Type
@Replaces(DefaultExample)
@Singleton
class AlternativeExample implements Example {
...
}
• Types match much
• Beans annotated with @Infrastructure not replaceable
16. @Client
Declarative Compile Time HTTP Clients
@Client("https://api.github.com")
@Header(name="User-Agent", value="micronaut-client")
interface GithubClient {
@Get("/repos/{+slug}")
Info getInfo(String slug)
}
• Blocking or Non-Blocking (RxJava, Reactor or Future)
• Reflection / Runtime Proxy Free
17. @Client
• Uses Micronaut's low-level HTTP
client (RxHttpClient) under the
hood
• Built with Micronaut AOP (reflection/
runtime proxy free)
• Works on GraalVM nativeimage
• Integrates with Tracing, Metrics,
Service Discovery etc.
19. @KafkaClient
Declarative Compile Time Kafka Clients
@KafkaClient
public interface ProductClient {
@Topic("my-products")
void sendProduct(@KafkaKey String brand, String name);
}
• Blocking or Non-Blocking (RxJava, Reactor or Future)
https://github.com/micronaut-projects/micronaut-kafka
20. @RabbitClient
Declarative Compile Time Kafka Clients
@RabbitClient("animals")
interface AnimalClient {
void send(@Header String animalType, Animal animal)
}
• Blocking or Non-Blocking (RxJava, Reactor or Future)
https://github.com/micronaut-projects/micronaut-rabbitmq
21. Micronaut Message
Consumers
• Micronaut Supports Message-Drive
Microservices
• Can be run as standalone processes
(No HTTP server)
• Use @RabbitListener for Rabbit
• Use @KafkaListener for Kafka
https://docs.micronaut.io/1.1.x/guide/
index.html#messaging
22. Micronaut's Clients
• Compile Time
• Reflection and Runtime Proxy Free
• Java, Groovy or Kotlin
• Built with Micronaut AOP
https://docs.micronaut.io/1.1.x/guide/
index.html#aop
23. Summary
• Micronaut Provides an Awesome Foundation
• Building Blocks to Create Libraries, Configurations and
Clients
• Most Micronaut Features Available in Grails
• Build Micronaut Libraries not Plugins