Kurs om
Spring Framework och Spring Boot

Kurs om hur du kommer igång och skriver Java applikationer med hjälp av Spring Framework och Spring Boot

Det finns inget Java ramverk som på ett mer genomgripande sätt förändrat hur vi designar och implementerar affärs-applikation under de senaste 15 åren som Spring Framework. Via Spring Boot är det lekande lätt att bygga själv-konfigurerande webb-applikationer.

Denna kurs lär dig allt du behöver veta för att bli produktiv i ett Spring projekt direkt efter avslutad kurs.

Snabbfakta

Namn
Spring Framework och Spring Boot
Längd
4 dagar
Nivå
Intermediate
Målgrupp
Java programmerare
Förkunskaper
Rutinerad i Java programmering
Programvara & Verktyg
  • Java JDK 11, eller senare
  • SDKMAN
  • Maven || Gradle
  • JetBrains IntelliJ IDEA || MS Visual Code

Detta får du lära dig på kursen

Här är ett sammandrag i punktform av vad du får lära dig på kursen. Eftersom kursmaterialet är författat på engelska, så återger vi sammandraget också på engelska.

  • Learn how wire together spring beans using both XML and Java annotations
  • Using Spring Boot
  • Writing a CLI app using Spring Shell
  • Generating an executable (native image) using Graal VM and the Spring Boot build plugin
  • Tweak the configuration of Spring apps
  • Implementing classic web apps
  • Implementing hybrid AJAX based web apps
  • Implementing SPA web apps
  • Implementing REST controllers
  • Accessing databases using both JDBC and JPA

Kursdatum

Här ser du vilka kursdatum som är tillgängliga. Klicka på en av datumknapparna för att anmäla dig till ett kurstillfälle. På kursen pratar läraren svenska, medan vårt kursmaterial alltid är författat på engelska.

Missa inte vår samfaktureringsrabatt! Är ni fler personer från samma företag/organisation som går på samma kurs, rabatteras tillkommande personer med 25%. Ni anmäler er till kursen en och en, men uppger samma företag, så ordnar vi resten. Samtliga deltagare från samma företag ingår på samma faktura, den första till fullt pris och resterande till rabatterat pris.

Klassrum

Du sitter bekvämt i ett av våra klassrum, vilka finns centralt placerade i Stockholms innerstad.

I priset ingår tryckt kursmaterial (och som PDF), samt kaffe/te med smörgås på förmiddagen och kaffe/te med bulle på eftermiddagen.

Pris: 22 000 kr + moms

Fjärrkurs

Du sitter bekvämt framför datorn och deltar i kursen via internet. Vi använder programvaran Zoom för alla våra fjärrkurser.

I priset ingår kursmaterial som PDF.

Pris: 18 000 kr + moms

Företagsinternt

Om ni är tre eller fler personer från samma företag eller organisation, kan ni beställa en företagsanpassad kurs. Då håller vi kursen på ett datum som passar er. Antingen på plats i era lokaler eller som en fjärrkurs. Vi kan också hålla den muntliga framställningen på engelska.

Klicka på knappen nedan för att be om en offert.

Företagsanpassad Kurs

Kursinnehåll

Eftersom kursmaterialet är författat på engelska, så återger vi innehållet också på engelska.

Background & History

  • Rod Johnson
  • The fallacy of EJB
  • Why Spring was created
  • Properties of Spring
  • Spring configuration forms
  • The evolution and success of Spring
  • When Spring started to crumble on its own weight
  • The inception of Spring Boot
  • Properties of Spring Boot
  • Overview of Spring projects

The Robostore App

  • Purpose
  • H2 database
  • H2 console
  • Source code
  • Tweaks

Fundamentals

Class Loading

  • Class path
  • How the JVM loads a class
  • JAR files
  • Executable JAR file
  • Application JAR file
  • WAR file
  • Static variables
  • Thread local variables

Dependency Injection

  • Sample payment service
  • Usage
  • Instantiation
  • Obvious problems
  • Externalization
  • Configuration
  • Dependency injection, instead
  • Inversion of Control, explained
  • Call-backs
  • Bean factory
  • Scopes
  • Life-cycle methods
  • Sample Spring app

Application Context

  • Spring Bean Factory
  • Spring Application Context
  • Types of app contexts
  • Configuration samples
  • Using XML
  • Using Groovy
  • Using Java
  • Customizations
  • Simple bean tracer
  • Using PropertySourcesPlaceholderConfigurer

Resources

  • What is a Spring resource
  • Resource types
  • Writeable resources
  • Resource loader
  • Resource dependency

SpEL - Spring Expression Language

  • What is SPEL?
  • Syntax
  • Two syntax forms to keep apart

Configuration

XML Configuration

The classic way of wire an application together.

  • Why learn XML configuration
  • Basic XML bean syntax
  • Setter injection
  • Constructor injection
  • Bean references
  • How to load XML bean files
  • Bean scopes in XML
  • Configuring factory methods
  • Life-cycle call-backs in XML
  • Using auto-wiring in XML
  • Collection property types

Beans from a file (under the hood)

  • Sample domain classes
  • BeanRepository
  • PropertiesLoader
  • BeanRepositoryImpl
  • register
  • getBean
  • instantiate

Java Configuration

The better way of wire an application together.

  • What is Java configuration of a Spring app
  • Writing a @Configuration class with @Bean methods
  • Application context
  • Context registration
  • Injecting bean dependencies
  • Scopes
  • Initialization method
  • Destruction method
  • Life-cycle call-backs

@nnotation Configuration

