SlideShare ist ein Scribd-Unternehmen logo
1 von 105
Downloaden Sie, um offline zu lesen
Josh Long (⻰龙之春)
@starbuxman
joshlong.com
josh.long@springsource.com
slideshare.net/joshlong
github.com/joshlong
http://spring.io

H AV E Y O U S E E N

L AT E LY ?

http://joshlong.github.io/have-you-seen-spring-lately/
I AM…

Josh Long (⻰龙之春)
Spring Developer Advocate
@starbuxman
Jean Claude
van Damme!

| josh.long@springsource.com
Java mascot Duke

some thing’s I’ve authored...
THE SPRING IO PLATFORM (SOME “MARCHITECTURE”)

Deploy to Cloud
or on premise

Big,
Fast,
Flexible
Data
GemFire

Core

Model
Web,
Integration,
Batch
THE SPRING IO PLATFORM (SOME ARCHITECTURE)

XD

BOOT

GRAILS

Stream, Taps, Jobs

Bootable, Minimal, Ops-Ready

Full-stack, Web

INTEGRATION

BATCH

BIG DATA

WEB

Channels, Adapters,

Filters, Transformers

Jobs, Steps,

Readers, Writers

Ingestion, Export,

Orchestration, Hadoop

Controllers, REST,

WebSocket

DATA
RELATIONAL

NON-RELATIONAL

CORE
FRAMEWORK

SECURITY

GROOVY

REACTOR
SPRING.IO
SPRING.IO
SPRING.IO
SPRING.IO
SPRING.IO
SPRING.IO IS BEST-PRACTICES ORIENTED
WE’RE ON GITHUB
SPRING BOOT IS ABOUT PRODUCTIVITY

CLI

Bootstrap 

your productivity

Starters
Autoconfigure

Boot
Actuator
Tools
Samples
SPRING BOOT IS CONCISE (AND TWEETABLE!)
DEMO:

A GROOVY BOOT APP
DEMO:

B O O T, G E T T I N G S TA R T E D G U I D E S ,
& STS
SPRING LOVES THE JVM

Spring loves the JVM: 

Java (5,6,7, and 8), Groovy, Scala, etc.
SPRING SCALA

Scala

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)
}

}
GROOVY BEAN BUILDER

Groovy

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

!

// MySpringBeans.groovy

import o.sf.jdbc.core.JdbcTemplate
import o.sf.jdbc.datasource.DataSourceTransactionManager

!
beans {
!
!
}

!

jdbcTemplate(JdbcTemplate) {
dataSource = dataSource
}
transactionManager(DataSourceTransactionManager) {
dataSource = dataSource
}
JAVA CONFIGURATION

Java

ApplicationContext applicationContext =
new AnnotationConfigApplicationContext( ServiceConfiguration.class);

!
!

// ServiceConfiguration.java

@Configuration
@ComponentScan
@Import(DataSourceConfiguration.class)
@EnableTransactionManagement
class ServiceConfiguration {

!
}

@Bean
public JdbcTemplate jdbcTemplate(DataSource dataSource) throws Exception {
return new JdbcTemplate( dataSource );
}
@Bean
public PlatformTransactionManager jdbcTransactionManager(DataSource dataSource){
return new JdbcTransactionManager (dataSource );
}
SPRING 4 IS JAVA 8 READY

a quick note on

Java 8

...
!

Delayed again! from 09/2013 to as late as 03/2014!
Meanwhile, even

C++ has lambas...
BUT ARE THE IDES JAVA 8 READY?

a quick note on

Java 8

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.

!
!
JAVA 8 METHOD REFERENCES ARE A GREAT FIT FOR SPRING

a quick note on

Java 8

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 interface
Customer customer = jdbcTemplate.queryForObject(
"select name, age from customers ",
this::map);
JAVA 8 LAMBAS ARE A GREAT FIT FOR SPRING

a quick note on

Java 8

Spring 4.0 to be GA against Developer Preview by end of 2014.

!
lambas are a great fit for Spring and Twitter!
SPRING 4 AND JAVA 8

a quick note on

Java 8

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;
SPRING 4 AND JAVA 8

a quick note on

Java 8

Repeatable Annotations
@Scheduled(cron = "0 0 12 * * ?")
@Scheduled(cron = "0 0 18 * * ?")
public void performTempFileCleanup() {
...
}
REST DESIGN WITH SPRING
LET’S TURN OUR GAZE TO A TIME, LONG AGO, WHEN…

dumb clients roamed the earth... like dinosaurs
THEN MAGIC HAPPENED…

1989
magic happens: Tim Berners Lee & 

Robert Cailliau create the world wide web
WE TRIED TO ‘FIX’ HTTP. THIS REMINDS ME OF A STORY…
FINALLY, WE GOT OUR ACT TOGETHER
JAVASCRIPT BOOTS LINUX!
SO HOW DO OUR SMART CLIENTS CONNECT TO OUR SERVICES?

when someone uses SOAP because it’s “simple”
USE REST, OF COURSE!

REST Is..
!
• URI’s identify resources
• HTTP verbs describe a limited set of operations that can be used to manipulate
a resource
– GET
– DELETE
– PUT
– POST
– less used other verbs
• Headers help describe the messages
WHAT IS REST? (…BABY DON’T HURT ME, NO MORE…)

The Richardson Maturity Model
Level 0: swamp of POX

Uses HTTP mainly as a tunnel through one URI

e.g., SOAP, XML-RPC




Usually features on HTTP verb (POST)


http://martinfowler.com/articles/richardsonMaturityModel.html
LEVEL 1: URIS TO DISTINGUISH NOUNS

The Richardson Maturity Model
Level 1: resources

Multiple URIs to distinguish related nouns 

e.g., /articles/1, /articles/2, vs. just /articles




http://martinfowler.com/articles/richardsonMaturityModel.html
LEVEL 2: GROUND ZERO USING SPRING MVC

The Richardson Maturity Model
Level 2: HTTP verbs

leverage transport-native properties to enhance service 

e.g., HTTP GET and PUT and DELETE and POST




Uses idiomatic HTTP controls like status codes, headers 


http://martinfowler.com/articles/richardsonMaturityModel.html
TANGENT: A QUICK PRIMER ON SPRING MVC

incoming
requests

delegate
request
DispatcherServlet

return
response

model
delegate
rendering of
response

model
return
control

render
response

view
template

controller
REST DESIGN WITH SPRING

import static ...RequestMethod.* ;
import static ...MediaType.* ;

!

@RestController
@RequestMapping (value = “/users/”)
class UserController {

!

@RequestMapping (method = DELETE, value = “/{user}”)
User delete(@PathVariable Long user) {
return crmService.removeUser(user);
}
@RequestMapping (method = GET, value = “/{user}”)
User read(@PathVariable Long user) {
return crmService.findById(user);
}

..
}
DEMO:

BUILDING REST WEB SERVICES
REST DESIGN WITH SPRING
LEVEL 3: HATEOAS, OR THE UNPRONOUNCEABLE ACRONYM

The Richardson Maturity Model
Level 3: Hypermedia Controls (aka, HATEOAS)

No a priori knowledge of service required

Navigation options are provided by service and hypermedia controls




Promotes longevity through a uniform interface




http://martinfowler.com/articles/richardsonMaturityModel.html
http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven
METADATA == LINKS

The Richardson Maturity Model
Level 3: Hypermedia Controls (aka, HATEOAS)

Links provide possible navigations from a given resource
Links are dynamic, based on resource state.

!

<link href=“http://...:8080/users/232/customers” 

rel= “customers”/>
http://martinfowler.com/articles/richardsonMaturityModel.html
http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven
REST DESIGN WITH SPRING

import static ...RequestMethod.* ;
import static ...MediaType.* ;

!

