[2022 javaone] foundations of modern java server apps

Speaker: Kito Mann

For more see the table of contents

Notes

  • In cloud, have both microservices and traditional web apps

Microservice

  • Container (ex: docker) including UNIX kernel
  • Executable Jar or Native Image (ex: Graal)
  • Example microservice framework – Http Server, Http Java Integration, REST processing, JSON serialization, JSON parsing, validation, security, database integration, dependency injection, messaging, mail, health checks, tracing, fault tolerance, metrics, config, OpenAPI docs, GraphQL
  • Microservice frameworks – Spring boot, quarkus, micronaut, open liberty

Spring Boot

  • Http Server – Jetty, Tomcat or Underflow
  • Http Java Integration – Jakarta Servlet
  • REST processing – Jakarta RESTful Web Services or Spring MVC
  • JSON serialization – Gson, Jackson or JSON Binding
  • JSON parsing – Gson, Jackson or JSON Parsing
  • validation – Jakarta Bean validation
  • security – Spring security
  • database integration – JPA and others
  • dependency injection – Spring framework
  • messaging – Jakarta messaging, kafka and others
  • mail – spring java mail sender or jarkarta mail
  • health checks – spring boot actuator
  • tracing – spring cloud sleuth
  • fault tolerance – spring cloud circuit breaker and spring cloud netflix
  • metrics – micrometer
  • config – spring boot config
  • OpenAPI docs – Spring REST data
  • GraphQL – Spring for GraphQL

Others

Did same for Quarkus, Payara Micro, Jarkarta EE. Didn’t transcribe deck

A lot of delegating to Jakarta and MicroProfile projects

MicroProfile

  • Started in 2016

Jakarta projects

  • Jakarta Interceptors – standard way of writing interceptors
  • Platform – Jakarta enterprise beans, authorization, batch, connectors, mail, activation, messaging, web profile, core profile
  • Optional (not fully supported) – Jakarta enterprise web services, xml binding, SOAP with attachments, XML web services
  • Web profile – servlet, bean validator, persistence, authentication, web socket, CDI, mail, security, transactions, expression language, managed beans, concurrency, faces, standard tag libraries, server pages, enterprise beans light
  • Core profile – interceptor, dependency injection, annotations
  • Required for MicroProfile – Jakarta RESTful web services, JSON processing, JSON binding, CDI light
  • CDI surpassing EJB
  • New: Jakarta RPC, NoSQL, data
  • Removed: Jakarta Management

Java EE Server

  • War
  • Jakarta Servlet, RESTful web services, JSON binding/parsing, bean validation, security, persistence, CDI, messaging, mail

My take

Wow. A lot has changed since I last worked on a web app. Learned a lot here although the talk was longer than my attention span; especially later in the day. It was a bit of an info dump but good for getting the lay of the land. And I need to do a lot of reading!

[kcdc 2022] diving into debugging spring boot applications

Speaker Mark Heckler @mkheck

For more, see the table of contents

Notes

  • Developers don’t believe in magic
  • Most developers are bad at debugging. Or at least not as good as they could be
  • We got sloppy when we get used to thinking we know what’s happening
  • Important to isolate problem and not just symptoms

Code wakthru

  • @SpringBootApplication – meta-annotation. Enables the other scaning annotations
    • @SpringBootConfiguration
    • @EnableAutoConfiguration
    • @ComponentScan
  • Starter parent pom has dpendencies that have been tested together. Provided in dependency management so can choose what need
  • Proved @Component still creates a @Bean
  • SpringApplication.run returns a ConfigurableApplicationContext. We don’t typically use it directly, but can look into it.
  • ApplicationRunner (creates prop object from args) vs CommandLineRunner (has args as array). The later is slightly more efficient.
  • @Value lets you get a property

Overwriting name

  • application.properties with wrong key name. Typo causes code not to use the value
  • application.yaml – ignored; still uses application.properties because higher precedence

Actuator

  • Can expose a lot of info
  • By default, opens two endpoints, status and one other. If want actual info, allow by privilege.
  • Can expose everything via management.endpoints.webexposure.include=* (don’t do this in prod)
  • loalhost:8080/actuator – see endpoints
  • localhost:8080/actuator/env – see java version, list of beans, etc (so can see order)

Remote debugging

  • In IDE config, set -agentib:jdwp=transport=dt_socket,server.. (missed the end)

Container

  • Can set config in Docker fil.

Key point

You don’t know. You can suspect and hypothesize, but not assume.

My take

I like that Mark showed Spring source code to show what was happening. It took a long time to get to the first thing that went wrong (missing property).. (40 minutes in; another session was already applauding by then). Once he got to that part, I started learning stuff. Mark also seemed rushed for the end and that info went too fast for me. (Combo if it being new and I think he was going faster) Also, the using the audience members as names in the example was fun.

[devnexus 2022] what’s new in spring 2022

Speaker: Spencer Gibb

Twitter: @spencerbgibb

Link to table of contents

———————

History

  • Spring 1 came out in 2004. Spring 5 came out in 2017 – included Java 8/11/17
  • Spring Boot 1 released 2014 with Java 6 baseline. Spring Boot 2 released 2018 with Java 8 (baseline)/11/17. Now has 6 month release cycle to match Java
  • Spring Cloud – launched 2015. last release in 2020. Started with wors *Angle, Brixton, etc). Switched to # release versions (2020)
  • Josh Long’s favorite place on the internet is prod. Secon favorite is start.spring.io.

Spring 6

  • corresponding libraries have version as well. e: Spring security, data
  • Spring Boot 3 and Spring Cloud 2022.0. go with Spring 6
  • Go to Spring Initializr (start.spring.io) if not sure what goes together

Java 17

  • Baseline Java 17. Must hava Java17+ to run
  • Will have compatability wihth Java 18, 19, etc

Jakarta EE 9

  • Package renaming (javax -> jakarta)
  • Tomcat 10/Jetty 11/Undertow 2.2
  • JPA3 3 (Hibernate 6)

Native

  • GraalVM compiles to native
  • Faster startup, less memory usage
  • Spring Native was an exeperimental project. AOT metadata processing moves to Spring Framework. Built time pugins move to Spring Boot. Type and resoures hints move to relevant projects
  • Native pros – serverless, cost via lower resource consumption, CLI
  • Native cons – less mature, no JIT

Observablity

  • Introuced with Sleuth. 2021.0 will be last Sleuth release
  • Now Micrometer tracing
  • new Observation API
  • Instrumentation moving to relevant projects
  • Micrometer staying as Java 8 baseline

Declarative Clients

  • Feign was part of spring-cloud-netflix and open sourced Now spring-cloud-openfeign
  • Declarative blocking web service client
  • Now in Spring framework
  • Will add for GraphQL and RSocket (reactive sockets)

General

  • API testing tool: https://httpie.io
  • thenounproject.com – good collection of free stock art
  • Logger creates a lazy version so doesn’t interpolate strings unless needed. Also, a supplier verson
  • AutoConfiguration annotation to replace Configuration annotation
  • Problem details – standard json format for error messages. Content type application/problem+json
  • Removing a bunch of stuff. One is Freemarker JSP whch I didn’t know existed
  • OSS Spring 5 supported until 2024

My take

Excellent outline making the content easy to remember. Which is good because there was a lot of infomration! The live coding was good for seeing the code based changes and also breaking up the information. I liked seing the ”upgrade” with the jakarta package names and the micrometer example