SlideShare a Scribd company logo
SPRING BOOT
HONGSEONG JEON
HSJEON70@GMAIL.COM
MAY 24, 2016
Easy to create, run spring applications
INTRODUCING SPRING BOOT
 Easy to create stand-alone, production-grade Spring based
applications that you can “just run”.
 It needs very little spring configuration.
 Create Java applications that can be started using java –jar or
more traditional war deployments.
 Primary goals for the Spring Boot.
 Provide a radically faster and widely accessible getting started
experience for all Spring development.
 Be opinionated out of the box, but get out of the way quickly as
requirements start to diverge from the defaults.
 Provide a range of non-functional features that are common to
large classes of projects (e.g.embedded servers, security,
metrics, health checks, externalized configuration).
 Absolutely no code generation and no requirement for XML
configuration.
SYSTEM REQUIREMENTS
 Spring Boot 1.4.0 requires Java 7 and Spring Framework 4.1.5
or above.
 Servlet containers
 Servlet 3.0+ compatible container
DEVELOPMENT ENVIRONMENT
 Build tool that supports dependency management
 Maven – maven.apache.org
 Gradle – www.gradle.org
 Development IDE
 Eclipse or Any Editor
 Eclipse plugin
- m2ecipse
- gradle
SIMPLE APPLICATION
 New Gradle Project
 Create HelloApplication
SIMPLE APPLICATION
 Create HelloController
 Create application.properties in the resources
SIMPLE APPLICATION
 Run HelloApplication at the eclipse
 Run http://localhost:8010/hello
SPRING BOOT ADMIN
 Spring Boot Admin is a simple application to manage and
monitor your Spring Boot Applications.
 The applications register with our Spring Boot Admin Client
(via http) or are discovered using Spring Cloud (e.g. Eureka).
SPRING BOOT ADMIN APPLICATION
 Create New Gradle Project
 Add spring boot server libraries to project dependencies.
 Create SpringBootAdminApplication
dependencies {
compile 'de.codecentric:spring-boot-admin-server:1.3.2'
compile 'de.codecentric:spring-boot-admin-server-ui:1.3.2'
compile 'org.springframework.boot:spring-boot-starter-web:1.3.1.RELEASE'
}
SPRING BOOT ADMIN APPLICATION
 Application properties
# =======================
# Tomcat Configuration
# =======================
server.tomcat.max-threads=10
server.address=127.0.0.1
server.port=9090
# =======================
# Security Configuration
# =======================
security.user.name=admin
security.user.password=admin
management.security.role=SUPERUSER
management.security.enabled=false
SPRING BOOT ADMIN CLIENT
 Add spring-boot-admin-starter-client to project dependencies.
 Add run task in the build.gradle
dependencies {
compile 'de.codecentric:spring-boot-admin-starter-client:1.3.2‘
compile 'org.springframework.boot:spring-boot-starter-web:1.3.1.RELEASE'
}
task run (dependsOn: classes, type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
main = 'com.example.myproject.HelloApplication'
}
SPRING BOOT ADMIN CLIENT
 Add spring boot admin properties in the application.properties
# Tomcat Configuration
server.address=127.0.0.1
server.port=8010
# =======================
# JMX Configuration
#management.port=8011
#management.address=127.0.0.1
management.security.role=SUPERUSER
management.security.enabled=false
# ============================================
# Client Configuration for Spring Boot Admin
info.version=1.0
info.info=spring boot hello application
spring.boot.admin.client.name=hello
spring.boot.admin.url=http://127.0.0.1:9090
spring.boot.admin.username=admin
spring.boot.admin.password=admin
spring.boot.admin.client.health-url=http://localhost:8010/health
spring.boot.admin.client.service-url=http://localhost:8010
spring.boot.admin.client.management-url=http://localhost:8010
SPRING BOOT ADMIN TESTING
 Run HelloApplication
SPRING BOOT ADMIN TESTING
 Run SpringBootAdminApplication
 http://localhost:9090/
 Application Dashboard
SPRING BOOT ADMIN
 Applications Details
SPRING BOOT ADMIN
 Application Details
SPRING BOOT ADMIN
 Application Environment
SPRING BOOT ADMIN
 Application Logging
SPRING BOOT ADMIN
 Application JMX
SPRING BOOT ADMIN
 Application Threads
SPRING BOOT ADMIN
 Application Trace
DATABASE CONFIGURATION
 H2 Database
 H2 is written in Java and is easily runs as an embedded in-
memory database.
 Because it is an embedded in memory database, it makes your
build portable.
 H2 Database and Spring Boot
 By adding this dependency to your gradle, Sring Boot will
automatically configure the H2 database.
 JDBC DataSource Configuration in the application.properties.
dependencies {
compile 'com.h2database:h2'
}
spring.datasource.jndi-name=java:jboss/datasources/customers
DATABASE CONFIGURATION
 JDBC DataSource Configuration in the application.properties
# ===============================
# = DATA SOURCE
# ===============================
# Set here configurations for the database connection
spring.datasource.url = jdbc:h2:d:/applications/springBoot/data/boot.db
# JDBC Driver class
spring.datasource.driver-class-name=org.h2.Driver
# Username and password
spring.datasource.username = sa
spring.datasource.password = sa
# Keep the connection alive if idle for a long time (needed in production)
spring.datasource.testWhileIdle = true
spring.datasource.validationQuery = SELECT 1
# Number of ms to wait before throwing an exception if no connection is available.
spring.datasource.max-wait=10000
# Maximum number of active connections that can be allocated from this pool at the same
time.
spring.datasource.max-active=50
# Validate the connection before borrowing it from the pool.
spring.datasource.test-on-borrow=true
DATABASE CONFIGURATION
 H2 Database Web Console
 Enable H2 Database Web Console in the application.properties
 H2 Database Web Console : http://${serviceUrl}/h2-console/
# Enable H2 Database Web Console
spring.h2.console.enabled=true
DATABASE CONFIGURATION
 Spring Boot Admin – Database Monitoring
SPRING DATA JPA
 Using Spring Data JPA can save you a lot of time when