@RestController
@RequestMapping (value = “/users/” )
class UserController {

!
!

@Inject ResourceAssembler<User, Resource<User>> userResourceAssembler;

@RequestMapping (method = DELETE, value = “/{user}”)
Resource<User> delete(@PathVariable Long user) {
return userResourceAssembler.toResource( crmService.removeUser(user) );
}
@RequestMapping (method = DELETE, value = “/{user}”)
Resource<User> read(@PathVariable Long user) {
return userResourceAssembler.toResource( crmService.findById(user));
}

..
!

REST DESIGN WITH SPRING

@Component
class UserResourceAssembler implements ResourceAssembler<User, Resource<User>> {

!
!
	

	

public Resource<User> toResource(User user) {
Resource<User> userResource = new Resource<User>(user);
Collection<Link> links = new ArrayList<Link>();
Link toPhoto = linkTo( methodOn(UserProfilePhotoController.class)
.loadUserProfilePhoto( user.getId() ))
.withRel(“photos”);
	
	
	
	
	
Link toSelf = linkTo( methodOn( UserController.class))
.loadUser( user.getId() ))
.withSelfRel();
	
	
	
	
	
	
	
Resource<User> userResource =
new Resource<User>(user, Arrays.asList(toSelf, toPhoto));
DEMO:

EMBRACING HYPERMEDIA
REST DESIGN WITH SPRING
SPRING’S WEBSOCKETS SUPPORT

WebSockets 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.
REST DESIGN WITH SPRING

Handling WebSocket Subscription
@Controller
class PortfolioController {
…
@MessageMapping("/app/trade")
void handleTradeOrder(Trade trade, Principal principal) {
trade.setUsername(principal.getName());
tradeService.executeTrade(trade);
}
 
@SubscribeEvent("/app/positions")
List<PortfolioPosition> subscribeToPortfolios(Principal principal) {
    String user = principal.getName();
    Portfolio portfolio = portfolioService.findPortfolio(user);
    return portfolio.getPositions();
}
}
REST DESIGN WITH SPRING

Handling Messages Over STOMP
!

@Controller
public class GreetingController {

!
!

// Mapping based on "destination" header

!

}

@MessageMapping("/greeting")
@SendTo("/topic/greetings")
public String greet(@MessageBody String greeting) {
return "[" + getTimestamp() + "]: " + greeting;
}
REST DESIGN WITH SPRING

Configuring a STOMP WebSocket broker
@Configuration
@EnableWebSocketMessageBroker
public class Config implements WebSocketMessageBrokerConfigurer {

!
!

@Override
public void registerStompEndpoints(StompEndpointRegistry r) {
r.addEndpoint("/portfolio"); // WebSocket URL prefix
}

!

@Override
public void configureMessageBroker(MessageBrokerConfigurer c) {
c.enableSimpleBroker("/topic/"); // destination prefix
}

!
}
DEMO:

WEBSOCKETS
REST DESIGN WITH SPRING
SECURITY

Spring Security is a modern
security framework for a
modern age

!

• OAuth
• sign in / out & “Remember Me” support
• Kerbreros
• CAS
• pam
• ActiveDirectory / LDAP
• Encryption (TLS/SSL integration)
• x509 certificates
• OpenID
SECURITY

Spring Security is a modern security
framework for a modern age

!

Yes
client submits
authentication
credentials

Authentication
Mechanism
collects the details

No - retry!

Authentication is
valid?

Store Authentication in
SecurityContextHolder

process original request
SECURITY

Spring Security is a modern security
framework for a modern age

!

Yes
client submits
authentication
credentials

Authentication
Mechanism
collects the details
Authentication

Store Authentication in
SecurityContextHolder

Authentication is
valid?

Mechanism collects the details!

!
No AuthenticationRequest is sent to AuthenticationManager!
- retry!
!
(passes it through a chain of AuthenticationProviders)!
!
AuthenticationProvider asks a UserDetailsService for a UserDetails!
!
The UserDetails object is used to build an Authentication object!
!
!

process original request
SECURITY

!
Spring Security features a
clean Java configuration
API

@Configuration
@EnableWebSecurity
class SecurityConfig extends WebSecurityConfigurerAdapter {

!

!

}

@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth)
throws Exception {
auth
.inMemoryAuthentication()
.withUser("user").password("password").roles("USER");
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/").permitAll()
.antMatchers("/api/*").authenticated();
http.formLogin()
.loginPage("/login")
.passwordParameter("pw")
.usernameParameter("user");
http.x509();
}
A CONNECTED WORLD WITH SPRING SOCIAL

* source: visual.ly/60-seconds-social-media

A Connected World in 00:60 seconds

700ksent
messages

1090
visitors

2000
checkins

175k
tweets

7610
searches

2MM
videos viewed

3125
photos uploaded

7630sent
messages
CONNECTING USING OAUTH
CONNECTING WITH SPRING
REST DESIGN USING OAUTH
CONNECTING WITH SPRING
REST DESIGN USING OAUTH
SPRING SOCIAL’S THIRD PARTY APIS
REST DESIGN WITH SPRING

Setting up Spring Social
@Configuration
@EnableJdbcConnectionRepository
@EnableFacebook(appId="${facebook.clientId}",
appSecret="${facebook.clientSecret}")
@EnableTwitter(appId=“${twitter.consumerKey}",
appSecret="${twitter.consumerSecret}")
@EnableLinkedIn(appId="${linkedin.consumerKey}",
appSecret="${linkedin.consumerSecret}")
public class SocialConfig {
// ...
REST DESIGN WITH SPRING

Setting up Spring Social
@Controller
class FacebookFriendsController {

!
	
!
	
	
	
	
	
	
}

!

@Inject Facebook facebook;
@RequestMapping(value="/facebook/friends", method=GET)
public String showFeed(Model model) {
	
model.addAttribute("friends", facebook.friendOperations().getFriendProfiles());
	
return "facebook/friends";
}
DEMO:

C O N N E C T I N G A P P L I C AT I O N S T O
USERS WITH SPRING SOCIAL
REST DESIGN WITH SPRING
MOBILE FIRST APPLICATIONS

units (in millions) of units of each type of platform shipped
Linux Phone
BlackBerry
Symbian
Windows Mobile
iOS
Android

2Q 2012

2Q 2013
0

50

100

150

http://www.idc.com/getdoc.jsp?containerId=prUS24257413

200
MOBILE FIRST APPLICATIONS

Spring Android brings Spring core’s RestTemplate. 



Spring Social and Spring HATEOAS work as well.
DEMO:

SMARTER MOBILE CLIENTS
REST DESIGN WITH SPRING
SPRING SUPPORTS JAVA EE

Spring works well in Java EE environments
!Supports 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)
SPRING WORKS WELL IN THE CLOUD
SPRING PROFILES MAKE IT EASY TO ADAPT

@Configuration
@Profile("cloud")
public class CloudConfig {

!

@Bean public Cloud cloud() throws CloudException {
CloudFactory cloudFactory = new CloudFactory();
return cloudFactory.getCloud();
}

 
@Bean public DataSource dataSource() {
            return cloud().getSingletonServiceConnector(DataSource.class, null);   
    }
}
YOU MIGHT CHECK OUT, FOR EXAMPLE, THE SPRING MUSIC APP
CLOUD FOUNDRY COMES WITH BATTERIES INCLUDED
…AND A RICH ECOSYSTEM OF THIRD PARTY INTEGRATIONS
SPRING IS THE LEADING COMPONENT MODEL

Glassfish
Websphere
WebLogic
JBoss
Jetty
Apache Tomcat

% of survey of 1800
Java developers. 	

Multiple choices.

0

15

30

45

Source: ZeroTurnaround Developer Productivity Report 2012

60
SPRING INTEGRATION MAKES EIP EASY

Integration
• ! hard to get right
• patterned after “EIP book” patterns
• supports numerous adapters and gateways for external
systems
AVOID RUBE GOLDBERG MACHINES
BATCH AND INTEGRATION

<?xml version="1.0" encoding="UTF-8"?>
<beans ...>

!
!
!
!

<int:channel id="jobsToLaunch"/>
<int:channel id="filesReceived"/>
<int:channel id="jobExecutions"/>
<file:inbound-channel-adapter auto-create-directory="true" channel="filesReceived"
directory="#{systemProperties['user.home']}/Desktop/in">
<int:poller fixed-rate="1000"/>
</file:inbound-channel-adapter>
<int:transformer ref="fileBatchJobRequestTransformer"
input-channel="filesReceived" output-channel="jobsToLaunch"/>
<int:service-activator input-channel="jobsToLaunch"
ref="jobMessageHandler" output-channel="jobExecutions"/>

!
<stream:stdout-channel-adapter id="jobsPrinted" append-newline="true" channel="jobExecutions"/>
!
</beans>
BATCH AND INTEGRATION

@Configuration
@Import(BatchConfiguration.class)
@ComponentScan
@ImportResource("/com/joshlong/spring/walkingtour/services/integration/context.xml")
class IntegrationConfiguration {

!

!

}

@Bean
JobLaunchingMessageHandler jobMessageHandler(
JobLauncher jobLauncher) throws Exception {
return new JobLaunchingMessageHandler(jobLauncher);
}
BATCH AND INTEGRATION

Batch Processing...
• ! avoids idle computing resources
• allows the system to use different priorities for batch and
interactive work
• supports numerous sinks and sources
• supports JSR 352 - Batch Applications
BATCH AND INTEGRATION
BATCH AND INTEGRATION

Job

*

Step

reader, processor?, writer

*

JobInstance

*
JobExecution

step scope

*

StepExecution
BATCH AND INTEGRATION

!

!
!

!

@Bean Job customerLoaderJob( JobBuilderFactory jobs, Step csvToRDBMS ) {
return jobs.get(“customerLoaderJob”)
.flow(csvToRDBMS).end().build();
}
@Bean Step csvToRDBMS(
StepBuilderFactory stepBuilderFactory,
PlatformTransactionManager platformTransactionManager,
ItemReader <Customer> itemReader,
ItemProcessor <Customer, Customer> itemProcessor,
ItemWriter <Customer> itemWriter) {
StepBuilder builder = stepBuilderFactory.get(“csvToRDBMS”);

}

return builder.<Customer, Customer>
chunk(3)
.reader(itemReader)
.processor(itemProcessor)
.writer(itemWriter)
.transactionManager(platformTransactionManager)
.build();

FlatFileItemReader

JdbcBatchItemWriter
DEMO:

U S I N G S P R I N G B AT C H &
I N T E G R AT I O N
SPRING SUPPORTS ALL THE DATA!

Spring supports all the SQLs: 

NoSQL, NOSQL, and SQL
!
REST DESIGN WITH SPRING

!

import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.repository.annotation.RestResource;

!
import java.util.List;
!

@RestResource (path = "users", rel = "users")
public interface UserRepository extends PagingAndSortingRepository<User, Long> {

!

// select * from users where username = ?
User findByUsername(@Param("username") String username);

!

!
}

// select * from users where firstName =? or lastName = ? or username = ?
List<User> findUsersByFirstNameOrLastNameOrUsername(
@Param("firstName") String firstName,
@Param("lastName") String lastName,
@Param("username") String username);
PROJECT REACTOR

The future is Reactive
!

Reactor: foundational
library. Drives drivers,
servers, data integration
libraries, domain
integration libraries, and
evented architectures

!
Used in: Spring
Integration, websocket =>
STOMP support, Grails,
etc.
PROJECT REACTOR

without Spring
Environment env = new Environment();

!

Reactor reactor = Reactors.reactor()
	
.env(env)
	
.dispatcher(RING_BUFFER)
	
.get();

ThreadPoolExecutorDispatcher
BlockingQueueDispatcher
…
RingBufferDispatcher

!

reactor.on($(“topic”), (Event<String> ev) -> {
System.out.println(“Hello “ + ev.getData());
});

!

reactor.notify(“topic”, Event.wrap(“John Doe”));
PROJECT REACTOR

with Spring
@EnableReactor
@Configuration
@ComponentScan
class ReactorConfiguration {

!
	

	
	
	
	
}

@Bean
Reactor reactor(Environment env) {
	
return Reactors.reactor().env(env)
	 .dispatcher(
Environment.RING_BUFFER)
	
.get();
}	

@Component
class EvenConsumer {

!
	
	
	
	
}

@Selector("test.topic")
public void onTestTopic(String s) {
	
log.info("onTestTopic: {}", s);
}

!

@Service
class EventPublisher {

!
	
	
	
	
	

	
}

@Autowired
Reactor reactor;
public void fire(String msg) {
	
reactor.notify(
"test.topic", Event.wrap( msg ));
}
PROJECT REACTOR

Streams like Netflix RxJava Observable, JDK 8 Stream
Stream <String> str = …;

!

str.map(String::toUpperCase)
	
.filter(new Predicate<String>() {
	
public boolean test(String s) { … }
	
})
	
.consume(s → log.info(“consumed string {}”, s));
PROJECT REACTOR

Did I mention it’s fast?

https://github.com/reactor/reactor-si-quickstart
SPRING WORKS WELL WITH

Surviving the Big Data
Wild-West with

Spring for Hadoop
SPRING XD AND STREAM PROCESSING

Getting Data into the System is Hard
@metamarkets founder Michael E. Driscoll:
SPRING XD AND STREAM PROCESSING

sinks

sources

Introducing Spring XD

xd:> stream create --definition "time | log" --name ticktock
DEMO:

SPRING FOR HADOOP AND
SPRING XD
REST DESIGN WITH SPRING
SOME SPRING USERS
“

china
on 11/11/2012 (the “Double Sticks” promotion
day), Tmall and Taobao witnessed 147 million
user visits, purchases of 30 million people and
nearly 100 million paid orders. At 0:00, more
than 10 million users were concurrently online

”

* source: http://www.infoq.com/news/2012/12/interview-taobao-tmall
http://spring.io/blog/2013/03/04/spring-at-china-scale-alibaba-group-alipay-taobao-and-tmall/
Spring and RabbitMQ:
powering India’s 1.2 B Person Biometric DB
• 1.2 billion residents
• ~75% literacy
• less than 3% pay incomes taxes
• less than 20% banking
• 800 million mobile, ~200-300 million migrant
workers

!
• Government spends about $25-40 billion on
direct attributes
• residents have no standard identity
• most programs plagued with ghost and multiple
identities causing leakage of 30-40%

india
japan

• traded on JASDAQ
• largest Java consultancy in Japan
• Spring Batch
– handles customer profile information and real-time ad matching system

• Spring is agile enabler
– production control system
– just-in-time production is really the heart of manufacturing
– cost decreased 30%
china

• 1.3 billion people in China
• Google is either mostly blocked or - from Hong
Kong - very slow

!
• Baidu has its own Android operating system, cloud
services (like GMail, Dogs, etc.)

!
• Built micro service architecture that builds on top of
Spring

!
• Custom web frameworks using Spring XML
namespaces as global integration API
http://blog.gopivotal.com/products/have-you-seen-spring-lately

Any

?

Questions
@starbuxman @springcentral
josh.long@springsource.com
josh@joshlong.com
github.com/joshlong
slideshare.net/joshlong

Weitere ähnliche Inhalte

Was ist angesagt?

Java REST API Framework Comparison - UberConf 2021
Java REST API Framework Comparison - UberConf 2021Java REST API Framework Comparison - UberConf 2021
Java REST API Framework Comparison - UberConf 2021Matt Raible
 
Elasticsearch for SQL Users
Elasticsearch for SQL UsersElasticsearch for SQL Users
Elasticsearch for SQL UsersAll Things Open
 
How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...
How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...
How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...David Kaneda
 
Learning from the Best jQuery Plugins
Learning from the Best jQuery PluginsLearning from the Best jQuery Plugins
Learning from the Best jQuery PluginsMarc Grabanski
 
JAX-RS JavaOne Hyderabad, India 2011
JAX-RS JavaOne Hyderabad, India 2011JAX-RS JavaOne Hyderabad, India 2011
JAX-RS JavaOne Hyderabad, India 2011Shreedhar Ganapathy
 
#NoXML: Eliminating XML in Spring Projects - SpringOne 2GX 2015
#NoXML: Eliminating XML in Spring Projects - SpringOne 2GX 2015#NoXML: Eliminating XML in Spring Projects - SpringOne 2GX 2015
#NoXML: Eliminating XML in Spring Projects - SpringOne 2GX 2015Matt Raible
 
Developing, Testing and Scaling with Apache Camel - UberConf 2015
Developing, Testing and Scaling with Apache Camel - UberConf 2015Developing, Testing and Scaling with Apache Camel - UberConf 2015
Developing, Testing and Scaling with Apache Camel - UberConf 2015Matt Raible
 
Spark IT 2011 - Developing RESTful Web services with JAX-RS
Spark IT 2011 - Developing RESTful Web services with JAX-RSSpark IT 2011 - Developing RESTful Web services with JAX-RS
Spark IT 2011 - Developing RESTful Web services with JAX-RSArun Gupta
 
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx UK 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx UK 2016Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx UK 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx UK 2016Matt Raible
 
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Angular Summit 2015
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Angular Summit 2015Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Angular Summit 2015
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Angular Summit 2015Matt Raible
 
React & The Art of Managing Complexity
React &  The Art of Managing ComplexityReact &  The Art of Managing Complexity
React & The Art of Managing ComplexityRyan Anklam
 
Keypoints html5
Keypoints html5Keypoints html5
Keypoints html5dynamis
 
Avoiding Common Pitfalls in Ember.js
Avoiding Common Pitfalls in Ember.jsAvoiding Common Pitfalls in Ember.js
Avoiding Common Pitfalls in Ember.jsAlex Speller
 
CTS Conference Web 2.0 Tutorial Part 2
CTS Conference Web 2.0 Tutorial Part 2CTS Conference Web 2.0 Tutorial Part 2
CTS Conference Web 2.0 Tutorial Part 2Geoffrey Fox
 
High Performance JavaScript (CapitolJS 2011)
High Performance JavaScript (CapitolJS 2011)High Performance JavaScript (CapitolJS 2011)
High Performance JavaScript (CapitolJS 2011)Nicholas Zakas
 
Not Only Streams for Akademia JLabs
Not Only Streams for Akademia JLabsNot Only Streams for Akademia JLabs
Not Only Streams for Akademia JLabsKonrad Malawski
 
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - GeekOut 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - GeekOut 2016Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - GeekOut 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - GeekOut 2016Matt Raible
 

Was ist angesagt? (20)

Java REST API Framework Comparison - UberConf 2021
Java REST API Framework Comparison - UberConf 2021Java REST API Framework Comparison - UberConf 2021
Java REST API Framework Comparison - UberConf 2021
 
Elasticsearch for SQL Users
Elasticsearch for SQL UsersElasticsearch for SQL Users
Elasticsearch for SQL Users
 
How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...
How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...
How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...
 
Learning from the Best jQuery Plugins
Learning from the Best jQuery PluginsLearning from the Best jQuery Plugins
Learning from the Best jQuery Plugins
 
JAX-RS JavaOne Hyderabad, India 2011
JAX-RS JavaOne Hyderabad, India 2011JAX-RS JavaOne Hyderabad, India 2011
JAX-RS JavaOne Hyderabad, India 2011
 
#NoXML: Eliminating XML in Spring Projects - SpringOne 2GX 2015
#NoXML: Eliminating XML in Spring Projects - SpringOne 2GX 2015#NoXML: Eliminating XML in Spring Projects - SpringOne 2GX 2015
#NoXML: Eliminating XML in Spring Projects - SpringOne 2GX 2015
 
Developing, Testing and Scaling with Apache Camel - UberConf 2015
Developing, Testing and Scaling with Apache Camel - UberConf 2015Developing, Testing and Scaling with Apache Camel - UberConf 2015
Developing, Testing and Scaling with Apache Camel - UberConf 2015
 
Ajax Security
Ajax SecurityAjax Security
Ajax Security
 
Spark IT 2011 - Developing RESTful Web services with JAX-RS
Spark IT 2011 - Developing RESTful Web services with JAX-RSSpark IT 2011 - Developing RESTful Web services with JAX-RS
Spark IT 2011 - Developing RESTful Web services with JAX-RS
 
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx UK 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx UK 2016Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx UK 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx UK 2016
 
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Angular Summit 2015
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Angular Summit 2015Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Angular Summit 2015
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Angular Summit 2015
 
React & The Art of Managing Complexity
React &  The Art of Managing ComplexityReact &  The Art of Managing Complexity
React & The Art of Managing Complexity
 
Keypoints html5
Keypoints html5Keypoints html5
Keypoints html5
 
Avoiding Common Pitfalls in Ember.js
Avoiding Common Pitfalls in Ember.jsAvoiding Common Pitfalls in Ember.js
Avoiding Common Pitfalls in Ember.js
 
What is HTML 5?
What is HTML 5?What is HTML 5?
What is HTML 5?
 
CTS Conference Web 2.0 Tutorial Part 2
CTS Conference Web 2.0 Tutorial Part 2CTS Conference Web 2.0 Tutorial Part 2
CTS Conference Web 2.0 Tutorial Part 2
 
High Performance JavaScript (CapitolJS 2011)
High Performance JavaScript (CapitolJS 2011)High Performance JavaScript (CapitolJS 2011)
High Performance JavaScript (CapitolJS 2011)
 
Not Only Streams for Akademia JLabs
Not Only Streams for Akademia JLabsNot Only Streams for Akademia JLabs
Not Only Streams for Akademia JLabs
 
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - GeekOut 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - GeekOut 2016Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - GeekOut 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - GeekOut 2016
 
Os Johnson
Os JohnsonOs Johnson
Os Johnson
 

Ähnlich wie Spring REST APIs with HATEOAS and WebSockets

Building Tomorrow's Web Services
Building Tomorrow's Web ServicesBuilding Tomorrow's Web Services
Building Tomorrow's Web ServicesPat Cappelaere
 
Java Technology
Java TechnologyJava Technology
Java Technologyifnu bima
 
JSON REST API for WordPress
JSON REST API for WordPressJSON REST API for WordPress
JSON REST API for WordPressTaylor Lovett
 
Connect js nodejs_api_shubhra
Connect js nodejs_api_shubhraConnect js nodejs_api_shubhra
Connect js nodejs_api_shubhraShubhra Kar
 
Paul Fremantle Restful SOA Registry
Paul Fremantle Restful SOA RegistryPaul Fremantle Restful SOA Registry
Paul Fremantle Restful SOA Registrydeimos
 
LAJUG Napster REST API
LAJUG Napster REST APILAJUG Napster REST API
LAJUG Napster REST APIstephenbhadran
 
Picking the Right Node.js Framework for Your Use Case
Picking the Right Node.js Framework for Your Use CasePicking the Right Node.js Framework for Your Use Case
Picking the Right Node.js Framework for Your Use CaseJimmy Guerrero
 
Node.js Frameworks & Design Patterns Webinar
Node.js Frameworks & Design Patterns WebinarNode.js Frameworks & Design Patterns Webinar
Node.js Frameworks & Design Patterns WebinarShubhra Kar
 
REST vs WS-*: Myths Facts and Lies
REST vs WS-*: Myths Facts and LiesREST vs WS-*: Myths Facts and Lies
REST vs WS-*: Myths Facts and LiesPaul Fremantle
 
Eclipse Day India 2015 - Rest with Java (jax rs) and jersey
Eclipse Day India 2015 - Rest with Java (jax rs) and jerseyEclipse Day India 2015 - Rest with Java (jax rs) and jersey
Eclipse Day India 2015 - Rest with Java (jax rs) and jerseyEclipse Day India
 
Rest with java (jax rs) and jersey and swagger
Rest with java (jax rs) and jersey and swaggerRest with java (jax rs) and jersey and swagger
Rest with java (jax rs) and jersey and swaggerKumaraswamy M
 
Introduction to REST and Jersey
Introduction to REST and JerseyIntroduction to REST and Jersey
Introduction to REST and JerseyChris Winters
 
The future of server side JavaScript
The future of server side JavaScriptThe future of server side JavaScript
The future of server side JavaScriptOleg Podsechin
 

Ähnlich wie Spring REST APIs with HATEOAS and WebSockets (20)

Building Tomorrow's Web Services
Building Tomorrow's Web ServicesBuilding Tomorrow's Web Services
Building Tomorrow's Web Services
 
Java Technology
Java TechnologyJava Technology
Java Technology
 
Javantura v4 - True RESTful Java Web Services with JSON API and Katharsis - M...
Javantura v4 - True RESTful Java Web Services with JSON API and Katharsis - M...Javantura v4 - True RESTful Java Web Services with JSON API and Katharsis - M...
Javantura v4 - True RESTful Java Web Services with JSON API and Katharsis - M...
 
JSON REST API for WordPress
JSON REST API for WordPressJSON REST API for WordPress
JSON REST API for WordPress
 
REST Presentation
REST PresentationREST Presentation
REST Presentation
 
Connect js nodejs_api_shubhra
Connect js nodejs_api_shubhraConnect js nodejs_api_shubhra
Connect js nodejs_api_shubhra
 
The Glory of Rest
The Glory of RestThe Glory of Rest
The Glory of Rest
 
Modified REST Presentation
Modified REST PresentationModified REST Presentation
Modified REST Presentation
 
Paul Fremantle Restful SOA Registry
Paul Fremantle Restful SOA RegistryPaul Fremantle Restful SOA Registry
Paul Fremantle Restful SOA Registry
 
LAJUG Napster REST API
LAJUG Napster REST APILAJUG Napster REST API
LAJUG Napster REST API
 
Picking the Right Node.js Framework for Your Use Case
Picking the Right Node.js Framework for Your Use CasePicking the Right Node.js Framework for Your Use Case
Picking the Right Node.js Framework for Your Use Case
 
Node.js Frameworks & Design Patterns Webinar
Node.js Frameworks & Design Patterns WebinarNode.js Frameworks & Design Patterns Webinar
Node.js Frameworks & Design Patterns Webinar
 
REST vs WS-*: Myths Facts and Lies
REST vs WS-*: Myths Facts and LiesREST vs WS-*: Myths Facts and Lies
REST vs WS-*: Myths Facts and Lies
 
Eclipse Day India 2015 - Rest with Java (jax rs) and jersey
Eclipse Day India 2015 - Rest with Java (jax rs) and jerseyEclipse Day India 2015 - Rest with Java (jax rs) and jersey
Eclipse Day India 2015 - Rest with Java (jax rs) and jersey
 
Rest with java (jax rs) and jersey and swagger
Rest with java (jax rs) and jersey and swaggerRest with java (jax rs) and jersey and swagger
Rest with java (jax rs) and jersey and swagger
 
Helping Things to REST
Helping Things to RESTHelping Things to REST
Helping Things to REST
 
Advanced soa and web services
Advanced soa and web servicesAdvanced soa and web services
Advanced soa and web services
 
Introduction to REST and Jersey
Introduction to REST and JerseyIntroduction to REST and Jersey
Introduction to REST and Jersey
 
The future of server side JavaScript
The future of server side JavaScriptThe future of server side JavaScript
The future of server side JavaScript
 
Rest web service
Rest web serviceRest web service
Rest web service
 

Mehr von Joshua Long

Bootiful Code with Spring Boot
Bootiful Code with Spring BootBootiful Code with Spring Boot
Bootiful Code with Spring BootJoshua Long
 
REST APIs with Spring
REST APIs with SpringREST APIs with Spring
REST APIs with SpringJoshua Long
 
the Spring 4 update
the Spring 4 updatethe Spring 4 update
the Spring 4 updateJoshua Long
 
The spring 32 update final
The spring 32 update finalThe spring 32 update final
The spring 32 update finalJoshua Long
 
Multi Client Development with Spring
Multi Client Development with SpringMulti Client Development with Spring
Multi Client Development with SpringJoshua Long
 
Integration and Batch Processing on Cloud Foundry
Integration and Batch Processing on Cloud FoundryIntegration and Batch Processing on Cloud Foundry
Integration and Batch Processing on Cloud FoundryJoshua Long
 
using Spring and MongoDB on Cloud Foundry
using Spring and MongoDB on Cloud Foundryusing Spring and MongoDB on Cloud Foundry
using Spring and MongoDB on Cloud FoundryJoshua Long
 
Spring in-the-cloud
Spring in-the-cloudSpring in-the-cloud
Spring in-the-cloudJoshua Long
 
Multi Client Development with Spring
Multi Client Development with SpringMulti Client Development with Spring
Multi Client Development with SpringJoshua Long
 
The Cloud Foundry bootcamp talk from SpringOne On The Road - Europe
The Cloud Foundry bootcamp talk from SpringOne On The Road - EuropeThe Cloud Foundry bootcamp talk from SpringOne On The Road - Europe
The Cloud Foundry bootcamp talk from SpringOne On The Road - EuropeJoshua Long
 
A Walking Tour of (almost) all of Springdom
A Walking Tour of (almost) all of Springdom A Walking Tour of (almost) all of Springdom
A Walking Tour of (almost) all of Springdom Joshua Long
 
Multi client Development with Spring
Multi client Development with SpringMulti client Development with Spring
Multi client Development with SpringJoshua Long
 
Spring Batch Behind the Scenes
Spring Batch Behind the ScenesSpring Batch Behind the Scenes
Spring Batch Behind the ScenesJoshua Long
 
Cloud Foundry Bootcamp
Cloud Foundry BootcampCloud Foundry Bootcamp
Cloud Foundry BootcampJoshua Long
 
Spring in the Cloud - using Spring with Cloud Foundry
Spring in the Cloud - using Spring with Cloud FoundrySpring in the Cloud - using Spring with Cloud Foundry
Spring in the Cloud - using Spring with Cloud FoundryJoshua Long
 
Spring and Cloud Foundry; a Marriage Made in Heaven
Spring and Cloud Foundry; a Marriage Made in HeavenSpring and Cloud Foundry; a Marriage Made in Heaven
Spring and Cloud Foundry; a Marriage Made in HeavenJoshua Long
 
Spring 3.1: a Walking Tour
Spring 3.1: a Walking TourSpring 3.1: a Walking Tour
Spring 3.1: a Walking TourJoshua Long
 
Extending Spring for Custom Usage
Extending Spring for Custom UsageExtending Spring for Custom Usage
Extending Spring for Custom UsageJoshua Long
 
Using Spring's IOC Model
Using Spring's IOC ModelUsing Spring's IOC Model
Using Spring's IOC ModelJoshua Long
 
Enterprise Integration and Batch Processing on Cloud Foundry
Enterprise Integration and Batch Processing on Cloud FoundryEnterprise Integration and Batch Processing on Cloud Foundry
Enterprise Integration and Batch Processing on Cloud FoundryJoshua Long
 

Mehr von Joshua Long (20)

Bootiful Code with Spring Boot
Bootiful Code with Spring BootBootiful Code with Spring Boot
Bootiful Code with Spring Boot
 
REST APIs with Spring
REST APIs with SpringREST APIs with Spring
REST APIs with Spring
 
the Spring 4 update
the Spring 4 updatethe Spring 4 update
the Spring 4 update
 
The spring 32 update final
The spring 32 update finalThe spring 32 update final
The spring 32 update final
 
Multi Client Development with Spring
Multi Client Development with SpringMulti Client Development with Spring
Multi Client Development with Spring
 
Integration and Batch Processing on Cloud Foundry
Integration and Batch Processing on Cloud FoundryIntegration and Batch Processing on Cloud Foundry
Integration and Batch Processing on Cloud Foundry
 
using Spring and MongoDB on Cloud Foundry
using Spring and MongoDB on Cloud Foundryusing Spring and MongoDB on Cloud Foundry
using Spring and MongoDB on Cloud Foundry
 
Spring in-the-cloud
Spring in-the-cloudSpring in-the-cloud
Spring in-the-cloud
 
Multi Client Development with Spring
Multi Client Development with SpringMulti Client Development with Spring
Multi Client Development with Spring
 
The Cloud Foundry bootcamp talk from SpringOne On The Road - Europe
The Cloud Foundry bootcamp talk from SpringOne On The Road - EuropeThe Cloud Foundry bootcamp talk from SpringOne On The Road - Europe
The Cloud Foundry bootcamp talk from SpringOne On The Road - Europe
 
A Walking Tour of (almost) all of Springdom
A Walking Tour of (almost) all of Springdom A Walking Tour of (almost) all of Springdom
A Walking Tour of (almost) all of Springdom
 
Multi client Development with Spring
Multi client Development with SpringMulti client Development with Spring
Multi client Development with Spring
 
Spring Batch Behind the Scenes
Spring Batch Behind the ScenesSpring Batch Behind the Scenes
Spring Batch Behind the Scenes
 
Cloud Foundry Bootcamp
Cloud Foundry BootcampCloud Foundry Bootcamp
Cloud Foundry Bootcamp
 
Spring in the Cloud - using Spring with Cloud Foundry
Spring in the Cloud - using Spring with Cloud FoundrySpring in the Cloud - using Spring with Cloud Foundry
Spring in the Cloud - using Spring with Cloud Foundry
 
Spring and Cloud Foundry; a Marriage Made in Heaven
Spring and Cloud Foundry; a Marriage Made in HeavenSpring and Cloud Foundry; a Marriage Made in Heaven
Spring and Cloud Foundry; a Marriage Made in Heaven
 
Spring 3.1: a Walking Tour
Spring 3.1: a Walking TourSpring 3.1: a Walking Tour
Spring 3.1: a Walking Tour
 
Extending Spring for Custom Usage
Extending Spring for Custom UsageExtending Spring for Custom Usage
Extending Spring for Custom Usage
 
Using Spring's IOC Model
Using Spring's IOC ModelUsing Spring's IOC Model
Using Spring's IOC Model
 
Enterprise Integration and Batch Processing on Cloud Foundry
Enterprise Integration and Batch Processing on Cloud FoundryEnterprise Integration and Batch Processing on Cloud Foundry
Enterprise Integration and Batch Processing on Cloud Foundry
 

Kürzlich hochgeladen

What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 

Kürzlich hochgeladen (20)

What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 

Spring REST APIs with HATEOAS and WebSockets

