SlideShare a Scribd company logo
1 of 21
Download to read offline
BOOTylicious Spring
Karlo Novak, SV Group d.o.o.
karlo.novak@svgroup.hr
• Zašto Spring Boot?
• Standalone Spring aplikacije
• Konfiguracija
• Kako radi Spring Boot?
• Primjer REST servisa
• Spring Boot Actuator
• Testiranje
• Perspektiva
Sadržaj
• Standalone aplikacije s ugrađenim serverom
spremne za produkciju:
– Metrike, health checkovi, remote spajanje na
server (SSH, Telnet) itd.
– Mikroservisi
• Konfiguracija bez XML-a
• Starter POM-ovi, lakši dependency management
• Rješava Spring boilerplate
Zašto Spring Boot?
Standalone Spring aplikacije
java –jar app.jar
SpringBootServletInitializer
app.war
Konfiguracija (1/5)
• Maven starter POM-ovi, dependecy
management
• Autokonfiguracija bez XML-a
– Opinionated
• Jednostavan override auto konfiguracije
• Eksterna konfiguracija
Konfiguracija (2/5)
Starter POM
Konfiguracija (3/5)
• Starter POM-ovi pokrivaju većinu ovisnosti:
– spring-boot-starter
– spring-boot-starter-web
– spring-boot-starter-thymeleaf
– spring-boot-starter-data-jpa
– spring-boot-starter-redis
– spring-boot-starter-social-facebook
Konfiguracija (4/5)
• application.properties ili application.yml
– spring.profiles.active
– logging.path
– server.port
– server.context-path
– spring.datasource.url=jdbc:mysql://localhost/test
• @Value("${server.port}")
Konfiguracija (5/5)
Default
application.
properties
OS
Java
system
JNDI
Command
line
Kako radi Spring Boot?
• @EnableAutoConfiguration
– Skeniranje classpatha, zaključivanje, instanciranje
objekata
– Npr. ako na classpathu pronađe Thymeleaf
automatski će kreirati view i view resolver, te
Spring template engine
– Daje prednost user beanovima
• NE GENERIRA KOD
Primjer REST servisa
Spring Boot Actuator
• Nefunkcionalne pogodnosti za produkciju
• Dodaje HTTP endpointove:
– /beans
– /dump
– /health
– /info
– /metrics
– /trace
– /shutdown ...
Testiranje
• spring-boot-starter-test
• Spring Test, JUnit, Hamcrest, Mockito
• @SpringApplicationConfiguration
– Spring Boot konfiguracija ApplicationContext-a
• @IntegrationTest
– Za testiranje koristi embeddani server
Perspektiva
JHipster
Angular
Spring Boot
Netflix aktivno i intenzivno koristi
Spring Boot, uglavnom za razvoj
mikroservisa
I mi ga koristimo 
Nije mi to dosta
https://start.spring.io
Nije mi ni to dosta
• Spring Loaded
– Omogućuje hot reload aplikacije
– Prati promjene nad klasama, automatski ih
kompajlira i izmjenjuje
Dosta mi je..
https://github.com/spring-io/sagan
Zaključak
– Pojednostavljen razvoj
– Konfiguracija
– Fokus na aplikaciji
– Puštanje u produkciju
– Opinionated
– Deploy na aplikacijske
servere?
Spring Boot je i dalje Spring!
A sad vi...
karlo.novak@svgroup.hr

More Related Content

What's hot (6)

JavaCro'14 - Auditing of user activity through NoSQL database – Kristijan Duv...
JavaCro'14 - Auditing of user activity through NoSQL database – Kristijan Duv...JavaCro'14 - Auditing of user activity through NoSQL database – Kristijan Duv...
JavaCro'14 - Auditing of user activity through NoSQL database – Kristijan Duv...
 
(WS14) Tomislav Tipuric - Cloud kao aplikacijska platforma
(WS14) Tomislav Tipuric - Cloud kao aplikacijska platforma(WS14) Tomislav Tipuric - Cloud kao aplikacijska platforma
(WS14) Tomislav Tipuric - Cloud kao aplikacijska platforma
 
JavaCro'15 - Facebook Messenger Platform - Branimir Conjar, Krešimir Mišura
JavaCro'15 - Facebook Messenger Platform - Branimir Conjar, Krešimir MišuraJavaCro'15 - Facebook Messenger Platform - Branimir Conjar, Krešimir Mišura
JavaCro'15 - Facebook Messenger Platform - Branimir Conjar, Krešimir Mišura
 