interacting with the database.
 Spring Data JPA implements the Repository Pattern.
 Domain Driven Design
 Create a Persistence Repository
 Defining a repository for our City domain class is as simple as
defining a interface and extending the CrudRepository
interface.
SPRING DATA JPA
 Create a City Loader component
SPRING DATA JPA
 Run Application
SPRING DATA JPA
 Confirm loaded data
SPRING REST CONTROLLER
 Create a CityService interface
 Create a CityServiceImpl class
SPRING REST CONTROLLER
 Create a CityController
 Testing
SPRING BOOT EHCACHE
 Gradle Dependency for ehcache
 Ehcache configuration – config/ehcache.xml
dependencies {
compile 'net.sf.ehcache:ehcache-core:2.6.10'
}
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-
instance"xsi:noNamespaceSchemaLocation="ehcache.xsd"
updateCheck="true"monitoring="autodetect"dynamicConfig="true" statistics="true">
<diskStore path="java.io.tmpdir" />
<cache name="myCache"
maxEntriesLocalHeap="5000“ maxEntriesLocalDisk="1000" eternal="false"
diskSpoolBufferSizeMB="20“ timeToIdleSeconds="300"
timeToLiveSeconds="600“ memoryStoreEvictionPolicy="LFU"
transactionalMode="off">
<persistence strategy="localTempSwap" />
</cache>
</ehcache>
SPRING BOOT EHCACHE
 Enable Cache and Define a CacheManager bean in the
Application class.
SPRING BOOT EHCACHE
 Apply Cacheable annotation
 Run and Testing
SPRING BOOT EHCACHE
 Ehcache Statistics on the Spring Boot Admin
SPRING BOOT WEB APPLICATION
 Thymeleaf is a modern server-side Java template engine for
both web and standalone environments.
 Thymeleaf is ideal for modern-day HTML5 JVM web
development
 http://www.thymeleaf.org/
 Gradle Dependency for Thymeleaf
 Create a HelloController
dependencies {
compile 'org.springframework.boot:spring-boot-starter-thymeleaf'
}
SPRING BOOT WEB APPLICATION
 Create a greeting.html
 src/main/resources/templates/greeting.html
 Run and Testing
<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<title>Getting Started: Serving Web Content</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<p th:text="'Hello, ' + ${name} + '!'" />
</body>
</html>
SPRING BOOT WEB APPLICATION
 Spring Boot Admin – HTTP API Monitoring
SPRING BOOT APPLICATION
 Project Package Layout
Spring Boot main application class
 Resources Layout
REFERENCES
 https://projects.spring.io/spring-framework/
 http://projects.spring.io/spring-boot/
 http://codecentric.github.io/spring-boot-admin/1.3.0/
 http://www.thymeleaf.org/
 http://gradle.org/
 http://www.h2database.com/html/main.html
 Example projects repository
- https://bitbucket.org/jlookexamples/examples-spring-boot-admin
- https://bitbucket.org/jlookexamples/examples-spring-boot
- https://bitbucket.org/jlookexamples/examples-hello
Q & A

More Related Content

What's hot

Spring Boot
Spring BootSpring Boot
Spring Boot
Pei-Tang Huang
 
Spring Boot Tutorial
Spring Boot TutorialSpring Boot Tutorial
Spring Boot Tutorial
Naphachara Rattanawilai
 
Spring boot Introduction
Spring boot IntroductionSpring boot Introduction
Spring boot Introduction
Jeevesh Pandey
 
Spring boot
Spring bootSpring boot
Spring boot
sdeeg
 
PUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBootPUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBoot
Josué Neis
 
Spring boot - an introduction
Spring boot - an introductionSpring boot - an introduction
Spring boot - an introduction
Jonathan Holloway
 
Xke spring boot
Xke spring bootXke spring boot
Xke spring boot
sourabh aggarwal
 
Spring boot
Spring bootSpring boot
Spring boot
Pradeep Shanmugam
 
Introduction to Spring Boot
Introduction to Spring BootIntroduction to Spring Boot
Introduction to Spring Boot
Purbarun Chakrabarti
 
Spring Framework
Spring FrameworkSpring Framework
Spring Framework
NexThoughts Technologies
 
Introduction to Spring Framework and Spring IoC
Introduction to Spring Framework and Spring IoCIntroduction to Spring Framework and Spring IoC
Introduction to Spring Framework and Spring IoC
Funnelll
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
Serhat Can
 
Spring Framework - Core
Spring Framework - CoreSpring Framework - Core
Spring Framework - Core
Dzmitry Naskou
 
Spring Framework
Spring Framework  Spring Framework
Spring Framework
tola99
 
Spring Security
Spring SecuritySpring Security
Spring Security
Knoldus Inc.
 
Spring boot
Spring bootSpring boot
Spring boot
Bhagwat Kumar
 
Spring Framework - AOP
Spring Framework - AOPSpring Framework - AOP
Spring Framework - AOP
Dzmitry Naskou
 
Maven Introduction
Maven IntroductionMaven Introduction
Maven Introduction
Sandeep Chawla
 
Introduction to Spring Boot!
Introduction to Spring Boot!Introduction to Spring Boot!
Introduction to Spring Boot!
Jakub Kubrynski
 
Spring boot jpa
Spring boot jpaSpring boot jpa
Spring boot jpa
Hamid Ghorbani
 

What's hot (20)

Spring Boot
Spring BootSpring Boot
Spring Boot
 
Spring Boot Tutorial
Spring Boot TutorialSpring Boot Tutorial
Spring Boot Tutorial
 
Spring boot Introduction
Spring boot IntroductionSpring boot Introduction
Spring boot Introduction
 
Spring boot
Spring bootSpring boot
Spring boot
 
PUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBootPUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBoot
 
Spring boot - an introduction
Spring boot - an introductionSpring boot - an introduction
Spring boot - an introduction
 
Xke spring boot
Xke spring bootXke spring boot
Xke spring boot
 
Spring boot
Spring bootSpring boot
Spring boot
 
Introduction to Spring Boot
Introduction to Spring BootIntroduction to Spring Boot
Introduction to Spring Boot
 
