In an era of microservices and cloud computing, Micronaut incorporates support for cloud-friendly reliability patterns - from load balancing and circuit breakers to shared configuration and service discovery - and makes these features available and easily configurable from within your application. From the ground up, Micronaut applications are "natively" cloud-native.
The Micronaut framework values at the core, enabling code simplicity and developer productivity. Micronaut offers many additional features for a new class of applications (e.g., microservices, serverless deployments, etc.) that may not be well-suited for monoliths.
2. About Me
• Senior Software Engineer
• Web & JVM developer for 10+ years
• Husband and father
• OSS contributor
• 2GM Team Member at OCI
Zachary Klein
3. Agenda
❖ A Brief History
❖ Why Micronaut?
❖ What is Micronaut?
❖ An Introduction to…
‣ Creating an app
‣ Controllers
‣ Testing
‣ HTTP Clients
‣ Dependency Injection
‣ Application
configuration
‣ Annotations
‣ Micronaut Data
‣ Micronaut resources &
Community
❖ Q & A
12. • A framework for microservice & serverless
applications
• Leverages Ahead Of Time (AOT) for DI, AOP, and
configuration injection
• Reactive HTTP layer built on Netty
• Declarative HTTP Client
• “Natively Cloud Native”
• Accompanied by a suite of official and community-
contributed integrations and libraries
Introduction to Micronaut
25. Micronaut Controllers
❖Annotated With @Controller
❖Configured As Beans
‣Subjected To DI
❖Conceptually Similar To Controllers In Other
Frameworks
‣Grails
‣Spring
‣Etc…
28. Testing Micronaut
❖Micronaut is test-framework agnostic
❖No special tooling required for unit or integration/
functional tests
❖Simplest approach: start the ApplicationContext
and test away!
try (ApplicationContext context = ApplicationContext.run()) {
MyBean myBean = context.getBean(MyBean.class);
// test your MyBean
}
30. @MicronautTest
@Property(name = "greeting.prefix", value = "Hello")
class HelloControllerSpec extends Specification {
@Inject HelloClient client
void 'test greeting'() {
expect:
client.toBlocking().retrieve('/hello/James') == 'Hello James'
}
}
❖Testing library for Spock & JUnit 5
❖Starts up application (inc. embedded server) and
shuts it down automatically
❖Allows direct injection of beans into test classes
❖Set configuration properties with @Property
Micronaut Test