Javantura Zagreb 2014 - Vert.x 1.3 - Mihovil Rister
Javantura Zagreb 2014 - Vert.x 1.3 - Mihovil RisterJavantura Zagreb 2014 - Vert.x 1.3 - Mihovil Rister
Javantura Zagreb 2014 - Vert.x 1.3 - Mihovil Rister
 
JavaCro'14 - Is there a single “correct” web architecture for business apps –...
JavaCro'14 - Is there a single “correct” web architecture for business apps –...JavaCro'14 - Is there a single “correct” web architecture for business apps –...
JavaCro'14 - Is there a single “correct” web architecture for business apps –...
 
Javantura Zagreb 2014 - Alfresco-Neo4j integracija - Damir Murat
Javantura Zagreb 2014 - Alfresco-Neo4j integracija - Damir MuratJavantura Zagreb 2014 - Alfresco-Neo4j integracija - Damir Murat
Javantura Zagreb 2014 - Alfresco-Neo4j integracija - Damir Murat
 

Viewers also liked (6)

JavaCro'15 - Slick database library - Ivan Senji
JavaCro'15 - Slick database library - Ivan SenjiJavaCro'15 - Slick database library - Ivan Senji
JavaCro'15 - Slick database library - Ivan Senji
 
JavaCro'15 - Utilize the full power of the web with Restlet - Matija Dujmović
JavaCro'15 - Utilize the full power of the web with Restlet - Matija DujmovićJavaCro'15 - Utilize the full power of the web with Restlet - Matija Dujmović
JavaCro'15 - Utilize the full power of the web with Restlet - Matija Dujmović
 
JavaCro'15 - Stuck in a tar pit - Vjeran Marčinko
JavaCro'15 - Stuck in a tar pit - Vjeran MarčinkoJavaCro'15 - Stuck in a tar pit - Vjeran Marčinko
JavaCro'15 - Stuck in a tar pit - Vjeran Marčinko
 
JavaCro'15 - Snappy Ubuntu Core - Gordan Krešić
JavaCro'15 - Snappy Ubuntu Core - Gordan KrešićJavaCro'15 - Snappy Ubuntu Core - Gordan Krešić
JavaCro'15 - Snappy Ubuntu Core - Gordan Krešić
 
JavaCro'15 - Single mail client for Lotus Domino and MS Exchange with Liferay...
JavaCro'15 - Single mail client for Lotus Domino and MS Exchange with Liferay...JavaCro'15 - Single mail client for Lotus Domino and MS Exchange with Liferay...
JavaCro'15 - Single mail client for Lotus Domino and MS Exchange with Liferay...
 
JavaCro'15 - Spring @Async - Dragan Juričić
JavaCro'15 - Spring @Async - Dragan JuričićJavaCro'15 - Spring @Async - Dragan Juričić
JavaCro'15 - Spring @Async - Dragan Juričić
 

More from HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association

More from HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association (20)

Java cro'21 the best tools for java developers in 2021 - hujak
Java cro'21   the best tools for java developers in 2021 - hujakJava cro'21   the best tools for java developers in 2021 - hujak
Java cro'21 the best tools for java developers in 2021 - hujak
 
JavaCro'21 - Java is Here To Stay - HUJAK Keynote
JavaCro'21 - Java is Here To Stay - HUJAK KeynoteJavaCro'21 - Java is Here To Stay - HUJAK Keynote
JavaCro'21 - Java is Here To Stay - HUJAK Keynote
 
Javantura v7 - Behaviour Driven Development with Cucumber - Ivan Lozić
Javantura v7 - Behaviour Driven Development with Cucumber - Ivan LozićJavantura v7 - Behaviour Driven Development with Cucumber - Ivan Lozić
Javantura v7 - Behaviour Driven Development with Cucumber - Ivan Lozić
 
Javantura v7 - The State of Java - Today and Tomowwow - HUJAK's Community Key...
Javantura v7 - The State of Java - Today and Tomowwow - HUJAK's Community Key...Javantura v7 - The State of Java - Today and Tomowwow - HUJAK's Community Key...
Javantura v7 - The State of Java - Today and Tomowwow - HUJAK's Community Key...
 
Javantura v7 - Learning to Scale Yourself: The Journey from Coder to Leader -...
Javantura v7 - Learning to Scale Yourself: The Journey from Coder to Leader -...Javantura v7 - Learning to Scale Yourself: The Journey from Coder to Leader -...
Javantura v7 - Learning to Scale Yourself: The Journey from Coder to Leader -...
 
JavaCro'19 - The State of Java and Software Development in Croatia - Communit...
JavaCro'19 - The State of Java and Software Development in Croatia - Communit...JavaCro'19 - The State of Java and Software Development in Croatia - Communit...
JavaCro'19 - The State of Java and Software Development in Croatia - Communit...
 