  • 2. I AM… Josh Long (⻰龙之春) Spring Developer Advocate @starbuxman Jean Claude van Damme! | josh.long@springsource.com Java mascot Duke some thing’s I’ve authored...
  • 3. THE SPRING IO PLATFORM (SOME “MARCHITECTURE”) Deploy to Cloud or on premise Big, Fast, Flexible Data GemFire Core
 Model Web, Integration, Batch
  • 4. THE SPRING IO PLATFORM (SOME ARCHITECTURE) XD BOOT GRAILS Stream, Taps, Jobs Bootable, Minimal, Ops-Ready Full-stack, Web INTEGRATION BATCH BIG DATA WEB Channels, Adapters,
 Filters, Transformers Jobs, Steps,
 Readers, Writers Ingestion, Export,
 Orchestration, Hadoop Controllers, REST,
 WebSocket DATA RELATIONAL NON-RELATIONAL CORE FRAMEWORK SECURITY GROOVY REACTOR
  • 12. SPRING BOOT IS ABOUT PRODUCTIVITY CLI Bootstrap 
 your productivity Starters Autoconfigure Boot Actuator Tools Samples
  • 13. SPRING BOOT IS CONCISE (AND TWEETABLE!)
  • 15.
  • 16. DEMO: B O O T, G E T T I N G S TA R T E D G U I D E S , & STS
  • 17.
  • 18. SPRING LOVES THE JVM Spring loves the JVM: 
 Java (5,6,7, and 8), Groovy, Scala, etc.
  • 19. SPRING SCALA Scala 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) } }
  • 20. GROOVY BEAN BUILDER Groovy def bb = new BeanBuilder() bb.loadBeans("classpath:*SpringBeans.groovy") def applicationContext = bb.createApplicationContext() ! // MySpringBeans.groovy import o.sf.jdbc.core.JdbcTemplate import o.sf.jdbc.datasource.DataSourceTransactionManager ! beans { ! ! } ! jdbcTemplate(JdbcTemplate) { dataSource = dataSource } transactionManager(DataSourceTransactionManager) { dataSource = dataSource }
  • 21. JAVA CONFIGURATION Java ApplicationContext applicationContext = new AnnotationConfigApplicationContext( ServiceConfiguration.class); ! ! // ServiceConfiguration.java @Configuration @ComponentScan @Import(DataSourceConfiguration.class) @EnableTransactionManagement class ServiceConfiguration { ! } @Bean public JdbcTemplate jdbcTemplate(DataSource dataSource) throws Exception { return new JdbcTemplate( dataSource ); } @Bean public PlatformTransactionManager jdbcTransactionManager(DataSource dataSource){ return new JdbcTransactionManager (dataSource ); }
  • 22. SPRING 4 IS JAVA 8 READY a quick note on Java 8 ... ! Delayed again! from 09/2013 to as late as 03/2014! Meanwhile, even C++ has lambas...
  • 23. BUT ARE THE IDES JAVA 8 READY? a quick note on Java 8 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. ! !
  • 24. JAVA 8 METHOD REFERENCES ARE A GREAT FIT FOR SPRING a quick note on Java 8 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 interface Customer customer = jdbcTemplate.queryForObject( "select name, age from customers ", this::map);
  • 25. JAVA 8 LAMBAS ARE A GREAT FIT FOR SPRING a quick note on Java 8 Spring 4.0 to be GA against Developer Preview by end of 2014. ! lambas are a great fit for Spring and Twitter!
  • 26. SPRING 4 AND JAVA 8 a quick note on Java 8 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;
  • 27. SPRING 4 AND JAVA 8 a quick note on Java 8 Repeatable Annotations @Scheduled(cron = "0 0 12 * * ?") @Scheduled(cron = "0 0 18 * * ?") public void performTempFileCleanup() { ... }
  • 28. REST DESIGN WITH SPRING LET’S TURN OUR GAZE TO A TIME, LONG AGO, WHEN… dumb clients roamed the earth... like dinosaurs
  • 29. THEN MAGIC HAPPENED… 1989 magic happens: Tim Berners Lee & 
 Robert Cailliau create the world wide web
  • 30. WE TRIED TO ‘FIX’ HTTP. THIS REMINDS ME OF A STORY…
  • 31. FINALLY, WE GOT OUR ACT TOGETHER
  • 33. SO HOW DO OUR SMART CLIENTS CONNECT TO OUR SERVICES? when someone uses SOAP because it’s “simple”
  • 34. USE REST, OF COURSE! REST Is.. ! • URI’s identify resources • HTTP verbs describe a limited set of operations that can be used to manipulate a resource – GET – DELETE – PUT – POST – less used other verbs • Headers help describe the messages
  • 35. WHAT IS REST? (…BABY DON’T HURT ME, NO MORE…) The Richardson Maturity Model Level 0: swamp of POX
 Uses HTTP mainly as a tunnel through one URI
 e.g., SOAP, XML-RPC
 
 Usually features on HTTP verb (POST)
 http://martinfowler.com/articles/richardsonMaturityModel.html
  • 36. LEVEL 1: URIS TO DISTINGUISH NOUNS The Richardson Maturity Model Level 1: resources
 Multiple URIs to distinguish related nouns 
 e.g., /articles/1, /articles/2, vs. just /articles
 
 http://martinfowler.com/articles/richardsonMaturityModel.html
  • 37. LEVEL 2: GROUND ZERO USING SPRING MVC The Richardson Maturity Model Level 2: HTTP verbs
 leverage transport-native properties to enhance service 
 e.g., HTTP GET and PUT and DELETE and POST
 
 Uses idiomatic HTTP controls like status codes, headers 
 http://martinfowler.com/articles/richardsonMaturityModel.html
  • 38. TANGENT: A QUICK PRIMER ON SPRING MVC incoming requests delegate request DispatcherServlet return response model delegate rendering of response model return control render response view template controller
  • 39. REST DESIGN WITH SPRING import static ...RequestMethod.* ; import static ...MediaType.* ; ! @RestController @RequestMapping (value = “/users/”) class UserController { ! @RequestMapping (method = DELETE, value = “/{user}”) User delete(@PathVariable Long user) { return crmService.removeUser(user); } @RequestMapping (method = GET, value = “/{user}”) User read(@PathVariable Long user) { return crmService.findById(user); } .. }
  • 42. LEVEL 3: HATEOAS, OR THE UNPRONOUNCEABLE ACRONYM The Richardson Maturity Model Level 3: Hypermedia Controls (aka, HATEOAS)
 No a priori knowledge of service required
 Navigation options are provided by service and hypermedia controls
 
 Promotes longevity through a uniform interface
 
 http://martinfowler.com/articles/richardsonMaturityModel.html http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven
  • 43. METADATA == LINKS The Richardson Maturity Model Level 3: Hypermedia Controls (aka, HATEOAS)
 Links provide possible navigations from a given resource Links are dynamic, based on resource state. ! <link href=“http://...:8080/users/232/customers” 
 rel= “customers”/> http://martinfowler.com/articles/richardsonMaturityModel.html http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven
  • 44. REST DESIGN WITH SPRING import static ...RequestMethod.* ; import static ...MediaType.* ; ! @RestController @RequestMapping (value = “/users/” ) class UserController { ! ! @Inject ResourceAssembler<User, Resource<User>> userResourceAssembler; @RequestMapping (method = DELETE, value = “/{user}”) Resource<User> delete(@PathVariable Long user) { return userResourceAssembler.toResource( crmService.removeUser(user) ); } @RequestMapping (method = DELETE, value = “/{user}”) Resource<User> read(@PathVariable Long user) { return userResourceAssembler.toResource( crmService.findById(user)); } ..
  • 45. ! REST DESIGN WITH SPRING @Component class UserResourceAssembler implements ResourceAssembler<User, Resource<User>> { ! ! public Resource<User> toResource(User user) { Resource<User> userResource = new Resource<User>(user); Collection<Link> links = new ArrayList<Link>(); Link toPhoto = linkTo( methodOn(UserProfilePhotoController.class) .loadUserProfilePhoto( user.getId() )) .withRel(“photos”); Link toSelf = linkTo( methodOn( UserController.class)) .loadUser( user.getId() )) .withSelfRel(); Resource<User> userResource = new Resource<User>(user, Arrays.asList(toSelf, toPhoto));
  • 48. SPRING’S WEBSOCKETS SUPPORT WebSockets 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.
  • 49. REST DESIGN WITH SPRING Handling WebSocket Subscription @Controller class PortfolioController { … @MessageMapping("/app/trade") void handleTradeOrder(Trade trade, Principal principal) { trade.setUsername(principal.getName()); tradeService.executeTrade(trade); }   @SubscribeEvent("/app/positions") List<PortfolioPosition> subscribeToPortfolios(Principal principal) {     String user = principal.getName();     Portfolio portfolio = portfolioService.findPortfolio(user);     return portfolio.getPositions(); } }
  • 50. REST DESIGN WITH SPRING Handling Messages Over STOMP ! @Controller public class GreetingController { ! ! // Mapping based on "destination" header ! } @MessageMapping("/greeting") @SendTo("/topic/greetings") public String greet(@MessageBody String greeting) { return "[" + getTimestamp() + "]: " + greeting; }
  • 51. REST DESIGN WITH SPRING Configuring a STOMP WebSocket broker @Configuration @EnableWebSocketMessageBroker public class Config implements WebSocketMessageBrokerConfigurer { ! ! @Override public void registerStompEndpoints(StompEndpointRegistry r) { r.addEndpoint("/portfolio"); // WebSocket URL prefix } ! @Override public void configureMessageBroker(MessageBrokerConfigurer c) { c.enableSimpleBroker("/topic/"); // destination prefix } ! }
  • 54. SECURITY Spring Security is a modern security framework for a modern age ! • OAuth • sign in / out & “Remember Me” support • Kerbreros • CAS • pam • ActiveDirectory / LDAP • Encryption (TLS/SSL integration) • x509 certificates • OpenID
  • 55. SECURITY Spring Security is a modern security framework for a modern age ! Yes client submits authentication credentials Authentication Mechanism collects the details No - retry! Authentication is valid? Store Authentication in SecurityContextHolder process original request
  • 56. SECURITY Spring Security is a modern security framework for a modern age ! Yes client submits authentication credentials Authentication Mechanism collects the details Authentication Store Authentication in SecurityContextHolder Authentication is valid? Mechanism collects the details! ! No AuthenticationRequest is sent to AuthenticationManager! - retry! ! (passes it through a chain of AuthenticationProviders)! ! AuthenticationProvider asks a UserDetailsService for a UserDetails! ! The UserDetails object is used to build an Authentication object! ! ! process original request
  • 57. SECURITY ! Spring Security features a clean Java configuration API @Configuration @EnableWebSecurity class SecurityConfig extends WebSecurityConfigurerAdapter { ! ! } @Autowired public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { auth .inMemoryAuthentication() .withUser("user").password("password").roles("USER"); } @Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests() .antMatchers("/").permitAll() .antMatchers("/api/*").authenticated(); http.formLogin() .loginPage("/login") .passwordParameter("pw") .usernameParameter("user"); http.x509(); }
  • 58. A CONNECTED WORLD WITH SPRING SOCIAL * source: visual.ly/60-seconds-social-media A Connected World in 00:60 seconds 700ksent messages 1090 visitors 2000 checkins 175k tweets 7610 searches 2MM videos viewed 3125 photos uploaded 7630sent messages
  • 60. CONNECTING WITH SPRING REST DESIGN USING OAUTH
  • 61. CONNECTING WITH SPRING REST DESIGN USING OAUTH
  • 63. REST DESIGN WITH SPRING Setting up Spring Social @Configuration @EnableJdbcConnectionRepository @EnableFacebook(appId="${facebook.clientId}", appSecret="${facebook.clientSecret}") @EnableTwitter(appId=“${twitter.consumerKey}", appSecret="${twitter.consumerSecret}") @EnableLinkedIn(appId="${linkedin.consumerKey}", appSecret="${linkedin.consumerSecret}") public class SocialConfig { // ...
  • 64. REST DESIGN WITH SPRING Setting up Spring Social @Controller class FacebookFriendsController { ! ! } ! @Inject Facebook facebook; @RequestMapping(value="/facebook/friends", method=GET) public String showFeed(Model model) { model.addAttribute("friends", facebook.friendOperations().getFriendProfiles()); return "facebook/friends"; }
  • 65. DEMO: C O N N E C T I N G A P P L I C AT I O N S T O USERS WITH SPRING SOCIAL
  • 67. MOBILE FIRST APPLICATIONS units (in millions) of units of each type of platform shipped Linux Phone BlackBerry Symbian Windows Mobile iOS Android 2Q 2012 2Q 2013 0 50 100 150 http://www.idc.com/getdoc.jsp?containerId=prUS24257413 200
  • 68. MOBILE FIRST APPLICATIONS Spring Android brings Spring core’s RestTemplate. 
 
 Spring Social and Spring HATEOAS work as well.
  • 71. SPRING SUPPORTS JAVA EE Spring works well in Java EE environments !Supports 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)
  • 72. SPRING WORKS WELL IN THE CLOUD
  • 73. SPRING PROFILES MAKE IT EASY TO ADAPT @Configuration @Profile("cloud") public class CloudConfig { ! @Bean public Cloud cloud() throws CloudException { CloudFactory cloudFactory = new CloudFactory(); return cloudFactory.getCloud(); }   @Bean public DataSource dataSource() {             return cloud().getSingletonServiceConnector(DataSource.class, null);        } }
  • 74. YOU MIGHT CHECK OUT, FOR EXAMPLE, THE SPRING MUSIC APP
  • 75. CLOUD FOUNDRY COMES WITH BATTERIES INCLUDED
  • 76. …AND A RICH ECOSYSTEM OF THIRD PARTY INTEGRATIONS
  • 77. SPRING IS THE LEADING COMPONENT MODEL Glassfish Websphere WebLogic JBoss Jetty Apache Tomcat % of survey of 1800 Java developers. Multiple choices. 0 15 30 45 Source: ZeroTurnaround Developer Productivity Report 2012 60
  • 78. SPRING INTEGRATION MAKES EIP EASY Integration • ! hard to get right • patterned after “EIP book” patterns • supports numerous adapters and gateways for external systems
  • 80. BATCH AND INTEGRATION <?xml version="1.0" encoding="UTF-8"?> <beans ...> ! ! ! ! <int:channel id="jobsToLaunch"/> <int:channel id="filesReceived"/> <int:channel id="jobExecutions"/> <file:inbound-channel-adapter auto-create-directory="true" channel="filesReceived" directory="#{systemProperties['user.home']}/Desktop/in"> <int:poller fixed-rate="1000"/> </file:inbound-channel-adapter> <int:transformer ref="fileBatchJobRequestTransformer" input-channel="filesReceived" output-channel="jobsToLaunch"/> <int:service-activator input-channel="jobsToLaunch" ref="jobMessageHandler" output-channel="jobExecutions"/> ! <stream:stdout-channel-adapter id="jobsPrinted" append-newline="true" channel="jobExecutions"/> ! </beans>
  • 81. BATCH AND INTEGRATION @Configuration @Import(BatchConfiguration.class) @ComponentScan @ImportResource("/com/joshlong/spring/walkingtour/services/integration/context.xml") class IntegrationConfiguration { ! ! } @Bean JobLaunchingMessageHandler jobMessageHandler( JobLauncher jobLauncher) throws Exception { return new JobLaunchingMessageHandler(jobLauncher); }
  • 82. BATCH AND INTEGRATION Batch Processing... • ! avoids idle computing resources • allows the system to use different priorities for batch and interactive work • supports numerous sinks and sources • supports JSR 352 - Batch Applications
  • 84. BATCH AND INTEGRATION Job * Step reader, processor?, writer * JobInstance * JobExecution step scope * StepExecution
  • 85. BATCH AND INTEGRATION ! ! ! ! @Bean Job customerLoaderJob( JobBuilderFactory jobs, Step csvToRDBMS ) { return jobs.get(“customerLoaderJob”) .flow(csvToRDBMS).end().build(); } @Bean Step csvToRDBMS( StepBuilderFactory stepBuilderFactory, PlatformTransactionManager platformTransactionManager, ItemReader <Customer> itemReader, ItemProcessor <Customer, Customer> itemProcessor, ItemWriter <Customer> itemWriter) { StepBuilder builder = stepBuilderFactory.get(“csvToRDBMS”); } return builder.<Customer, Customer> chunk(3) .reader(itemReader) .processor(itemProcessor) .writer(itemWriter) .transactionManager(platformTransactionManager) .build(); FlatFileItemReader JdbcBatchItemWriter
  • 86. DEMO: U S I N G S P R I N G B AT C H & I N T E G R AT I O N
  • 87.
  • 88. SPRING SUPPORTS ALL THE DATA! Spring supports all the SQLs: 
 NoSQL, NOSQL, and SQL !
  • 89. REST DESIGN WITH SPRING ! import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.data.repository.query.Param; import org.springframework.data.rest.repository.annotation.RestResource; ! import java.util.List; ! @RestResource (path = "users", rel = "users") public interface UserRepository extends PagingAndSortingRepository<User, Long> { ! // select * from users where username = ? User findByUsername(@Param("username") String username); ! ! } // select * from users where firstName =? or lastName = ? or username = ? List<User> findUsersByFirstNameOrLastNameOrUsername( @Param("firstName") String firstName, @Param("lastName") String lastName, @Param("username") String username);
  • 90. PROJECT REACTOR The future is Reactive ! Reactor: foundational library. Drives drivers, servers, data integration libraries, domain integration libraries, and evented architectures ! Used in: Spring Integration, websocket => STOMP support, Grails, etc.
  • 91. PROJECT REACTOR without Spring Environment env = new Environment(); ! Reactor reactor = Reactors.reactor() .env(env) .dispatcher(RING_BUFFER) .get(); ThreadPoolExecutorDispatcher BlockingQueueDispatcher … RingBufferDispatcher ! reactor.on($(“topic”), (Event<String> ev) -> { System.out.println(“Hello “ + ev.getData()); }); ! reactor.notify(“topic”, Event.wrap(“John Doe”));
  • 92. PROJECT REACTOR with Spring @EnableReactor @Configuration @ComponentScan class ReactorConfiguration { ! } @Bean Reactor reactor(Environment env) { return Reactors.reactor().env(env) .dispatcher( Environment.RING_BUFFER) .get(); } @Component class EvenConsumer { ! } @Selector("test.topic") public void onTestTopic(String s) { log.info("onTestTopic: {}", s); } ! @Service class EventPublisher { ! } @Autowired Reactor reactor; public void fire(String msg) { reactor.notify( "test.topic", Event.wrap( msg )); }
  • 93. PROJECT REACTOR Streams like Netflix RxJava Observable, JDK 8 Stream Stream <String> str = …; ! str.map(String::toUpperCase) .filter(new Predicate<String>() { public boolean test(String s) { … } }) .consume(s → log.info(“consumed string {}”, s));
  • 94. PROJECT REACTOR Did I mention it’s fast? https://github.com/reactor/reactor-si-quickstart
  • 95. SPRING WORKS WELL WITH Surviving the Big Data Wild-West with
 Spring for Hadoop
  • 96. SPRING XD AND STREAM PROCESSING Getting Data into the System is Hard @metamarkets founder Michael E. Driscoll:
  • 97. SPRING XD AND STREAM PROCESSING sinks sources Introducing Spring XD xd:> stream create --definition "time | log" --name ticktock
  • 98. DEMO: SPRING FOR HADOOP AND SPRING XD
  • 101. “ china on 11/11/2012 (the “Double Sticks” promotion day), Tmall and Taobao witnessed 147 million user visits, purchases of 30 million people and nearly 100 million paid orders. At 0:00, more than 10 million users were concurrently online ” * source: http://www.infoq.com/news/2012/12/interview-taobao-tmall http://spring.io/blog/2013/03/04/spring-at-china-scale-alibaba-group-alipay-taobao-and-tmall/
  • 102. Spring and RabbitMQ: powering India’s 1.2 B Person Biometric DB • 1.2 billion residents • ~75% literacy • less than 3% pay incomes taxes • less than 20% banking • 800 million mobile, ~200-300 million migrant workers ! • Government spends about $25-40 billion on direct attributes • residents have no standard identity • most programs plagued with ghost and multiple identities causing leakage of 30-40% india
  • 103. japan • traded on JASDAQ • largest Java consultancy in Japan • Spring Batch – handles customer profile information and real-time ad matching system • Spring is agile enabler – production control system – just-in-time production is really the heart of manufacturing – cost decreased 30%
  • 104. china • 1.3 billion people in China • Google is either mostly blocked or - from Hong Kong - very slow ! • Baidu has its own Android operating system, cloud services (like GMail, Dogs, etc.) ! • Built micro service architecture that builds on top of Spring ! • Custom web frameworks using Spring XML namespaces as global integration API