building a spring boot application - ask the audience! (from javaland 2017)
TRANSCRIPT
Building a
Spring BootApplication
(ask the audience)
Hanno Embregts @hannotify
Hanno?Hanno?
Hanno?Hanno?
Hanno?Hanno?
Hanno?Hanno?
Hanno?Hanno?
Hanno?Hanno?
Hanno?Hanno?Hanno?Hanno?
IntroducingIntroducing
IntroducingIntroducing
IntroducingIntroducing
IntroducingIntroducing
IntroducingIntroducing
IntroducingIntroducing
IntroducingIntroducingIntroducingIntroducingSpring BootSpring Boot
Spring BootSpring Boot
Spring BootSpring Boot
Spring BootSpring Boot
Spring BootSpring Boot
Spring BootSpring Boot
Spring BootSpring BootSpring BootSpring Boot
Spring Boot?
( )
"Takes an opinionated view of buildingproduction-ready Spring applications.Favors convention over configuration
and is designed to get you up andrunning as quickly as possible."
https://projects.spring.io/spring-boot
Key features?create stand-alone Spring applicationsembed web server directly (no WAR files)automatic Spring configuration wherever possibleno code generation and no XML configurationstill offering all Spring features.
Pros?no separate web server neededbetter debugging in IDEsfaster deployments (about 50%)no web.xml or configuration classes needed
up and running with one Java file and a buildscript.
( )https://www.ethode.com/blog/6-simple-reasons-why-spring-boot-rocks
Cons?custom configuration will be a bit of a puzzle
porting your legacy Spring project would be adisaster!
it uses Spring, excluding roughly half of the Javacommunity.
Starting OutStarting Out
Starting OutStarting Out
Starting OutStarting Out
Starting OutStarting Out
Starting OutStarting Out
Starting OutStarting Out
Starting OutStarting OutStarting OutStarting Out
Wanna BeWanna Be
Wanna BeWanna Be
Wanna BeWanna Be
Wanna BeWanna Be
Wanna BeWanna Be
Wanna BeWanna Be
Wanna BeWanna BeWanna BeWanna Be
Startin'Startin'
Startin'Startin'
Startin'Startin'
Startin'Startin'
Startin'Startin'
Startin'Startin'
Startin'Startin'Startin'Startin'Somethin'Somethin'
Somethin'Somethin'
Somethin'Somethin'
Somethin'Somethin'
Somethin'Somethin'
Somethin'Somethin'
Somethin'Somethin'Somethin'Somethin'
Java file(s)// imports...
@RestControllerpublic class HelloController {
@RequestMapping("/") public String index() { return "Greetings from Spring Boot!"; }}
// imports...
@SpringBootApplicationpublic class Application {
public static void main(String[] args) { SpringApplication.run(Application.class, args); }}
Build scriptapply plugin: 'java'apply plugin: 'idea'apply plugin: 'org.springframework.boot'
jar { // some properties...}
// repositories...
dependencies { compile("org.springframework.boot:spring-boot-starter-web") { exclude module: "spring-boot-starter-tomcat" } compile("org.springframework.boot:spring-boot-starter-jetty") testCompile("junit:junit")}
Starter Dependenciesa set of convenient dependency descriptorsfollow the naming pattern spring-boot-starter-*
Name Purpose
spring-boot-starter Core starter, includes auto-config & logging
spring-boot-starter-test Test starter, includes JUnit, Hamcrest & Mockito
spring-boot-starter-web Starter for Spring MVC Web applications
spring-boot-starter-data-jpa Spring Data with JPA
(more starters at )
http://docs.spring.io/spring-boot/docs/1.5.2.RELEASE/reference/htmlsingle/#using-boot-starter
Spring Initializr
(a quick way to download a project setup)
http://start.spring.io/
Live codingLive coding
Live codingLive coding
Live codingLive coding
Live codingLive coding
Live codingLive coding
Live codingLive coding
Live codingLive codingLive codingLive coding
Wrap-up &Wrap-up &
Wrap-up &Wrap-up &
Wrap-up &Wrap-up &
Wrap-up &Wrap-up &
Wrap-up &Wrap-up &
Wrap-up &Wrap-up &
Wrap-up &Wrap-up &Wrap-up &Wrap-up &QuestionsQuestions
QuestionsQuestions
QuestionsQuestions
QuestionsQuestions
QuestionsQuestions
QuestionsQuestions
QuestionsQuestionsQuestionsQuestions
Wrap-upSpring Boot
gets you up & running quickly;assumes standard configuration for rapiddevelopment;plays nice with a wide range of frameworks;is up to the task no matter what choices youmake.
And what if I prefer JavaEE?At least you can use embedded servers:
TomEE Embedded( )
Wildfly Swarm( )
Quick assembly with JBoss ShrinkWrap(
)
http://tomee.apache.org/advanced/tomee-embedded/index.html
http://wildfly-swarm.io/
http://www.lordofthejars.com/2014/09/apache-tomee-shrinkwrap-javaee-boot-not.html
AnyAny
AnyAny
AnyAny
AnyAny
AnyAny
AnyAny
AnyAnyAnyAnyquestions?questions?
questions?questions?
questions?questions?
questions?questions?
questions?questions?
questions?questions?
questions?questions?questions?questions?
Thank you! ☺
You can contact me at:
@hannotify