2.8 KiB
Spring 5 course : Udemy - Unit 1
[toc]
Unit 1: course content
Getting the most of the course
-
download the github repo and use git diff on branches (start of the course / end of the course)
-
fork the repositories to my own github account and start from the fork to follow the course and commit to my personal Github acc.
-
Spring Boot Cookbook at the end of the course
Setting up the dev env for Spring
- Jdk 8 or higher (I will use 17)
- Maven 3.25 of higher (I will use 3.8.6)
- Gradle 3.41. or higher (I will use 7.5.1)
- use maven or gradle as you prefer
#check java is installed
java -version
#check JDK is installed
javac -version
#verify maven is installed
mvn -v
#verify gradle is installed
gradle -v
What's new in Spring Famework 5?
Core Framework Revision
- what is reflextion in java?
Tips: @Nullable and @NotNull annotations to explicitly mark nullable arguments and return values. This enables dealing null values at compile time rather than throwing NullPointerExceptions at runtime.
Session 1 - 26/10/2022 - stoped reading @here
Reactive Programming Model
An exciting feature in this Spring release is the new reactive stack Web framework.
Being fully reactive and non-blocking, this Spring Framework 5.0 is suitable for event-loop style processing that can scale with a small number of threads.
Reactive Streams is an API specification developed by engineers from Netflix, Pivotal, Typesafe, Red Hat, Oracle, Twitter, and Spray.io. This provides a common API for reactive programming implementations to implement. Much like JPA for Hibernate. Where JPA is the API, and Hibernate is the implementation.
With Spring Webflux, you can now create WebClient, which is reactive and non-blocking as an alternative toRestTemplate.
A WebClient implementation of a REST endpoint in Spring 5.0 is this.
WebClient webClient = WebClient.create();
Mono person = webClient.get()
.uri("http://localhost:8080/movie/42")
.accept(MediaType.APPLICATION_JSON)
.exchange()
.then(response -> response.bodyToMono(Movie.class));
While the new WebFlux module brings us some exciting new capabilities, traditional Spring MVC is still fully supported in Spring Framework 5.0.
Getting help with the Spring Framework
- 1- there is a Q&A section under the video in Udemy
- 2- link to the course wiki https://github.com/springframeworkguru/spring5webapp/wiki
Tips: from IntelliJ you can create a gist (right click + create a gist).
- Be clear and give context
- Provide the stacktrace
- Provide a link to a gist or to your Github repo
Session 2 - 27/10/2022