Browse Source

session 2

master
Arthur Dambrine 3 years ago
parent
commit
0c73bec790
  1. 38
      micronaut_cloud_native_microservices_with_java.md

38
micronaut_cloud_native_microservices_with_java.md

@ -4,7 +4,7 @@
## Learning sessions log ## Learning sessions log
Session 1 : 04/11/2022 **Session 1 : 04/11/2022**
Daniel - Instructor for the course Daniel - Instructor for the course
@ -14,6 +14,10 @@ Goal for this course: following it for 45min/day.
**Session 2 : 06/11/2022** - continue with micronaut quickstart, create a hello world endpoint and test it with `@MicronautTest`
## Unit 1 : Introduction ## Unit 1 : Introduction
### Spring / Micronaut / Quarkus (09/2020) ### Spring / Micronaut / Quarkus (09/2020)
@ -75,3 +79,35 @@ Create a first project with:
- Junit - Junit
Dependancies: `Netty server` Dependancies: `Netty server`
### Creating our first endpoint
Create a hello world endpoint using annotations.
- create a java class
- add `@Controller("/path")` annotation at class level
- add `@Get(produces = MediaType.TEXT_PLAIN)` at method level
**NOTE**: access http://localhost:8080/hello to see plain text hello world displayed.
### First micronaut test experience
*Let's automate - making sure that written code works*
- create a test class in test folder
- add annotation `@MicronautTest` at class level
- add a class with `@Test` annotation
- create a HttpClient using `@Inject` & `@Client("/")`
- use the `HttpClient client` as a blocking client (for simplicity now) and query the `/hello` endpoint
**NOTE**: by default a `@MicronautTest` is a functionnal test. So to create a unit test simply remove the annotation and use your prefered test framework.
<hr>
***Session 3 will start [here](https://sparkers.udemy.com/course/learn-micronaut/learn/lecture/28896754#overview)***

Loading…
Cancel
Save