Spring Framework
Spring FrameworkSpring Framework
Spring Framework
 
Introduction to Spring Framework and Spring IoC
Introduction to Spring Framework and Spring IoCIntroduction to Spring Framework and Spring IoC
Introduction to Spring Framework and Spring IoC
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
 
Spring Framework - Core
Spring Framework - CoreSpring Framework - Core
Spring Framework - Core
 
Spring Framework
Spring Framework  Spring Framework
Spring Framework
 
Spring Security
Spring SecuritySpring Security
Spring Security
 
Spring boot
Spring bootSpring boot
Spring boot
 
Spring Framework - AOP
Spring Framework - AOPSpring Framework - AOP
Spring Framework - AOP
 
Maven Introduction
Maven IntroductionMaven Introduction
Maven Introduction
 
Introduction to Spring Boot!
Introduction to Spring Boot!Introduction to Spring Boot!
Introduction to Spring Boot!
 
Spring boot jpa
Spring boot jpaSpring boot jpa
Spring boot jpa
 

Viewers also liked

Getting Started with Spring Boot
Getting Started with Spring BootGetting Started with Spring Boot
Getting Started with Spring Boot
David Kiss
 
Workshop Spring - Session 1 - L'offre Spring et les bases
Workshop Spring  - Session 1 - L'offre Spring et les basesWorkshop Spring  - Session 1 - L'offre Spring et les bases
Workshop Spring - Session 1 - L'offre Spring et les bases
Antoine Rey
 
Spring Boot with Quartz
Spring Boot with QuartzSpring Boot with Quartz
Spring Boot with Quartz
David Kiss
 
REST - the good and the bad parts
REST - the good and the bad partsREST - the good and the bad parts
REST - the good and the bad parts
Jakub Kubrynski
 
REST - the good and the bad parts
REST - the good and the bad partsREST - the good and the bad parts
REST - the good and the bad parts
Jakub Kubrynski
 
Quartz: What is it?
Quartz: What is it?Quartz: What is it?
Quartz: What is it?
alesialucy14
 
Spring 3 to 4
Spring 3 to 4Spring 3 to 4
Spring 3 to 4
Sumit Gole
 
-XX:+UseG1GC
-XX:+UseG1GC-XX:+UseG1GC
-XX:+UseG1GC
Jakub Kubrynski
 
JVM Dive for mere mortals
JVM Dive for mere mortalsJVM Dive for mere mortals
JVM Dive for mere mortals
Jakub Kubrynski
 
Spring IO - Spring Boot for DevOps
Spring IO - Spring Boot for DevOpsSpring IO - Spring Boot for DevOps
Spring IO - Spring Boot for DevOps
Nicolas Fränkel
 
Spring 4 final xtr_presentation
Spring 4 final xtr_presentationSpring 4 final xtr_presentation
Spring 4 final xtr_presentation
sourabh aggarwal
 
Centralized Application Configuration with Spring and Apache Zookeeper
Centralized Application Configuration with Spring and Apache ZookeeperCentralized Application Configuration with Spring and Apache Zookeeper
Centralized Application Configuration with Spring and Apache Zookeeper
Ryan Gardner
 
Spring Mvc
Spring MvcSpring Mvc
Spring Mvc
ifnu bima
 
Shootout! template engines on the jvm
Shootout! template engines on the jvmShootout! template engines on the jvm
Shootout! template engines on the jvm
NLJUG
 
Introduction to Spring Boot
Introduction to Spring BootIntroduction to Spring Boot
Introduction to Spring Boot
Trey Howard
 
Introduction To Angular.js - SpringPeople
Introduction To Angular.js - SpringPeopleIntroduction To Angular.js - SpringPeople
Introduction To Angular.js - SpringPeople
SpringPeople
 
Spring framework core
Spring framework coreSpring framework core
Spring framework core
Taemon Piya-Lumyong
 
SpringPeople Introduction to Spring Framework
SpringPeople Introduction to Spring FrameworkSpringPeople Introduction to Spring Framework
SpringPeople Introduction to Spring Framework
SpringPeople
 
the Spring 4 update
the Spring 4 updatethe Spring 4 update
the Spring 4 update
Joshua Long
 
Spring 4 - A&BP CC
Spring 4 - A&BP CCSpring 4 - A&BP CC
Spring 4 - A&BP CC
JWORKS powered by Ordina
 

Viewers also liked (20)

Getting Started with Spring Boot
Getting Started with Spring BootGetting Started with Spring Boot
Getting Started with Spring Boot
 
Workshop Spring - Session 1 - L'offre Spring et les bases
Workshop Spring  - Session 1 - L'offre Spring et les basesWorkshop Spring  - Session 1 - L'offre Spring et les bases
Workshop Spring - Session 1 - L'offre Spring et les bases
 
Spring Boot with Quartz
Spring Boot with QuartzSpring Boot with Quartz
Spring Boot with Quartz
 
REST - the good and the bad parts
REST - the good and the bad partsREST - the good and the bad parts
REST - the good and the bad parts
 
REST - the good and the bad parts
REST - the good and the bad partsREST - the good and the bad parts
REST - the good and the bad parts
 
Quartz: What is it?
Quartz: What is it?Quartz: What is it?
Quartz: What is it?
 
Spring 3 to 4
Spring 3 to 4Spring 3 to 4
Spring 3 to 4
 
-XX:+UseG1GC
-XX:+UseG1GC-XX:+UseG1GC
-XX:+UseG1GC
 
JVM Dive for mere mortals
JVM Dive for mere mortalsJVM Dive for mere mortals
JVM Dive for mere mortals
 
Spring IO - Spring Boot for DevOps
Spring IO - Spring Boot for DevOpsSpring IO - Spring Boot for DevOps
Spring IO - Spring Boot for DevOps
 
Spring 4 final xtr_presentation
Spring 4 final xtr_presentationSpring 4 final xtr_presentation
Spring 4 final xtr_presentation
 
Centralized Application Configuration with Spring and Apache Zookeeper
Centralized Application Configuration with Spring and Apache ZookeeperCentralized Application Configuration with Spring and Apache Zookeeper
Centralized Application Configuration with Spring and Apache Zookeeper
 
