the spring update from javaone 2013

46
Josh Long (之春) @starbuxman joshlong.com [email protected] slideshare.net/joshlong github.com/joshlong http://spring.io THE UPDATE

Upload: josh-long

Post on 10-May-2015

1.635 views

Category:

Technology


0 download

DESCRIPTION

Spring, now part of Pivotal, continues to innovate and support next generation workloads. In this talk, I introduce some of the exciting new Spring technologies supporting websockets, Java 8, Java EE 7, data ingestion and stream processing, NoSQL and Hadoop, and production-ready REST, _and_ I introduce tools designed to expedite ramp-up time for teams who want to deliver, quickly.

TRANSCRIPT

Page 2: the Spring Update from JavaOne 2013

ABOUT ME

interested in big data, the open web, cloud and all things Spring.

About Josh Long @Starbuxman [email protected] [email protected]

Developer Advocate

Page 3: the Spring Update from JavaOne 2013

SPRING IS.. SPRING.IO

WEB

Controllers, REST,WebSocket

INTEGRATION

Channels, Adapters,Filters, Transformers

BATCH

Jobs, Steps,Readers, Writers

BIG DATA

Ingestion, Export,Orchestration, Hadoop

DATA

NON-RELATIONALRELATIONAL

CORE

GROOVYFRAMEWORK SECURITY REACTOR

GRAILS

Full-stack, Web

XD

Stream, Taps, Jobs

BOOT

Bootable, Minimal, Ops-Ready

Page 4: the Spring Update from JavaOne 2013

SPRING IS.. SPRING.IO

Page 5: the Spring Update from JavaOne 2013

SPRING IS.. SPRING.IO

Page 6: the Spring Update from JavaOne 2013

SPRING IS.. SPRING.IO

Page 7: the Spring Update from JavaOne 2013

SPRING IS.. SPRING.IO

Page 8: the Spring Update from JavaOne 2013

SPRING IS.. SPRING.IO

Page 9: the Spring Update from JavaOne 2013

SPRING.IO IS REFERENCE IN ACTION

Page 10: the Spring Update from JavaOne 2013

REST DESIGN WITH SPRING

H T T P : / / S P R I N G . I O

Demo

Page 11: the Spring Update from JavaOne 2013

SPRING IS.. GITHUB

Page 12: the Spring Update from JavaOne 2013

SPRING WORKS IN MANY LANGUAGES

Spring loves the JVM: Java (5,6,7, and 8), Groovy, Scala, etc.

Page 13: the Spring Update from JavaOne 2013

SPRING WORKS IN MANY LANGUAGES

val applicationContext = new FunctionalConfigApplicationContext( classOf[ServiceConfiguration])

// ServiceConfiguration.scala class ServiceConfiguration extends FunctionalConfiguration { importClass(classOf[DataSourceConfiguration])

val dataSource : DataSource = getBean(“dataSource”)

val jdbcTemplate = bean() { new JdbcTemplate( dataSource ) } val jdbcTransactionManager = bean(“txManager”) { new JdbcTransactionManager(dataSource) }}

Scala

Page 14: the Spring Update from JavaOne 2013

SPRING WORKS IN MANY LANGUAGES

def bb = new BeanBuilder() bb.loadBeans("classpath:*SpringBeans.groovy") def applicationContext = bb.createApplicationContext()

// MySpringBeans.groovy import o.sf.jdbc.core.JdbcTemplateimport o.sf.jdbc.datasource.DataSourceTransactionManager

beans {

jdbcTemplate(JdbcTemplate) { dataSource = dataSource }

transactionManager(DataSourceTransactionManager) { dataSource = dataSource }}

Groovy

Page 15: the Spring Update from JavaOne 2013

SPRING WORKS IN MANY LANGUAGES

ApplicationContext applicationContext = new AnnotationConfigApplicationContext( ServiceConfiguration.class);

// ServiceConfiguration.java @Configuration@ComponentScan@Import(DataSourceConfiguration.class) @EnableTransactionManagementclass ServiceConfiguration { @Bean public JdbcTemplate jdbcTemplate(DataSource dataSource) throws Exception { return new JdbcTemplate( dataSource ); }

@Bean public PlatformTransactionManager jdbcTransactionManager(DataSource dataSource){ return new JdbcTransactionManager (dataSource ); } }

Java

Page 16: the Spring Update from JavaOne 2013

SPRING WORKS IN MANY LANGUAGES

Java 8a quick note on Delayed again! from 09/2013 to as late as 03/2014!

Meanwhile, even has lambas...

...C++

Page 17: the Spring Update from JavaOne 2013

SPRING WORKS IN MANY LANGUAGES

Java 8a quick note on IDE Support:

IntelliJ IDEA has had Java 8 support for a year Eclipse won’t have any until June 2014 (..!!) Eclipse-based Spring Tool Suite (STS) has beta Java 8 support.

Page 18: the Spring Update from JavaOne 2013

SPRING WORKS IN MANY LANGUAGES

Java 8a quick note on Spring 4.0 to be GA against Developer Preview by end of 2013.

Method references are a great fit for Spring!

JdbcTemplate jdbcTemplate;

// method references private Customer map(ResultSet rs, int rowNum) throws SQLException { return new Customer( rs.getString("name"), rs.getInt("age") );}

