Building a Spring Boot Application - Ask the Audience!
-
Upload
hanno-embregts -
Category
Technology
-
view
193 -
download
0
Transcript of Building a Spring Boot Application - Ask the Audience!
Building a
Spring BootApplication(ask the audience)
Hanno Embregts @hannotify
Spring Boot?
( )
"Takes an opinionated view of buildingproduction-ready Spring applications.
Favors convention over con guration andis designed to get you up and running as
quickly as possible."
https://projects.spring.io/spring-boot
Key features?create stand-alone Spring applicationsembed web server directly (no WAR les)automatic Spring con guration whereverpossibleno code generation and no XML con gurationstill offering all Spring features.
Pros?no separate web server neededbetter debugging in IDEsfaster deployments (about 50%)no web.xml or con guration classes needed
up and running with one Java le and a buildscript.
( )https://www.ethode.com/blog/6-simple-reasons-why-spring-boot-rocks
Cons?custom con guration will be a bit of a puzzle
porting your legacy Spring project would be adisaster!
it uses Spring, excluding roughly half of the Javacommunity.
Java le(s)// imports...
@RestController public class HelloController {
@RequestMapping("/") public String index() { return "Greetings from Spring Boot!"; } }
// imports...
@SpringBootApplication public 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") 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-con g & 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 )
https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#using-boot-starter
Spring Initializr(a quick way to download a project setup)
http://start.spring.io/
Wrap-upSpring Boot
gets you up & running quickly;assumes standard con guration for rapiddevelopment;plays nice with a wide range of frameworks;is up to the task no matter what choices you make.
And what if I prefer JavaEE?At least you can use embedded servers:
TomEE Embedded( )
Wild y Swarm ( )
Quick assembly with JBoss ShrinkWrap(
)
http://tomee.apache.org/advanced/tomee-embedded/index.html
http://wild y-swarm.io/
http://www.lordofthejars.com/2014/09/apache-tomee-shrinkwrap-javaee-boot-not.html
Thank you! ☺ You can contact me at:
@hannotify