Spring Mvc
Spring MvcSpring Mvc
Spring Mvc
 
Shootout! template engines on the jvm
Shootout! template engines on the jvmShootout! template engines on the jvm
Shootout! template engines on the jvm
 
Introduction to Spring Boot
Introduction to Spring BootIntroduction to Spring Boot
Introduction to Spring Boot
 
Introduction To Angular.js - SpringPeople
Introduction To Angular.js - SpringPeopleIntroduction To Angular.js - SpringPeople
Introduction To Angular.js - SpringPeople
 
Spring framework core
Spring framework coreSpring framework core
Spring framework core
 
SpringPeople Introduction to Spring Framework
SpringPeople Introduction to Spring FrameworkSpringPeople Introduction to Spring Framework
SpringPeople Introduction to Spring Framework
 
the Spring 4 update
the Spring 4 updatethe Spring 4 update
the Spring 4 update
 
Spring 4 - A&BP CC
Spring 4 - A&BP CCSpring 4 - A&BP CC
Spring 4 - A&BP CC
 

Similar to Spring Boot

Rediscovering Spring with Spring Boot(1)
Rediscovering Spring with Spring Boot(1)Rediscovering Spring with Spring Boot(1)
Rediscovering Spring with Spring Boot(1)
Gunith Devasurendra
 
SpringBootCompleteBootcamp.pptx
SpringBootCompleteBootcamp.pptxSpringBootCompleteBootcamp.pptx
SpringBootCompleteBootcamp.pptx
SUFYAN SATTAR
 
dokumen.tips_rediscovering-spring-with-spring-boot1 (1).pdf
dokumen.tips_rediscovering-spring-with-spring-boot1 (1).pdfdokumen.tips_rediscovering-spring-with-spring-boot1 (1).pdf
dokumen.tips_rediscovering-spring-with-spring-boot1 (1).pdf
Appster1
 
dokumen.tips_rediscovering-spring-with-spring-boot1.pdf
dokumen.tips_rediscovering-spring-with-spring-boot1.pdfdokumen.tips_rediscovering-spring-with-spring-boot1.pdf
dokumen.tips_rediscovering-spring-with-spring-boot1.pdf
Appster1
 
Deploying applications to Cloud with Google App Engine
Deploying applications to Cloud with Google App EngineDeploying applications to Cloud with Google App Engine
Deploying applications to Cloud with Google App Engine
Alexander Zamkovyi
 
Spring Performance Gains
Spring Performance GainsSpring Performance Gains
Spring Performance Gains
VMware Tanzu
 
Spring Boot Whirlwind Tour
Spring Boot Whirlwind TourSpring Boot Whirlwind Tour
Spring Boot Whirlwind Tour
VMware Tanzu
 
springmvc-150923124312-lva1-app6892
springmvc-150923124312-lva1-app6892springmvc-150923124312-lva1-app6892
springmvc-150923124312-lva1-app6892
Tuna Tore
 
Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5
Tuna Tore
 
Building a Spring Boot Application - Ask the Audience! (from JVMCon 2018)
Building a Spring Boot Application - Ask the Audience! (from JVMCon 2018)Building a Spring Boot Application - Ask the Audience! (from JVMCon 2018)
Building a Spring Boot Application - Ask the Audience! (from JVMCon 2018)
🎤 Hanno Embregts 🎸
 
Building a Spring Boot Application - Ask the Audience!
Building a Spring Boot Application - Ask the Audience!Building a Spring Boot Application - Ask the Audience!
Building a Spring Boot Application - Ask the Audience!
🎤 Hanno Embregts 🎸
 
Spring Boot
Spring BootSpring Boot
Spring Boot
Jaydeep Kale
 
Modular Test-driven SPAs with Spring and AngularJS
Modular Test-driven SPAs with Spring and AngularJSModular Test-driven SPAs with Spring and AngularJS
Modular Test-driven SPAs with Spring and AngularJS
Gunnar Hillert
 
dokumen.tips_introduction-to-spring-boot-58bb649a21ce5.pptx
dokumen.tips_introduction-to-spring-boot-58bb649a21ce5.pptxdokumen.tips_introduction-to-spring-boot-58bb649a21ce5.pptx
dokumen.tips_introduction-to-spring-boot-58bb649a21ce5.pptx
Appster1
 
Rest web service_with_spring_hateoas
Rest web service_with_spring_hateoasRest web service_with_spring_hateoas
Rest web service_with_spring_hateoas
Zeid Hassan
 
Building microservices sample application
Building microservices sample applicationBuilding microservices sample application
Building microservices sample application
Anil Allewar
 
Module 6 _ Spring Boot for java application to begin
Module 6 _ Spring Boot for java application to beginModule 6 _ Spring Boot for java application to begin
Module 6 _ Spring Boot for java application to begin
Deepakprasad838637
 
Google App Engine overview (GAE/J)
Google App Engine overview (GAE/J)Google App Engine overview (GAE/J)
Google App Engine overview (GAE/J)
Moch Nasrullah Rahmani
 
Spring and DWR
Spring and DWRSpring and DWR
Spring and DWR
wiradikusuma
 
JSS build and deployment
JSS build and deploymentJSS build and deployment
JSS build and deployment
David Szöke
 

Similar to Spring Boot (20)

Rediscovering Spring with Spring Boot(1)
Rediscovering Spring with Spring Boot(1)Rediscovering Spring with Spring Boot(1)
Rediscovering Spring with Spring Boot(1)
 
SpringBootCompleteBootcamp.pptx
SpringBootCompleteBootcamp.pptxSpringBootCompleteBootcamp.pptx
SpringBootCompleteBootcamp.pptx
 
dokumen.tips_rediscovering-spring-with-spring-boot1 (1).pdf
dokumen.tips_rediscovering-spring-with-spring-boot1 (1).pdfdokumen.tips_rediscovering-spring-with-spring-boot1 (1).pdf
dokumen.tips_rediscovering-spring-with-spring-boot1 (1).pdf
 
