GithubHelp home page GithubHelp logo

oreilly-live-training's Introduction

Spring Recipes

This repository contains the code for the Spring Recipes live training on the O'Reilly platform.

Getting Started

  • Spring Initializr
  • Code Structure
    • Avoid default package
    • Main application class should live in the same package as the rest of your code
    • Use packages to organize your code
      • package by layer
      • package by feature
    • Dependency Injection
    • Logging
    • DevTools

Web Applications

  • Building a REST API
  • Validating Data
  • HTTP Clients
  • GraphQL

Databases

  • Connecting to and H2 database
  • What about a real database?
    • Docker Compose Module
    • How to view the database?
  • Spring Data
    • Show off Spring Data JDBC (Event.java)
  • Populating the database
    • DDL script
    • Programmatically

Spring Cloud

  • Actuator
  • Observability
  • Gateway

Actuator

Observability

Observability was one of the major themes in Spring Framework 6 + Spring Boot 3

  • Java 17
  • Jakarta EE
  • Observability
  • Spring Native (AOT)

What is observability? In our understanding, it is "how well you can understand the internals of your system by examining its outputs". We believe that the interconnection between metrics, logging, and distributed tracing gives you the ability to reason about the state of your system in order to debug exceptions and latency in your applications.

Spring Boot 3 adds numerous autoconfigurations for improved metrics with Micrometer and new distributed tracing support with Micrometer Tracing (formerly Spring Cloud Sleuth). We have been changing the Micrometer API a lot over the course of this year. The most important change is that we have introduced a new API: the Observation API. The idea of its founding was that we want the users to instrument their code once using a single API and have multiple benefits out of it (e.g. metrics, tracing, logging).

Distributed Architecture comes with its challenges: A single user request can travel through hundreds or thousands of microservices. So to quickly identify where things are going wrong, you need a central overview of how requests are performing across services.

Documentation

Observability

  • Log Aggregation (Loki / Logstash)
  • Distributed Tracing (Zipkin / Jaeger)
  • Time Series Metrics (Prometheus)
  • Data Query, Visualization, Alerting (Grafana)

Demo Steps

  • Revisit the Actuator endpoints
    • /metrics endpoint
    • What is being collected by default (http requests, jvm, etc.)
  • Observation API
    • EventController (Observation.createNotStarted)
    • findAll
    • findAllWithDelay
    • findById - add tag
  • @Observed Annotation
    • Add AOP spring boot starter dependency
    • ObservationConfig
    • EventController
      • Replace findAll with annotation to demonstrate different ways to use the API
    • Prometheus
      • Add Prometheus dependency (micrometer-registry-prometheus)
      • Docker Compose
        • service
        • (prometheus.yml)
      • View Prometheus actuator endpoint
      • localhost:9090
    • Grafana
      • Docker Compose
      • Login to Grafana and create a dashboard
    • Zipkin

Gateway

The Gateway service is in its own repository to simplify the demo.

Security

The Security example is in its own repository to simplify the demo.

Production

  • Configuration
    • Property Sources
    • @Value annotation
    • @ConfigurationProperties
    • Profiles
  • Packaging Options
    • Building an Executable JAR
    • Building a Container Image
    • Building a Native Image
      • Use Cases for Native Images (show off CLI if we have time)
  • Spring Boot 3.2 (Virtual Threads)
  • Deploying your application to...

Hosts

Here are a few services that you can deploy your Spring Boot Applications on:

Getting to Production with Spring Boot

Here are a few videos from Spring Office Hours and Dan's YouTube channel on moving your Spring Boot applications into production.

Resources

Repositories

Nate Schutta

Dan Vega

oreilly-live-training's People

Contributors

danvega avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.