19
Getting Familiar with Spring Boot Mattias Severson 17th March 2015

"Getting familiar with Spring Boot", jDays 2015 Speaker: "Mattias Severson"

Embed Size (px)

Citation preview

Getting Familiar with Spring BootMattias Severson17th March 2015

Mattias

@mattiasseverson

http://jayway.com/author/mattiasseverson/

Agenda• Spring Boot

• Getting Started

• Micro Service

• Production Ready Features

• and more…

Spring Boot?Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that you can "just run". We take an opinionated view of the Spring platform and third-party libraries so you can get started with minimum fuss.

Requirements

• Recommended to use Java 8

• Default support of Java 7

• Can use Java 6 with some config

Maturity• Announced in Sept 2013

• 1.0 released April 2014

• Latest release 1.2.2 February 2015

• Built on Spring 4.1.x

Spring Initializr

http://start.spring.io/

Starter POMsspring-boot-starter-*

• spring-boot-starter-web

• spring-boot-starter-security

• spring-boot-starter-data-mongodb

• spring-boot-starter-websocket

• spring-boot-starter-social-facebook

• 40+ in total

Bean Magic

@SpringBootApplication

@Configuration

@ComponentScan

@EnableAutoConfiguration

@EnableAutoConfiguration

@Conditional

@ConditionalOnClass

@ConditionalOnBean

@ConditionalOnMissingBean

Micro Service

• Little (own) code required

• ~10 MB disc (incl Embedded Tomcat)

• ~300 MB memory (incl Tomcat)

Production Ready

“Feature complete” is not the same as “production ready”

Actuator• Metrics

• Health Check

• Environment

• Trace

• …

Logging

• Logback by default

• Log rotation

• Predefined format

• Configurable location and filename

Configurable• server.port=8090

• server.session-timeout=30

• security.user.name=admin

• spring.http.gzip.*

• and much more…

More Features• Externalized Configuration

• CommandLineRunner

• Application Events and Listeners

• MessageChannel

• DB Schema Migration

• …

View SupportSupported Template Engines:

• FreeMarker

• Groovy Templates

• Thymeleaf

• Velocity

• Mustache

ReferencesSpring Initializr http://start.spring.io/Spring Guides http://spring.io/guides/

Spring Boot Reference Guide

http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/

@mattiasseverson

http://jayway.com/author/mattiasseverson/