dokumen.tips_rediscovering-spring-with-spring-boot1.pdf
dokumen.tips_rediscovering-spring-with-spring-boot1.pdfdokumen.tips_rediscovering-spring-with-spring-boot1.pdf
dokumen.tips_rediscovering-spring-with-spring-boot1.pdf
 
Deploying applications to Cloud with Google App Engine
Deploying applications to Cloud with Google App EngineDeploying applications to Cloud with Google App Engine
Deploying applications to Cloud with Google App Engine
 
Spring Performance Gains
Spring Performance GainsSpring Performance Gains
Spring Performance Gains
 
Spring Boot Whirlwind Tour
Spring Boot Whirlwind TourSpring Boot Whirlwind Tour
Spring Boot Whirlwind Tour
 
springmvc-150923124312-lva1-app6892
springmvc-150923124312-lva1-app6892springmvc-150923124312-lva1-app6892
springmvc-150923124312-lva1-app6892
 
Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5
 
Building a Spring Boot Application - Ask the Audience! (from JVMCon 2018)
Building a Spring Boot Application - Ask the Audience! (from JVMCon 2018)Building a Spring Boot Application - Ask the Audience! (from JVMCon 2018)
Building a Spring Boot Application - Ask the Audience! (from JVMCon 2018)
 
Building a Spring Boot Application - Ask the Audience!
Building a Spring Boot Application - Ask the Audience!Building a Spring Boot Application - Ask the Audience!
Building a Spring Boot Application - Ask the Audience!
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Modular Test-driven SPAs with Spring and AngularJS
Modular Test-driven SPAs with Spring and AngularJSModular Test-driven SPAs with Spring and AngularJS
Modular Test-driven SPAs with Spring and AngularJS
 
dokumen.tips_introduction-to-spring-boot-58bb649a21ce5.pptx
dokumen.tips_introduction-to-spring-boot-58bb649a21ce5.pptxdokumen.tips_introduction-to-spring-boot-58bb649a21ce5.pptx
dokumen.tips_introduction-to-spring-boot-58bb649a21ce5.pptx
 
Rest web service_with_spring_hateoas
Rest web service_with_spring_hateoasRest web service_with_spring_hateoas
Rest web service_with_spring_hateoas
 
Building microservices sample application
Building microservices sample applicationBuilding microservices sample application
Building microservices sample application
 
Module 6 _ Spring Boot for java application to begin
Module 6 _ Spring Boot for java application to beginModule 6 _ Spring Boot for java application to begin
Module 6 _ Spring Boot for java application to begin
 
Google App Engine overview (GAE/J)
Google App Engine overview (GAE/J)Google App Engine overview (GAE/J)
Google App Engine overview (GAE/J)
 
Spring and DWR
Spring and DWRSpring and DWR
Spring and DWR
 
JSS build and deployment
JSS build and deploymentJSS build and deployment
JSS build and deployment
 

Recently uploaded

Prada Group Reports Strong Growth in First Quarter …
Prada Group Reports Strong Growth in First Quarter …Prada Group Reports Strong Growth in First Quarter …
Prada Group Reports Strong Growth in First Quarter …
908dutch
 
How To Fill Timesheet in TaskSprint: Quick Guide 2024
How To Fill Timesheet in TaskSprint: Quick Guide 2024How To Fill Timesheet in TaskSprint: Quick Guide 2024
How To Fill Timesheet in TaskSprint: Quick Guide 2024
TaskSprint | Employee Efficiency Software
 
ERP Software Solutions Provider in Coimbatore
ERP Software Solutions Provider in CoimbatoreERP Software Solutions Provider in Coimbatore
ERP Software Solutions Provider in Coimbatore
Nextskill Technologies
 
Tour and travel website management in odoo,
Tour and travel website management in odoo,Tour and travel website management in odoo,
Tour and travel website management in odoo,
Axis Technolabs
 
VVIP Girls Call Mumbai 9910780858 Provide Best And Top Girl Service And No1 i...
VVIP Girls Call Mumbai 9910780858 Provide Best And Top Girl Service And No1 i...VVIP Girls Call Mumbai 9910780858 Provide Best And Top Girl Service And No1 i...
VVIP Girls Call Mumbai 9910780858 Provide Best And Top Girl Service And No1 i...
jealousviolet
 
Artificial intelligence in customer services or chatbots
Artificial intelligence  in customer services or chatbotsArtificial intelligence  in customer services or chatbots
Artificial intelligence in customer services or chatbots
kayash1656
 
Maximizing Efficiency and Profitability: Optimizing Data Systems, Enhancing C...
Maximizing Efficiency and Profitability: Optimizing Data Systems, Enhancing C...Maximizing Efficiency and Profitability: Optimizing Data Systems, Enhancing C...
Maximizing Efficiency and Profitability: Optimizing Data Systems, Enhancing C...
OnePlan Solutions
 
Independent Girls Call ServiCe Hyderabad 0000000000 Tanisha Best High Class H...
Independent Girls Call ServiCe Hyderabad 0000000000 Tanisha Best High Class H...Independent Girls Call ServiCe Hyderabad 0000000000 Tanisha Best High Class H...
Independent Girls Call ServiCe Hyderabad 0000000000 Tanisha Best High Class H...
aslasdfmkhan4750
 
GT degree offer diploma Transcript
GT degree offer diploma TranscriptGT degree offer diploma Transcript
GT degree offer diploma Transcript
attueb
 
Predicting Test Results without Execution (FSE 2024)
Predicting Test Results without Execution (FSE 2024)Predicting Test Results without Execution (FSE 2024)
Predicting Test Results without Execution (FSE 2024)
andrehoraa
 
bangalore Girls call 👀 XXXXXXXXXXX 👀 Rs.9.5 K Cash Payment With Room Delivery
bangalore Girls call  👀 XXXXXXXXXXX 👀 Rs.9.5 K Cash Payment With Room Deliverybangalore Girls call  👀 XXXXXXXXXXX 👀 Rs.9.5 K Cash Payment With Room Delivery
bangalore Girls call 👀 XXXXXXXXXXX 👀 Rs.9.5 K Cash Payment With Room Delivery
sunilverma7884
 
