Slide 1

Slide 1 text

Thomas Vitale GOTO Aarhus May 23rd, 2023 Next-Generation Cloud Native Apps with Spring Boot 3 @vitalethomas

Slide 2

Slide 2 text

Systematic • Software Engineer and Cloud Architect. • Author of “Cloud Native Spring in Action” (Manning). • OSS contributor (Java, Spring, Cloud Native Technologies) Thomas Vitale thomasvitale.com @vitalethomas

Slide 3

Slide 3 text

Spring @vitalethomas

Slide 4

Slide 4 text

thomasvitale.com @vitalethomas https://spring.io @vitalethomas

Slide 5

Slide 5 text

Java 17 @vitalethomas

Slide 6

Slide 6 text

Java 8 -> 11 -> 17 Performance improvements @vitalethomas Java 8 ‣Startup: 3.784 s ‣Max heap used: 113 MiB ‣Committed heap: 177 MiB Java 11 ‣Startup: 2.204 s ‣Max heap used: 43 MiB ‣Committed heap: 74 MiB Java 17 ‣Startup: 1.776 s ‣Max heap used: 37 MiB ‣Committed heap: 55 MiB

Slide 7

Slide 7 text

Deployment @vitalethomas

Slide 8

Slide 8 text

Packaging Spring Boot JAR & Container Image JAR Container Image Gradle bootJar Maven spring-boot:repackage Gradle bootBuildImage Maven spring-boot:build-image @vitalethomas

Slide 9

Slide 9 text

“Friends don’t let friends write Dockerfiles!” - Josh Long @vitalethomas

Slide 10

Slide 10 text

Dockerfiles “Dockerfiles are easy to write, but the current development guidelines do not produce containers that are repeatable and hardened.” CNCF Software Supply Chain Security Paper https://github.com/cncf/tag-security/tree/main/supply-chain-security @vitalethomas

Slide 11

Slide 11 text

Image pack build Cloud Native Buildpacks From source code to container image @vitalethomas

Slide 12

Slide 12 text

Native Images @vitalethomas

Slide 13

Slide 13 text

Spring Boot 3 and Native Executables The bene fi ts of GraalVM Instant Startup Low Resource Usage Instant Peak Performance @vitalethomas Reduced Surface Attack Compact Packaging

Slide 14

Slide 14 text

Spring Boot 3 and Native Executables The downsides of GraalVM Slower Heavier Build Additional con fi guration might be needed @vitalethomas

Slide 15

Slide 15 text

Data Persistence @vitalethomas

Slide 16

Slide 16 text

Data Integration Spring Data for Relational Databases Spring Data JPA ‣JPA & Hibernate ‣Repositories ‣JDBC Spring Data JDBC ‣DDD Principles ‣Repositories ‣JDBC Spring Data R2DBC ‣DDD Principles ‣Repositories ‣R2DBC @vitalethomas

Slide 17

Slide 17 text

Data Integration Spring Data for Relational Databases Spring Data JPA ‣JPA & Hibernate ‣Repositories ‣JDBC Spring Data Relational ‣DDD Principles ‣Repositories ‣JDBC/R2DBC @vitalethomas

Slide 18

Slide 18 text

Schema and data management Flyway: Version control for your database SQL Migrations Schema changes Java Migrations Data changes V1 Init schema V2 Add column V3 Create table V4 Add constraint time @vitalethomas

Slide 19

Slide 19 text

Testing @vitalethomas

Slide 20

Slide 20 text

Testing Spring Boot Types of auto tests for Spring Boot applications Unit Tests ‣JUnit ‣Mockito ‣No Spring context Integration Tests ‣@SpringBootTest ‣Web server ‣Full Spring context Slice Tests ‣@SpringWebMvc ‣@SpringDataR2dbc ‣Sliced Spring context @vitalethomas

Slide 21

Slide 21 text

Testcontainers Development and testing with external dependencies OCI containers Run external dependencies as OCI containers Data Layer Tests Ensure environment parity by testing the data layer with the real database Integration Tests Use containers for databases, message queues, and web servers @vitalethomas

Slide 22

Slide 22 text

Jakarta EE 10 @vitalethomas

Slide 23

Slide 23 text

From Java EE to Jakarta EE New package names since Jakarta EE 9 import javax.persistence.Entity; import javax.servlet.Servlet; import javax.validation.Valid; @vitalethomas import jakarta.persistence.Entity; import jakarta.servlet.Servlet; import jakarta.validation.Valid;

Slide 24

Slide 24 text

https://docs.openrewrite.org @vitalethomas

Slide 25

Slide 25 text

Observability @vitalethomas

Slide 26

Slide 26 text

Spring Observability Production-grade features Spring Boot Actuator ‣Health (liveness and readiness) ‣Metrics (Prometheus, OpenMetrics) ‣Flyway, Thread Dumps, Heap Dumps Micrometer ‣Uni fi ed Observation API ‣Instrumentation for metrics and traces ‣OpenZipkin, OpenTelemetry @vitalethomas

Slide 27

Slide 27 text

grafana.com @vitalethomas

Slide 28

Slide 28 text

Declarative Clients @vitalethomas

Slide 29

Slide 29 text

Problem Details @vitalethomas

Slide 30

Slide 30 text

https://www.rfc-editor.org/rfc/rfc7807 @vitalethomas

Slide 31

Slide 31 text

Resources @vitalethomas

Slide 32

Slide 32 text

https://github.com/ThomasVitale/spring-boot-next-gen-apps

Slide 33

Slide 33 text

https://github.com/ThomasVitale/awesome-spring

Slide 34

Slide 34 text

Thomas Vitale GOTO Aarhus May 23rd, 2023 Next-Generation Cloud Native Apps with Spring Boot 3 @vitalethomas