The modern way of wire an application together.

  • Writing a @Component class and how it relates to @Configuration and @Bean
  • Class-path scanning
  • Using the scan() method
  • Using @ComponentScan
  • Using @Autowired
  • Constructor injection
  • Using a @Qualifier to select a bean by name
  • Spring stereotypes

Beans from annotations (under the hood)

  • Sample domain classes
  • Annotations
  • BeanRepository
  • ClasspathLoader
  • loadClassNames
  • getBeanClassNames

Database Access

Brief about JDBC

  • History
  • Drivers
  • JDBC URL
  • Connection
  • Statements
  • Prepared statements
  • Queries
  • Iterating over a result-set

Database Access via Spring JDBC

Using JDBC in Spring with JdbcTemplate and friends.

  • Spring JDBC module
  • Class JdbcTemplate
  • Configuring a DataSource
  • DriverManagerDataSource
  • Embedded database
  • H2 memory db
  • H2 file db
  • H2 server db
  • MySQL / PostgreSQL data sources
  • Query for a single value
  • Query for a multiple values
  • Query for a domain object
  • Handle not-found
  • Query for a Stream
  • Named query parameters
  • Usage of NamedParameterJdbcTemplate
  • Retrieve an auto-generated primary-key

Spring Boot

Presentation of Spring Boot and its relation to Spring Framework. Discussions of concepts such as starter dependencies and auto-configuration.

Spring Boot Overview

  • Why Spring Boot was created
  • What is Spring Boot more precisely
  • Version history
  • Spring Framework vs. Spring Boot
  • Spring Initializer
  • Spring Boot CLI
  • Started dependencies
  • Auto-configuration

Spring Native

  • What do we mean with native?
  • Graal VM
  • What is required to build a native image?
  • No dynamic class loading and how to deal with it
  • Spring Boot build plugin
  • How to build Spring app as a native image (a.k.a. executable)
  • Example

Configuration Properties

Different ways to provide configuration properties.

  • What is a configuration property
  • Application *.properties file
  • Standard Spring properties
  • Inject property to field
  • Inject group of properties to a bean
  • Inject all app properties
  • Standard type conversions
  • Using YaML (*.yml)
  • Override on the command-line
  • Override by an environment variable
  • Using application profiles
  • Profile-dependent property files
  • Generate build meta-data
  • Generate GIT meta-data

Using Lombok

  • What is Lombok
  • Generate getters & setters
  • Generate constructors
  • Builders
  • Generate toString() method
  • Generate equals() & hashCode() methods
  • Using @Data to bundle them all
  • Using @Value to create an immutable data-class

Spring Shell

  • What is Spring Shell?
  • Getting started
  • Simple usage
  • @ShellComponent
  • @ShellMethod
  • @ShellOption
  • Printing output using the Terminal bean
  • Using the shell builder
  • Built-in commands

Database access via JPA

How to use Spring JPA and auto-configuration.

  • What is JPA
  • What is ORM
  • What is JDO
  • Spring Data project
  • Spring Data JPA
  • Starter dependencies
  • Configure a data-source
  • JNDI data-source
  • Connection pool
  • Hikari CP
  • Entity class
  • JPA annotations
  • JPA repository interface
  • Auto-generated CRUD methods
  • Database initialization
  • Writing query auto-methods
  • Using the @Query annotation
  • Repository types
  • Pagination
  • Populating a database

SQL & DB access from annotations (under the hood)

  • Sample domain classes
  • Annotations
  • DAO factory
  • The magic behind this
  • SQL generators
  • Column descriptors
  • Helper methods
  • Handler implementations
  • Row mapper

Spring Web

HTTP Concepts

Brief about HTTP and web concepts in order to relate and put into context of the Spring Web Apps chapters of this course.

  • HTTP Request / response
  • HTTP operations (methods)
  • URI / path
  • MIME types
  • Response status codes
  • Cookies
  • Java servlet
  • HTTP session
  • JSP
  • Model-View-Controller (MVC)
  • AJAX
  • The new fetch API
  • REST web services
  • REST operations
  • Web app architectures
  • The classic multi-page app (MPA)
  • The hybrid multi-page app (Hybrid)
  • The modern single-page app (SPA)

Building a classic multi-page web app

Using Spring MVC with HTML views.

  • Creating a Spring Boot project
  • The Spring Web MVC architecture
  • Starter package
  • Understanding controllers and views
  • URI path composition
  • GET actions
  • View resolution and mapping
  • Path variables
  • Query parameters
  • Redirection
  • Assets files
  • Template engines
  • Brief about Thymeleaf
  • Using Mustache
  • Rendering a single object in Mustache
  • Rendering a list of objects in Mustache

Sending Data

  • Form data
  • POST actions
  • @RequestParam
  • Form data bean

Building an AJAX hybrid web app

Using Spring MVC with AJAX powered HTML views.

  • Creating a Spring Boot project
  • Changes of controllers
  • Changes of view pages
  • Controller-less views
  • Sample REST CRUD controller
  • JavaScript DAO service

Building a single-page web app

Using Spring REST as a microservice.

  • Creating a Spring Boot project
  • Changes of controllers and views
  • Run-time deployment of an SPA client
  • External SPA client
  • Configuring CORS
  • Internal SPA client
  • Spring configuration for an internal SPA client
  • SPA controller

Deployment

Best practices for deploying Spring apps.

  • Deployment options
  • Generating an executable JAR as a microservice
  • Generating a WAR for deployment to a servlet container
  • Working with configuration profiles
  • Brief about database schema migration tools