Celebrity Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Servic...
Celebrity Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Servic...Celebrity Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Servic...
Celebrity Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Servic...
45unexpected
 
Verified Girls Call Mumbai 👀 9820252231 👀 Cash Payment With Room DeliveryDeli...
Verified Girls Call Mumbai 👀 9820252231 👀 Cash Payment With Room DeliveryDeli...Verified Girls Call Mumbai 👀 9820252231 👀 Cash Payment With Room DeliveryDeli...
Verified Girls Call Mumbai 👀 9820252231 👀 Cash Payment With Room DeliveryDeli...
87tomato
 
Amadeus Travel API, Amadeus Booking API, Amadeus GDS
Amadeus Travel API, Amadeus Booking API, Amadeus GDSAmadeus Travel API, Amadeus Booking API, Amadeus GDS
Amadeus Travel API, Amadeus Booking API, Amadeus GDS
aadhiyaeliza
 
Celebrity Girls Call Mumbai 9930687706 Unlimited Short Providing Girls Servic...
Celebrity Girls Call Mumbai 9930687706 Unlimited Short Providing Girls Servic...Celebrity Girls Call Mumbai 9930687706 Unlimited Short Providing Girls Servic...
Celebrity Girls Call Mumbai 9930687706 Unlimited Short Providing Girls Servic...
kiara pandey
 
🚂🚘 Premium Girls Call Ranchi 🛵🚡000XX00000 💃 Choose Best And Top Girl Service...
🚂🚘 Premium Girls Call Ranchi  🛵🚡000XX00000 💃 Choose Best And Top Girl Service...🚂🚘 Premium Girls Call Ranchi  🛵🚡000XX00000 💃 Choose Best And Top Girl Service...
🚂🚘 Premium Girls Call Ranchi 🛵🚡000XX00000 💃 Choose Best And Top Girl Service...
bahubalikumar09988
 
UMiami degree offer diploma Transcript
UMiami degree offer diploma TranscriptUMiami degree offer diploma Transcript
UMiami degree offer diploma Transcript
attueb
 
Busty Girls Call Mumbai 9930245274 Unlimited Short Providing Girls Service Av...
Busty Girls Call Mumbai 9930245274 Unlimited Short Providing Girls Service Av...Busty Girls Call Mumbai 9930245274 Unlimited Short Providing Girls Service Av...
Busty Girls Call Mumbai 9930245274 Unlimited Short Providing Girls Service Av...
revolutionary575
 
High Girls Call Chennai 000XX00000 Provide Best And Top Girl Service And No1 ...
High Girls Call Chennai 000XX00000 Provide Best And Top Girl Service And No1 ...High Girls Call Chennai 000XX00000 Provide Best And Top Girl Service And No1 ...
High Girls Call Chennai 000XX00000 Provide Best And Top Girl Service And No1 ...
singhlata50dh
 
SAP implementation steps PDF - Zyple Software
SAP implementation steps PDF - Zyple SoftwareSAP implementation steps PDF - Zyple Software
SAP implementation steps PDF - Zyple Software
Zyple Software
 

Recently uploaded (20)

Prada Group Reports Strong Growth in First Quarter …
Prada Group Reports Strong Growth in First Quarter …Prada Group Reports Strong Growth in First Quarter …
Prada Group Reports Strong Growth in First Quarter …
 
How To Fill Timesheet in TaskSprint: Quick Guide 2024
How To Fill Timesheet in TaskSprint: Quick Guide 2024How To Fill Timesheet in TaskSprint: Quick Guide 2024
How To Fill Timesheet in TaskSprint: Quick Guide 2024
 
ERP Software Solutions Provider in Coimbatore
ERP Software Solutions Provider in CoimbatoreERP Software Solutions Provider in Coimbatore
ERP Software Solutions Provider in Coimbatore
 
Tour and travel website management in odoo,
Tour and travel website management in odoo,Tour and travel website management in odoo,
Tour and travel website management in odoo,
 
VVIP Girls Call Mumbai 9910780858 Provide Best And Top Girl Service And No1 i...
VVIP Girls Call Mumbai 9910780858 Provide Best And Top Girl Service And No1 i...VVIP Girls Call Mumbai 9910780858 Provide Best And Top Girl Service And No1 i...
VVIP Girls Call Mumbai 9910780858 Provide Best And Top Girl Service And No1 i...
 
Artificial intelligence in customer services or chatbots
Artificial intelligence  in customer services or chatbotsArtificial intelligence  in customer services or chatbots
Artificial intelligence in customer services or chatbots
 
Maximizing Efficiency and Profitability: Optimizing Data Systems, Enhancing C...
Maximizing Efficiency and Profitability: Optimizing Data Systems, Enhancing C...Maximizing Efficiency and Profitability: Optimizing Data Systems, Enhancing C...
Maximizing Efficiency and Profitability: Optimizing Data Systems, Enhancing C...
 
Independent Girls Call ServiCe Hyderabad 0000000000 Tanisha Best High Class H...
Independent Girls Call ServiCe Hyderabad 0000000000 Tanisha Best High Class H...Independent Girls Call ServiCe Hyderabad 0000000000 Tanisha Best High Class H...
Independent Girls Call ServiCe Hyderabad 0000000000 Tanisha Best High Class H...
 
GT degree offer diploma Transcript
GT degree offer diploma TranscriptGT degree offer diploma Transcript
GT degree offer diploma Transcript
 
Predicting Test Results without Execution (FSE 2024)
Predicting Test Results without Execution (FSE 2024)Predicting Test Results without Execution (FSE 2024)
Predicting Test Results without Execution (FSE 2024)
 
bangalore Girls call 👀 XXXXXXXXXXX 👀 Rs.9.5 K Cash Payment With Room Delivery
bangalore Girls call  👀 XXXXXXXXXXX 👀 Rs.9.5 K Cash Payment With Room Deliverybangalore Girls call  👀 XXXXXXXXXXX 👀 Rs.9.5 K Cash Payment With Room Delivery
bangalore Girls call 👀 XXXXXXXXXXX 👀 Rs.9.5 K Cash Payment With Room Delivery
 
