Spring Boot makes it easy to create stand-alone Spring-based applications that you can ‘just run’. It uses a ‘convention over configuration’ approach to get you up and running in no-time. And with the release of Spring Boot 2 in February 2018 all Spring 5.0 features will be available for Spring Boot users, as well as Kotlin support. In this session I will demonstrate this by live-coding a Spring Boot 2 application that will ‘just work’.
But audience beware, this is not your standard ‘live-coding session’. Attendees will have a vital say in the session’s content by defining the application’s requirements. Do you want a simple task planner? Or track your favourite movies? It’s up to you! Should it use MongoDB or JPA? You decide! Built with Java or Kotlin? I don’t care! Do you want an Angular front-end with a RESTful back-end or do you prefer a classic web app with Thymeleaf templates? It’s your call! Seriously.
During the session you get to make these decisions by participating in an online vote. And you will discover that Spring Boot is up to the task no matter what choices you make.
So what are you waiting for? Bring your own device, help shape the application that we’re building and learn lots about Spring Boot in the process.
This session is intended for Java software engineers with an interest in Spring Boot. Some Spring experience could come in handy, but is not strictly necessary. After this session, you will know enough to start your own Spring Boot project.
4. Spring Boot?Spring Boot?
( )
"Takes an opinionated view of building
production-ready Spring applications.
Favors convention over con guration and
is designed to get you up and running as
quickly as possible."
https://projects.spring.io/spring-boot
5. Key features?Key features?
create stand-alone Spring applications
embed web server directly (no WAR les)
automatic Spring con guration wherever
possible
no code generation and no XML con guration
still offering all Spring features.
6. Pros?Pros?
no separate web server needed
debug your application directly from your IDE
deployment by just copying your JAR le(s)
no web.xml or con guration classes needed
up and running with one Java le and a build
script.
( )https://www.ethode.com/blog/6-simple-reasons-why-spring-boot-rocks
7. Cons?Cons?
custom con guration will be a bit of a puzzle
porting your legacy Spring project would be a
disaster!
it uses Spring, excluding roughly half of the Java
community.
9. About What We ClaimedAbout What We Claimed
Earlier...Earlier...
"up and running with one Java le and a
build script"
10. Java le(s)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);
}
}
12. Starter DependenciesStarter Dependencies
a set of convenient dependency
descriptors
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
spring-boot-starter-... ...
(more starters at
)
http://docs.spring.io/spring-
boot/docs/current/reference/htmlsingle/#using-boot-starter
15. New Features - Spring Boot 2New Features - Spring Boot 2
16. More new features!More new features!
Animated GIF
banners
Kotlin support
(full release notes at
)
https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.0-
Release-Notes
17.
18. Kotlin supportKotlin support
Nullable information in Spring annotations
@RequestParam name: String? means not required
Bean classes can be open by default
for annotations @Component, @Async, @Transactional & @Cacheable
Kotlin-based Gradle build con guration
this means full auto-completion and validation in your IDE
(
)
https://spring.io/blog/2017/01/04/introducing-kotlin-support-in-spring-framework-5-
0
23. Implementing RepositoryImplementing Repository
MethodsMethods
De ne them in a @Query annotation
Use one of the many supported query methods
(
)
https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#jpa.query-
methods.query-creation
List<Entity> findByNameContainingIgnoreCase(String name);
25. Wrap-upWrap-up
Spring Boot
gets you up & running quickly;
assumes standard con guration for rapid
development;
plays nice with a wide range of frameworks;
is up to the task no matter what choices you make.
26. And what if I preferAnd what if I prefer Java EEJava EE
Jakarta EE?Jakarta EE?
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