Javantura v6 - Java in Croatia and HUJAK - Branko Mihaljević, Aleksander Radovan
Javantura v6 - Java in Croatia and HUJAK - Branko Mihaljević, Aleksander RadovanJavantura v6 - Java in Croatia and HUJAK - Branko Mihaljević, Aleksander Radovan
Javantura v6 - Java in Croatia and HUJAK - Branko Mihaljević, Aleksander Radovan
 
Javantura v6 - On the Aspects of Polyglot Programming and Memory Management i...
Javantura v6 - On the Aspects of Polyglot Programming and Memory Management i...Javantura v6 - On the Aspects of Polyglot Programming and Memory Management i...
Javantura v6 - On the Aspects of Polyglot Programming and Memory Management i...
 
Javantura v6 - Case Study: Marketplace App with Java and Hyperledger Fabric -...
Javantura v6 - Case Study: Marketplace App with Java and Hyperledger Fabric -...Javantura v6 - Case Study: Marketplace App with Java and Hyperledger Fabric -...
Javantura v6 - Case Study: Marketplace App with Java and Hyperledger Fabric -...
 
Javantura v6 - How to help customers report bugs accurately - Miroslav Čerkez...
Javantura v6 - How to help customers report bugs accurately - Miroslav Čerkez...Javantura v6 - How to help customers report bugs accurately - Miroslav Čerkez...
Javantura v6 - How to help customers report bugs accurately - Miroslav Čerkez...
 
Javantura v6 - When remote work really works - the secrets behind successful ...
Javantura v6 - When remote work really works - the secrets behind successful ...Javantura v6 - When remote work really works - the secrets behind successful ...
Javantura v6 - When remote work really works - the secrets behind successful ...
 
Javantura v6 - Kotlin-Java Interop - Matej Vidaković
Javantura v6 - Kotlin-Java Interop - Matej VidakovićJavantura v6 - Kotlin-Java Interop - Matej Vidaković
Javantura v6 - Kotlin-Java Interop - Matej Vidaković
 
Javantura v6 - Spring HATEOAS hypermedia-driven web services, and clients tha...
Javantura v6 - Spring HATEOAS hypermedia-driven web services, and clients tha...Javantura v6 - Spring HATEOAS hypermedia-driven web services, and clients tha...
Javantura v6 - Spring HATEOAS hypermedia-driven web services, and clients tha...
 
Javantura v6 - End to End Continuous Delivery of Microservices for Kubernetes...
Javantura v6 - End to End Continuous Delivery of Microservices for Kubernetes...Javantura v6 - End to End Continuous Delivery of Microservices for Kubernetes...
Javantura v6 - End to End Continuous Delivery of Microservices for Kubernetes...
 
Javantura v6 - Istio Service Mesh - The magic between your microservices - Ma...
Javantura v6 - Istio Service Mesh - The magic between your microservices - Ma...Javantura v6 - Istio Service Mesh - The magic between your microservices - Ma...
Javantura v6 - Istio Service Mesh - The magic between your microservices - Ma...
 
Javantura v6 - How can you improve the quality of your application - Ioannis ...
Javantura v6 - How can you improve the quality of your application - Ioannis ...Javantura v6 - How can you improve the quality of your application - Ioannis ...
Javantura v6 - How can you improve the quality of your application - Ioannis ...
 
Javantura v6 - Just say it v2 - Pavao Varela Petrac
Javantura v6 - Just say it v2 - Pavao Varela PetracJavantura v6 - Just say it v2 - Pavao Varela Petrac
Javantura v6 - Just say it v2 - Pavao Varela Petrac
 
Javantura v6 - Automation of web apps testing - Hrvoje Ruhek
Javantura v6 - Automation of web apps testing - Hrvoje RuhekJavantura v6 - Automation of web apps testing - Hrvoje Ruhek
Javantura v6 - Automation of web apps testing - Hrvoje Ruhek
 
Javantura v6 - Master the Concepts Behind the Java 10 Challenges and Eliminat...
Javantura v6 - Master the Concepts Behind the Java 10 Challenges and Eliminat...Javantura v6 - Master the Concepts Behind the Java 10 Challenges and Eliminat...
Javantura v6 - Master the Concepts Behind the Java 10 Challenges and Eliminat...
 
Javantura v6 - Building IoT Middleware with Microservices - Mario Kusek
Javantura v6 - Building IoT Middleware with Microservices - Mario KusekJavantura v6 - Building IoT Middleware with Microservices - Mario Kusek
Javantura v6 - Building IoT Middleware with Microservices - Mario Kusek
 

JavaCro'15 - BOOTylicious Spring - Karlo Novak