// let it satisfy the `RowMapper` functional interfaceCustomer customer = jdbcTemplate.queryForObject( "select name, age from customers ", this::map);

Page 19: the Spring Update from JavaOne 2013

SPRING WORKS IN MANY LANGUAGES

Java 8a quick note on Spring 4.0 to be GA against Developer Preview by end of 2014.

lambas are a great fit for Spring!

JdbcTemplate jdbc;

Customer customer = jdbc.queryForObject(sql, (rs, rowNum) -> new Customer(rs.getLong("id")));

Page 20: the Spring Update from JavaOne 2013

SPRING WORKS IN MANY LANGUAGES

Java 8a quick note on Spring 4.0 to be GA against Developer Preview by end of 2014.

lambas are a great fit for Spring and Twitter!

Page 21: the Spring Update from JavaOne 2013

SPRING WORKS IN MANY LANGUAGES

Java 8a quick note on JSR-310 - Date and Time

// declarative date format import java.time.*;import org.springframework.format.annotation.*;

public class Customer {

@DateTimeFormat(iso=ISO.DATE) private LocalDate birthDate;

@DateTimeFormat(pattern="M/d/yy h:mm") private LocalDateTime lastContact;

}

Page 22: the Spring Update from JavaOne 2013

SPRING WORKS IN MANY LANGUAGES

Java 8a quick note on Repeatable Annotations

@Scheduled(cron = "0 0 12 * * ?")@Scheduled(cron = "0 0 18 * * ?")public void performTempFileCleanup() { ... }

Page 23: the Spring Update from JavaOne 2013

SPRING WORKS IN MANY LANGUAGES

Java 8a quick note on Spring 4.0

JDK 6 -> JDK 8 Java EE 5 (with JPA 2.0 feature pack) -> Java EE 7

Page 24: the Spring Update from JavaOne 2013

SPRING RUNS WELL ON JAVA EE 7

Spring works well in Java EE environmentsSupports Java EE 7: Date/Time API, JTA 1.2, JMS 2.0, JPA 2.1, Bean Validation 1.1, the new concurrency API in JSR-236, Servlet 3.1, and WebSockets (JSR 356)

Even participated in a few JSRs: the websocket JSR (356) and the Batch JSR (352)

Page 25: the Spring Update from JavaOne 2013

SPRING IS WHERE YOU ARE

Page 26: the Spring Update from JavaOne 2013

SPRING IS WHERE YOU ARE

Page 27: the Spring Update from JavaOne 2013

SPRING IS WHERE YOU ARE

Page 28: the Spring Update from JavaOne 2013

SPRING IS WHERE YOU ARE

Page 29: the Spring Update from JavaOne 2013

S P R I N G C L O U D A N D

Demo

Page 30: the Spring Update from JavaOne 2013

SPRING SUPPORTS NOSQL

Spring supports all the SQLs: NoSQL, NOSQL, and SQL

Page 31: the Spring Update from JavaOne 2013

SIMPLIFIED DATA ACCESS++

Spring Data offers conventional repositories, *Template implementations, unified data access exception handling

Page 32: the Spring Update from JavaOne 2013

S P R I N G D ATA J PA R E P O S I T O R I E S

Demo

Page 33: the Spring Update from JavaOne 2013

S P R I N G D ATA R E D I S C A C H E :

Demo

Page 34: the Spring Update from JavaOne 2013

SPRING SUPPORTS

Surviving the Big DataWild-West withSpring for Hadoop

Page 35: the Spring Update from JavaOne 2013

SPRING SUPPORTS

But How Do You Process Data Realtime?@metamarkets founder Michael E. Driscoll:

Page 36: the Spring Update from JavaOne 2013

SPRING SUPPORTS

Introducing Spring XD

sources

sinks

Page 37: the Spring Update from JavaOne 2013

S P R I N G X D A N D P I V O TA L H D

Demo

Page 38: the Spring Update from JavaOne 2013

SPRING IS.. MESSAGING AND INTEGRATION FRIENDLY

Spring’s REST and Security support

AsyncRestTemplateHypermedia Links

@RestController

Websocket

Page 39: the Spring Update from JavaOne 2013

S P R I N G C R M R E S T D E M O

Demo

Page 40: the Spring Update from JavaOne 2013

SPRING IS EASY TO GET STARTED WITH

Boot

Autoconfigure

Starters

CLI

Actuator

Tools

Samples

Bootstrap your productivity

Page 41: the Spring Update from JavaOne 2013

SPRING SUPPORTS CONVENTION OVER CONFIGURATION

Page 42: the Spring Update from JavaOne 2013

SPRING SUPPORTS CONVENTION OVER CONFIGURATION

Page 43: the Spring Update from JavaOne 2013

S P R I N G B O O T T O M C AT S A M P L E

Demo

Page 44: the Spring Update from JavaOne 2013

SPRING IS.. MESSAGING AND INTEGRATION FRIENDLY

Spring gets (and sends!) websocketsWebSockets delegating to implementations on app servers like GlassFish, Tomcat, and Jetty

Supports Sock.js server, superset of WS.

higher level STOMP supported on WS

supports JSR 356 (javax.websocket.*) support.

Page 45: the Spring Update from JavaOne 2013

W E B S O C K E T T R A D E R

Demo