Slide 1

Slide 1 text

Spring Boot

Slide 2

Slide 2 text

What does it take to implement a Java Web Application?

Slide 3

Slide 3 text

Any non-Java guys in the room?

Slide 4

Slide 4 text

Java AppServer Libraries Build WAR

Slide 5

Slide 5 text

Java AppServer Libraries Build WAR #SRSLY?

Slide 6

Slide 6 text

Enter Spring Boot

Slide 7

Slide 7 text

Spring Boot Demo

Slide 8

Slide 8 text

Spring Boot Main @EnableAutoConfiguration @ComponentScan public class Main { public static void main(String[] args) { SpringApplication.run(Main.class, args); } }   Enable Spring Boot Configuration e.g. Web environment etc Scan for Spring annotations e.g. @Component @Configuration etc In this package and all sub packages Start application e.g. Tomcat, Spring web environment etc @SpringBootApplication = @ComponentScan+ @EnableAutoConfiguration+ @Configuration

Slide 9

Slide 9 text

Spring Boot: Maven pom.xml org.springframework.boot spring-boot-starter-parent 1.2.1.RELEASE org.springframework.boot spring-boot-starter-web ... Configuration inherits from parent Sets versions for dependencies Add all needed libs for a web app Many starters available

Slide 10

Slide 10 text

Spring Boot: Maven pom.xml ... org.springframework.boot spring-boot-maven-plugin   Makes WAR / JAR executable Support mvn spring-boot:run to run the app

Slide 11

Slide 11 text

Spring Boot §  Build much easier §  Supports Gradle & Ant, too §  Not limited to simple application §  Can add any other library §  Application much easier to test, debug etc §  Simple code

Slide 12

Slide 12 text

Let‘s add Spring Data JPA!

Slide 13

Slide 13 text

Spring Data JPA §  Makes implementation of repositories trivial §  Just provide an interface §  Needs JPA infrastructure of course

Slide 14

Slide 14 text

Spring Data JPA Repository public interface CustomerRepository extends JpaRepository { List findByName(String name); }   Defines all basic CRUD (Create, Read, Update, Delete) operations Implementation created by naming convention Add Spring Boot Starter Data JPA No further configuration Without Spring Boot or @EnableJpaRepositories("de.project")

Slide 15

Slide 15 text

Spring Boot + Spring Data JPA Demo

Slide 16

Slide 16 text

Behind the Scenes §  DataSource for HSQL created §  JPA infrastructure created §  Thymeleaf infrastructure created §  How does it work? §  Convention over configuration

Slide 17

Slide 17 text

Spring Boot §  Creates sensible infrastructure defaults §  i.e. DataSource if HSQL is on the classpath §  Done by *AutoConfiguration classes

Slide 18

Slide 18 text

Spring Boot Starter amqp aop batch data-jpa data-mongodb data-rest integration jdbc mobile redis security test web websocket actuator remote-shell jetty tomcat log4j logback data-solr data-elasticsearch data-gemfire groovy-templates freemarker thymeleaf mustache undertow velocity social-facebook social-linkedin social-twitter

Slide 19

Slide 19 text

Dev §  Turn Around §  Thymeleaf Templates can be changed on the fly §  …same with class files §  Spring Loaded makes reloading more powerful

Slide 20

Slide 20 text

Spring Boot for Dev Demo

Slide 21

Slide 21 text

Spring Boot for Ops

Slide 22

Slide 22 text

CRaSH Shell §  Ever ssh’d into your application? §  Enter CRaSH §  External library integrated into Spring Boot §  Alternative approach to operations

Slide 23

Slide 23 text

Spring Boot CRaSH Demo

Slide 24

Slide 24 text

Actuator §  Provide information about the application §  Via http / JSON §  Can be evaluated by monitoring tools etc. §  Another alternative approach to monitoring

Slide 25

Slide 25 text

Spring Boot Actuator Demo

Slide 26

Slide 26 text

Deploy §  Just package everything in an executable JAR §  …or a WAR §  Based on Maven or Gradle §  Build in configuration (YAML, properties etc.)

Slide 27

Slide 27 text

Spring Boot Deploy Demo

Slide 28

Slide 28 text

What‘s next? Spring Cloud §  Technologies for Micro Services §  E.g. Configuration §  Resilience §  Netflix stack §  Cloud Bus §  Cloud Security §  Based on Spring Boot

Slide 29

Slide 29 text

Conclusion §  Easy to start §  Can add libraries and features as needed §  Dev: Quick turn around §  Ops: Integrated monitoring §  Ops: Easy deployment §  Didn’t show Groovy support

Slide 30

Slide 30 text

Spring Boot & Microservices §  Simplifies deployment §  Standardizes Ops interface §  Simplify creating REST / web applications

Slide 31

Slide 31 text

Links http://start.spring.io/ http://projects.spring.io/spring-boot/ https://github.com/spring-projects/spring- boot https://github.com/ewolff/spring-boot- demos https://spring.io/guides/gs/spring-boot/ https://spring.io/guides/gs/actuator-service/ https://spring.io/guides/gs/spring-boot-cli- and-js/