Celebrity Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Servic...
Celebrity Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Servic...Celebrity Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Servic...
Celebrity Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Servic...
 
Verified Girls Call Mumbai 👀 9820252231 👀 Cash Payment With Room DeliveryDeli...
Verified Girls Call Mumbai 👀 9820252231 👀 Cash Payment With Room DeliveryDeli...Verified Girls Call Mumbai 👀 9820252231 👀 Cash Payment With Room DeliveryDeli...
Verified Girls Call Mumbai 👀 9820252231 👀 Cash Payment With Room DeliveryDeli...
 
Amadeus Travel API, Amadeus Booking API, Amadeus GDS
Amadeus Travel API, Amadeus Booking API, Amadeus GDSAmadeus Travel API, Amadeus Booking API, Amadeus GDS
Amadeus Travel API, Amadeus Booking API, Amadeus GDS
 
Celebrity Girls Call Mumbai 9930687706 Unlimited Short Providing Girls Servic...
Celebrity Girls Call Mumbai 9930687706 Unlimited Short Providing Girls Servic...Celebrity Girls Call Mumbai 9930687706 Unlimited Short Providing Girls Servic...
Celebrity Girls Call Mumbai 9930687706 Unlimited Short Providing Girls Servic...
 
🚂🚘 Premium Girls Call Ranchi 🛵🚡000XX00000 💃 Choose Best And Top Girl Service...
🚂🚘 Premium Girls Call Ranchi  🛵🚡000XX00000 💃 Choose Best And Top Girl Service...🚂🚘 Premium Girls Call Ranchi  🛵🚡000XX00000 💃 Choose Best And Top Girl Service...
🚂🚘 Premium Girls Call Ranchi 🛵🚡000XX00000 💃 Choose Best And Top Girl Service...
 
UMiami degree offer diploma Transcript
UMiami degree offer diploma TranscriptUMiami degree offer diploma Transcript
UMiami degree offer diploma Transcript
 
Busty Girls Call Mumbai 9930245274 Unlimited Short Providing Girls Service Av...
Busty Girls Call Mumbai 9930245274 Unlimited Short Providing Girls Service Av...Busty Girls Call Mumbai 9930245274 Unlimited Short Providing Girls Service Av...
Busty Girls Call Mumbai 9930245274 Unlimited Short Providing Girls Service Av...
 
High Girls Call Chennai 000XX00000 Provide Best And Top Girl Service And No1 ...
High Girls Call Chennai 000XX00000 Provide Best And Top Girl Service And No1 ...High Girls Call Chennai 000XX00000 Provide Best And Top Girl Service And No1 ...
High Girls Call Chennai 000XX00000 Provide Best And Top Girl Service And No1 ...
 
SAP implementation steps PDF - Zyple Software
SAP implementation steps PDF - Zyple SoftwareSAP implementation steps PDF - Zyple Software
SAP implementation steps PDF - Zyple Software
 

