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.

The Spring Update

1,323 views

Published on

From the AJUG meeting: http://www.meetup.com/atlantajug/events/222312943/
Oc 20, 2015

In this fully-loaded session we will give you an update on all things Spring. We will talk about the latest features in Spring Framework 4.2 which was released this summer, and also provide an outlook to what is coming with Spring 5 in 2016.

Next, Spring Boot 1.3 is on the horizon and adds many new features. We will go over those and explain how Spring Boot helps you build production-ready Spring applications.

And then we add Spring Cloud to the mix and explain the various modules

Published in: Technology
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download Full EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download doc Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

The Spring Update

  1. 1. The Spring Update Roy Clarkson | Glenn Renfro | Gunnar Hillert
  2. 2. Spring 2
  3. 3. Spring Data 3 Core Jpa Gemfire REST KeyValue MongoDB Redis Solr Foundational Store Modules Web Apis Core Modules Community Modules ElasticSearch Cassandra Couchbase Neo4j
  4. 4. Spring Social 4
  5. 5. Spring 4.2 • @AliasFor • Hibernate5 Support • JMS Improvements • Support for Money, Currency and TimeZone (Formatter / ConversionService) 5
  6. 6. • Used to declare aliases between attributes within an annotation • e.g., locations and value in @ContextConfiguration, or path and value in @RequestMapping • Used in composed annotations @AliasFor 6 https://github.com/sbrannen/spring-composed
  7. 7. Spring 4.2 Testing • Support for HtmlUnit incl. Selenium Webdriver integration • @Commit instead @Rollback(false) • ContextCache is public Api • @Sql 7 @Test @Sql(statements = "DROP TABLE user IF EXISTS") @Sql(scripts = “/test-schema.sql", statements = "INSERT INTO user VALUES ('Dilbert')")
  8. 8. JUnit Rules • SpringClassRule & SpringMethodRule • Can be used with any JUnit runner
 8 @RunWith(Parameterized.class) @ContextConfiguration public class ParameterizedSpringRuleTests { 
 @ClassRule public static final SpringClassRule SPRING_CLASS_RULE = new SpringClassRule(); @Rule public final SpringMethodRule springMethodRule = new SpringMethodRule();
  9. 9. Embedded DBs • Unique Names for Embedded Databases • Why? Recreating an embedded database within the same JVM doesn’t actually create anything: a second attempt simply connects to the existing one. 9 @Bean public DataSource dataSource() { return new EmbeddedDatabaseBuilder() .generateUniqueName(true) .addScript("schema.sql") .addScript("user_data.sql") .build(); }
  10. 10. Spring Web • SimpUserRegistry • CompletableFuture (Java 8) • OkHTTP Integration with RestTemplate • ScriptTemplateView • JavaScript view templating, Nashorn (JDK 8) 10
  11. 11. HTTP Caching • CacheControl builder • A builder for creating "Cache-Control" HTTP response headers. 11 @Configuration @EnableWebMvc public class WebConfig extends WebMvcConfigurerAdapter { @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/resources/**") .addResourceLocations("/public-resources/") .setCacheControl(CacheControl.maxAge(1,TimeUnit.HOURS) .cachePublic()); } }
  12. 12. HTTP Caching 12 @RequestMapping("/book/{id}") public ResponseEntity<Book> showBook(@PathVariable Long id) { Book book = findBook(id); String version = book.getVersion(); return ResponseEntity .ok() .cacheControl(CacheControl.maxAge(30, TimeUnit.DAYS)) .eTag(version) // lastModified is also available .body(book); } • Usage in Controllers
  13. 13. Spring Web • Cross-origin resource sharing (CORS) 13 @CrossOrigin(maxAge = 3600) @RestController @RequestMapping("/account") public class AccountController { @CrossOrigin(origins = "http://domain2.com") @RequestMapping("/{id}") public Account retrieve(@PathVariable Long id) { … } @RequestMapping(method = RequestMethod.DELETE, value = "/{id}") public void remove(@PathVariable Long id) { … } }
  14. 14. Async • Spring 3.2 Async Request Handling • Spring 4.0 WebSocket Messaging (SockJS + Stomp) • Spring 4.2 HttpStreaming • Spring 4.2 Server-Sent Events (SSE) • Spring 4.2 Direct Streaming 14
  15. 15. Server-Sent Events 15 @RequestMapping("/metrics") public SseEmitter subscribeMetrics() { SseEmitter emitter = new SseEmitter(); // Save emitter for further usage return emitter; }
  16. 16. Spring 4.3 • Refinements • A richer set of convenience annotations (pre- composed) 16
  17. 17. Spring 5 • Q4 2016 • Comprehensive JDK 9 support • Java 8 baseline • Servlet 3.0+ • HTTP/2 • Reactive support 17 https://github.com/spring- projects/spring-reactive
  18. 18. Spring Boot 1.3 18 Pathway to #NoXML
  19. 19. 0 450000 900000 1350000 1800000 July 14 Sep 14 Nov 14 Jan 15 Mar 15 May 15 Jul 15 Spring Boot Adoption 19
  20. 20. • https://spring.io/blog/2013/03/04/spring-at-china-scale-alibaba- group-alipay-taobao-and-tmall/ 20 “AliExpress is the beginning of a new effort to re- architect Taobao.com and Alipay.com for microservices and cloud native, built on Spring Boot and Spring Cloud.” - Leijuan, Principal Engineer, AliExpress
  21. 21. 21
  22. 22. Boot 1.3 • Spring 4.2 and Spring Security 4.0 • OAuth2 Support • Colorful Ascii Art Banners 22
  23. 23. Boot 1.3 • Fully executable JARs and service support • Start as Unix/Linux services • init.d • systemd 23 $ ./myapp.jar
  24. 24. Boot 1.3 • Additional Health Indicators • Actuator Metrics (Java 8) • New actuator endpoints - e.g. /logfile • Hypermedia for MVC actuator endpoints • Actuator docs endpoint 24
  25. 25. Boot 1.3 • Spring Session Autoconfiguration • Persistent sessions (Opt-in) • Ant Support • Support for @WebServlet, @WebFilter, and @WebListener • When using an embedded servlet container, automatic registration of @WebServlet, @WebFilter, and @WebListener annotated classes can now be enabled using @ServletComponentScan. 25
  26. 26. Logging • Logback • Spring Profile specific Configuration • Use Environment Properties in Logback’ • logback-spring.xml • Log4J 1.x deprecated 26 https://blogs.apache.org/foundation/entry/ apache_logging_services_project_announces
  27. 27. Boot Developer Tools • Property Defaults • Automatic application restarts • Remote development support 27 http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/ reference/htmlsingle/#using-boot-devtools
  28. 28. Boot Developer Tools • LiveReload support • Install LiveReload browser plugin • Bowser Refresh Button 28 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> </dependency>
  29. 29. Caching • @EnableCaching • Auto-configuration now for: 29 JSR 107Guava
  30. 30. Boot and SPAs • Web jars - /webjars/** • /static, /public, /resources, /META-INF/resources • Creating modular jars 30
  31. 31. Demo 31 https://github.com/ghillert/botanic-ng
  32. 32. Migrating to 1.3 • https://github.com/spring-projects/spring-boot/ wiki/Spring-Boot-1.3-Release-Notes • Several properties changed • Dependency updates 32
  33. 33. JSPs and Web.xml • JSP limitations for über-Jars • Servlet 3.0 to the rescue • /META-INF/resources/WEB-INF/jsp • Possible to Eliminate Web.xml • TomcatEmbeddedServletContainerFactory 33
  34. 34. 34
  35. 35. Demo 35 https://github.com/devnexus/devnexus-site JSPs with
  36. 36. Spring Initializr • http://start.spring.io 36
  37. 37. Tooling - STS • Spring Boot YML properties editor • with code completion • Improved support for Cloud Foundry • Support for Spring Boot DevTools • Attach Java debugger to CF deployed apps • Spring Boot Dashboard 37
  38. 38. • Service Discovery • Circuit Breaker • Client Side Load Balancer • Router and Filter • Spring Cloud Stream + Data Flow • Distributed tracing 38 Spring Cloud
  39. 39. 39 Eureka Hystrix Spring Cloud Consul
  40. 40. 12 factor app principles 40 Codebase Depen- dencies Config Backing Services Build Release Run Processes Port Binding Concurrency Disposa- bility Dev/Prod Parity Logs Admin Processes http://12factor.net
  41. 41. Demo 41 https://github.com/springone2gx2015/vehicle-fleet-demo
  42. 42. Demo 42
  43. 43. Spring & Cloud Native 43 Core Boot Connectors Service Registry Config Server Circuit Breaker OpsDev
  44. 44. 44 #fundJUnit • Pivotal sponsoring JUnit • Developer Sponsor • 6 weeks of senior developer • Campaign Sponsor • €5000 donation
  45. 45. Books 45 http://pivotal.io/ platform/migrating-to- cloud-native- application- architectures-ebook
  46. 46. Books 46
  47. 47. Books 47
  48. 48. 48
  49. 49. • Full-Day Workshop • Several Spring Speakers 49 Delivering Cloud Native Applications with Spring and Cloud Foundry
  50. 50. Questions? 50
  51. 51. Thank You! 51 Credits: Justin Blake, nathanbui, Bohdan Burmich, David Waschbüsch, Gabriele Malaspina, Creative Stall, Aha-Soft https://github.com/ghillert/ ajug-spring-update @ghillert @royclarkson@cppwfs @springcentral

×