Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Building a Spring Boot 2 Application - Ask the Audience! (from Voxxed Days Vienna 2018)

146 views

Published on

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.

Published in: Software
  • Be the first to comment

Building a Spring Boot 2 Application - Ask the Audience! (from Voxxed Days Vienna 2018)

  1. 1. Hanno?Hanno?Hanno?Hanno?Hanno?
  2. 2. IntroducingIntroducingIntroducingIntroducingIntroducing Spring BootSpring BootSpring BootSpring BootSpring Boot
  3. 3. 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
  4. 4. 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.
  5. 5. 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
  6. 6. 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.
  7. 7. Starting OutStarting OutStarting OutStarting OutStarting Out
  8. 8. About What We ClaimedAbout What We Claimed Earlier...Earlier... "up and running with one Java le and a build script"
  9. 9. 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); } }
  10. 10. Build scriptBuild script apply 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") }
  11. 11. 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
  12. 12. Spring InitializrSpring Initializr (a quick way to download a project setup) http://start.spring.io/
  13. 13. Spring Boot 2Spring Boot 2Spring Boot 2Spring Boot 2Spring Boot 2
  14. 14. New Features - Spring Boot 2New Features - Spring Boot 2
  15. 15. 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
  16. 16. 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
  17. 17. Pivotal Webinar TONIGHTPivotal Webinar TONIGHT ( )https://content.pivotal.io/webinars/mar-13-introducing-spring-boot-2-0-webinar
  18. 18. Live codingLive codingLive codingLive codingLive coding
  19. 19. Kahoot! #1
  20. 20. Kahoot! #2
  21. 21. 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);
  22. 22. Wrap-up &Wrap-up &Wrap-up &Wrap-up &Wrap-up & QuestionsQuestionsQuestionsQuestionsQuestions
  23. 23. 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.
  24. 24. 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
  25. 25. Any questions?Any questions?Any questions?Any questions?Any questions?
  26. 26. @hannotify Thank you! ☺Thank you! ☺ Just can't get enough? https://hannotify.github.io @hannotify hanno.embregts@infosupport.com

×