Spring Boot

  • 1. SPRING BOOT HONGSEONG JEON HSJEON70@GMAIL.COM MAY 24, 2016 Easy to create, run spring applications
  • 2. INTRODUCING SPRING BOOT  Easy to create stand-alone, production-grade Spring based applications that you can “just run”.  It needs very little spring configuration.  Create Java applications that can be started using java –jar or more traditional war deployments.  Primary goals for the Spring Boot.  Provide a radically faster and widely accessible getting started experience for all Spring development.  Be opinionated out of the box, but get out of the way quickly as requirements start to diverge from the defaults.  Provide a range of non-functional features that are common to large classes of projects (e.g.embedded servers, security, metrics, health checks, externalized configuration).  Absolutely no code generation and no requirement for XML configuration.
  • 3. SYSTEM REQUIREMENTS  Spring Boot 1.4.0 requires Java 7 and Spring Framework 4.1.5 or above.  Servlet containers  Servlet 3.0+ compatible container
  • 4. DEVELOPMENT ENVIRONMENT  Build tool that supports dependency management  Maven – maven.apache.org  Gradle – www.gradle.org  Development IDE  Eclipse or Any Editor  Eclipse plugin - m2ecipse - gradle
  • 5. SIMPLE APPLICATION  New Gradle Project  Create HelloApplication
  • 6. SIMPLE APPLICATION  Create HelloController  Create application.properties in the resources
  • 7. SIMPLE APPLICATION  Run HelloApplication at the eclipse  Run http://localhost:8010/hello
  • 8. SPRING BOOT ADMIN  Spring Boot Admin is a simple application to manage and monitor your Spring Boot Applications.  The applications register with our Spring Boot Admin Client (via http) or are discovered using Spring Cloud (e.g. Eureka).
  • 9. SPRING BOOT ADMIN APPLICATION  Create New Gradle Project  Add spring boot server libraries to project dependencies.  Create SpringBootAdminApplication dependencies { compile 'de.codecentric:spring-boot-admin-server:1.3.2' compile 'de.codecentric:spring-boot-admin-server-ui:1.3.2' compile 'org.springframework.boot:spring-boot-starter-web:1.3.1.RELEASE' }
  • 10. SPRING BOOT ADMIN APPLICATION  Application properties # ======================= # Tomcat Configuration # ======================= server.tomcat.max-threads=10 server.address=127.0.0.1 server.port=9090 # ======================= # Security Configuration # ======================= security.user.name=admin security.user.password=admin management.security.role=SUPERUSER management.security.enabled=false
  • 11. SPRING BOOT ADMIN CLIENT  Add spring-boot-admin-starter-client to project dependencies.  Add run task in the build.gradle dependencies { compile 'de.codecentric:spring-boot-admin-starter-client:1.3.2‘ compile 'org.springframework.boot:spring-boot-starter-web:1.3.1.RELEASE' } task run (dependsOn: classes, type: JavaExec) { classpath = sourceSets.main.runtimeClasspath main = 'com.example.myproject.HelloApplication' }
  • 12. SPRING BOOT ADMIN CLIENT  Add spring boot admin properties in the application.properties # Tomcat Configuration server.address=127.0.0.1 server.port=8010 # ======================= # JMX Configuration #management.port=8011 #management.address=127.0.0.1 management.security.role=SUPERUSER management.security.enabled=false # ============================================ # Client Configuration for Spring Boot Admin info.version=1.0 info.info=spring boot hello application spring.boot.admin.client.name=hello spring.boot.admin.url=http://127.0.0.1:9090 spring.boot.admin.username=admin spring.boot.admin.password=admin spring.boot.admin.client.health-url=http://localhost:8010/health spring.boot.admin.client.service-url=http://localhost:8010 spring.boot.admin.client.management-url=http://localhost:8010
  • 13. SPRING BOOT ADMIN TESTING  Run HelloApplication
  • 14. SPRING BOOT ADMIN TESTING  Run SpringBootAdminApplication  http://localhost:9090/  Application Dashboard
  • 15. SPRING BOOT ADMIN  Applications Details
  • 16. SPRING BOOT ADMIN  Application Details
  • 17. SPRING BOOT ADMIN  Application Environment
  • 18. SPRING BOOT ADMIN  Application Logging
  • 19. SPRING BOOT ADMIN  Application JMX
  • 20. SPRING BOOT ADMIN  Application Threads
  • 21. SPRING BOOT ADMIN  Application Trace
  • 22. DATABASE CONFIGURATION  H2 Database  H2 is written in Java and is easily runs as an embedded in- memory database.  Because it is an embedded in memory database, it makes your build portable.  H2 Database and Spring Boot  By adding this dependency to your gradle, Sring Boot will automatically configure the H2 database.  JDBC DataSource Configuration in the application.properties. dependencies { compile 'com.h2database:h2' } spring.datasource.jndi-name=java:jboss/datasources/customers
  • 23. DATABASE CONFIGURATION  JDBC DataSource Configuration in the application.properties # =============================== # = DATA SOURCE # =============================== # Set here configurations for the database connection spring.datasource.url = jdbc:h2:d:/applications/springBoot/data/boot.db # JDBC Driver class spring.datasource.driver-class-name=org.h2.Driver # Username and password spring.datasource.username = sa spring.datasource.password = sa # Keep the connection alive if idle for a long time (needed in production) spring.datasource.testWhileIdle = true spring.datasource.validationQuery = SELECT 1 # Number of ms to wait before throwing an exception if no connection is available. spring.datasource.max-wait=10000 # Maximum number of active connections that can be allocated from this pool at the same time. spring.datasource.max-active=50 # Validate the connection before borrowing it from the pool. spring.datasource.test-on-borrow=true
  • 24. DATABASE CONFIGURATION  H2 Database Web Console  Enable H2 Database Web Console in the application.properties  H2 Database Web Console : http://${serviceUrl}/h2-console/ # Enable H2 Database Web Console spring.h2.console.enabled=true
  • 25. DATABASE CONFIGURATION  Spring Boot Admin – Database Monitoring
  • 26. SPRING DATA JPA  Using Spring Data JPA can save you a lot of time when interacting with the database.  Spring Data JPA implements the Repository Pattern.  Domain Driven Design  Create a Persistence Repository  Defining a repository for our City domain class is as simple as defining a interface and extending the CrudRepository interface.
  • 27. SPRING DATA JPA  Create a City Loader component
  • 28. SPRING DATA JPA  Run Application
  • 29. SPRING DATA JPA  Confirm loaded data
  • 30. SPRING REST CONTROLLER  Create a CityService interface  Create a CityServiceImpl class
  • 31. SPRING REST CONTROLLER  Create a CityController  Testing
  • 32. SPRING BOOT EHCACHE  Gradle Dependency for ehcache  Ehcache configuration – config/ehcache.xml dependencies { compile 'net.sf.ehcache:ehcache-core:2.6.10' } <ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema- instance"xsi:noNamespaceSchemaLocation="ehcache.xsd" updateCheck="true"monitoring="autodetect"dynamicConfig="true" statistics="true"> <diskStore path="java.io.tmpdir" /> <cache name="myCache" maxEntriesLocalHeap="5000“ maxEntriesLocalDisk="1000" eternal="false" diskSpoolBufferSizeMB="20“ timeToIdleSeconds="300" timeToLiveSeconds="600“ memoryStoreEvictionPolicy="LFU" transactionalMode="off"> <persistence strategy="localTempSwap" /> </cache> </ehcache>
  • 33. SPRING BOOT EHCACHE  Enable Cache and Define a CacheManager bean in the Application class.
  • 34. SPRING BOOT EHCACHE  Apply Cacheable annotation  Run and Testing
  • 35. SPRING BOOT EHCACHE  Ehcache Statistics on the Spring Boot Admin
  • 36. SPRING BOOT WEB APPLICATION  Thymeleaf is a modern server-side Java template engine for both web and standalone environments.  Thymeleaf is ideal for modern-day HTML5 JVM web development  http://www.thymeleaf.org/  Gradle Dependency for Thymeleaf  Create a HelloController dependencies { compile 'org.springframework.boot:spring-boot-starter-thymeleaf' }
  • 37. SPRING BOOT WEB APPLICATION  Create a greeting.html  src/main/resources/templates/greeting.html  Run and Testing <!DOCTYPE HTML> <html xmlns:th="http://www.thymeleaf.org"> <head> <title>Getting Started: Serving Web Content</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> </head> <body> <p th:text="'Hello, ' + ${name} + '!'" /> </body> </html>
  • 38. SPRING BOOT WEB APPLICATION  Spring Boot Admin – HTTP API Monitoring
  • 39. SPRING BOOT APPLICATION  Project Package Layout Spring Boot main application class  Resources Layout
  • 40. REFERENCES  https://projects.spring.io/spring-framework/  http://projects.spring.io/spring-boot/  http://codecentric.github.io/spring-boot-admin/1.3.0/  http://www.thymeleaf.org/  http://gradle.org/  http://www.h2database.com/html/main.html  Example projects repository - https://bitbucket.org/jlookexamples/examples-spring-boot-admin - https://bitbucket.org/jlookexamples/examples-spring-boot - https://bitbucket.org/jlookexamples/examples-hello
  • 41. Q & A