spring 4.0 - evolution or revolution
DESCRIPTION
Presentation about the changes in Spring 4.0 plus an Introduction to Spring XD and Spring Boot.TRANSCRIPT
![Page 1: Spring 4.0 - Evolution or Revolution](https://reader034.vdocuments.site/reader034/viewer/2022052310/554f54d5b4c905524c8b50da/html5/thumbnails/1.jpg)
Spring 4.0 - Evolution or Revolution
Dominique Bartholdi, Raffael Schmid Trivadis AG
![Page 2: Spring 4.0 - Evolution or Revolution](https://reader034.vdocuments.site/reader034/viewer/2022052310/554f54d5b4c905524c8b50da/html5/thumbnails/2.jpg)
“work with Java 8 and other JVM languages (e.g. support Lambdas, …)”
“responding to, and setting trends in (Developer Productivity), Big Data, Cloud, REST and Micro Service
Architecture”
-Adrian Colyer, CTO Application Fabric at Pivotal
![Page 3: Spring 4.0 - Evolution or Revolution](https://reader034.vdocuments.site/reader034/viewer/2022052310/554f54d5b4c905524c8b50da/html5/thumbnails/3.jpg)
Agenda
INTRODUCTION
MODERNISATION
BIG DATA
MICRO SERVICE ARCHITECTURE
CONCLUSION
* not our focus
![Page 4: Spring 4.0 - Evolution or Revolution](https://reader034.vdocuments.site/reader034/viewer/2022052310/554f54d5b4c905524c8b50da/html5/thumbnails/4.jpg)
Introduction
INTRODUCTION
MODERNISATION
BIG DATA
MICRO SERVICE ARCHITECTURE
CONCLUSION
* not our focus
![Page 5: Spring 4.0 - Evolution or Revolution](https://reader034.vdocuments.site/reader034/viewer/2022052310/554f54d5b4c905524c8b50da/html5/thumbnails/5.jpg)
a bunch of history
2004
Spring 1.0: “lightweight” container (DI) AOP interception Jdbc abstraction, Transaction support JPetStore, Petclinic
2006 2007
Spring 2.0: bean configuration dialects (make common tasks easier)
Spring 2.5: reduce XML based configuration custom namespaces
Spring 3.0: task scheduling, … with annotation support REST web apps JEE features
Spring 4.0 / Spring IO (Yummy Noodle Bar)
20132009
![Page 6: Spring 4.0 - Evolution or Revolution](https://reader034.vdocuments.site/reader034/viewer/2022052310/554f54d5b4c905524c8b50da/html5/thumbnails/6.jpg)
Platform Overview
Core
Framework Security Groovy Reactor
Relational Non-Relational
Data
Integration Batch Big DataWeb
Workload Types
ExecutionSpring XD Spring Boot Grails
*
Modernisation Big Data
*
* *
Micro Services(Developer Productivity)
Spring 4.0
![Page 7: Spring 4.0 - Evolution or Revolution](https://reader034.vdocuments.site/reader034/viewer/2022052310/554f54d5b4c905524c8b50da/html5/thumbnails/7.jpg)
Spring 4.0
INTRODUCTION
MODERNISATION
BIG DATA
MICRO SERVICE ARCHITECTURE
CONCLUSION
* not our focus
![Page 8: Spring 4.0 - Evolution or Revolution](https://reader034.vdocuments.site/reader034/viewer/2022052310/554f54d5b4c905524c8b50da/html5/thumbnails/8.jpg)
Java 8 Lambdas with Spring's JdbcTemplate
JdbcTemplate jt = new JdbcTemplate();
jt.query(QUERY, new PreparedStatementSetter() {
@Override public void setValues(PreparedStatement ps) throws SQLException { ps.setString(1, “Sales"); }
}, new RowMapper<Person>() {
@Override public Person mapRow(ResultSet rs, int rowNum) throws SQLException { return new Person(rs.getString(1), rs.getInt(2)); }});
![Page 9: Spring 4.0 - Evolution or Revolution](https://reader034.vdocuments.site/reader034/viewer/2022052310/554f54d5b4c905524c8b50da/html5/thumbnails/9.jpg)
Java 8 Lambdas with Spring's JdbcTemplate
JdbcTemplate jt = new JdbcTemplate(dataSource);
jt.query( QUERY, ps -> ps.setString(1, “Sales"), (rs, row) -> new Person(rs.getString(1), rs.getInt(2)));
![Page 10: Spring 4.0 - Evolution or Revolution](https://reader034.vdocuments.site/reader034/viewer/2022052310/554f54d5b4c905524c8b50da/html5/thumbnails/10.jpg)
JSR 310: Date & Time
public class Customer {
@DateTimeFormat(iso=ISO.DATE) //default private LocalDate birthDate;
@DateTimeFormat(pattern="M/d/yy h:mm") private LocalDateTime lastContact;
… }
![Page 11: Spring 4.0 - Evolution or Revolution](https://reader034.vdocuments.site/reader034/viewer/2022052310/554f54d5b4c905524c8b50da/html5/thumbnails/11.jpg)
Generics-based Injection Matching
@Service public class BookService {
@Autowired public BookService(Repository<Book> repo) {
...
}
}
![Page 12: Spring 4.0 - Evolution or Revolution](https://reader034.vdocuments.site/reader034/viewer/2022052310/554f54d5b4c905524c8b50da/html5/thumbnails/12.jpg)
Generics-based Injection Matching
@Bean public Repository<Book> bookRepository() {
return new BookRepositoryImpl();
}
![Page 13: Spring 4.0 - Evolution or Revolution](https://reader034.vdocuments.site/reader034/viewer/2022052310/554f54d5b4c905524c8b50da/html5/thumbnails/13.jpg)
Web Sockets@Configuration@EnableWebSocket public class MyWebSocketConfig implements WebSocketConfigurer {
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
WebSocketHandler echoHandler = new EchoHandler(); registry.addHandler(echoHandler, "/echo").withSockJS();
}
}
public interface WebSocketHandler {
void handleMessage(WebSocketSession s, WebSocketMessage<?> m);
}
![Page 14: Spring 4.0 - Evolution or Revolution](https://reader034.vdocuments.site/reader034/viewer/2022052310/554f54d5b4c905524c8b50da/html5/thumbnails/14.jpg)
and many more…
Conditional Bean definitions @Conditional
@Autowired @Lazy on injection points
@Order injection of arrays and lists
Groovy style Spring configs
![Page 15: Spring 4.0 - Evolution or Revolution](https://reader034.vdocuments.site/reader034/viewer/2022052310/554f54d5b4c905524c8b50da/html5/thumbnails/15.jpg)
BIG DATA
INTRODUCTION
MODERNISATION
BIG DATA
MICRO SERVICE ARCHITECTURE
CONCLUSION
![Page 16: Spring 4.0 - Evolution or Revolution](https://reader034.vdocuments.site/reader034/viewer/2022052310/554f54d5b4c905524c8b50da/html5/thumbnails/16.jpg)
-Pivotal
“Spring XD (Extreme Data) is a unified, distributed, and extensible
service for data ingestion, real time analytics, batch
processing, and data export.”
Spring XD
![Page 17: Spring 4.0 - Evolution or Revolution](https://reader034.vdocuments.site/reader034/viewer/2022052310/554f54d5b4c905524c8b50da/html5/thumbnails/17.jpg)
Spring XDCombining established Spring Technology: Spring Integration, Spring Batch and Spring Data
Providing a scalable container architecture
Domain Specific Language (DSL) for configuration
![Page 18: Spring 4.0 - Evolution or Revolution](https://reader034.vdocuments.site/reader034/viewer/2022052310/554f54d5b4c905524c8b50da/html5/thumbnails/18.jpg)
Single vs Distributed
XD Admin
XD Container
Module
Module
XD Admin
XD Container
Module
Module
XD Container
Module
Module
single node distributed nodes
in-memoryrabbit or redis
![Page 19: Spring 4.0 - Evolution or Revolution](https://reader034.vdocuments.site/reader034/viewer/2022052310/554f54d5b4c905524c8b50da/html5/thumbnails/19.jpg)
from source to sink
Sources TAP Real time analytics
Processor Sink Storage
Batch Jobs
STREAMJOBS
![Page 20: Spring 4.0 - Evolution or Revolution](https://reader034.vdocuments.site/reader034/viewer/2022052310/554f54d5b4c905524c8b50da/html5/thumbnails/20.jpg)
Sources- HTTP - Tail - File - Mail - Twitter Search - Twitter Stream - Gemfire - Gemfire CQ
- Syslog - TCP - TCP Client - JMS - RabbitMQ - Time - MQTT
![Page 21: Spring 4.0 - Evolution or Revolution](https://reader034.vdocuments.site/reader034/viewer/2022052310/554f54d5b4c905524c8b50da/html5/thumbnails/21.jpg)
Stream ConfigCreate the stream xd:> stream create --definition "HTTP | file" --name mystream
use pipe (|) to connect source “HTTP” to sink “file”
set name of stream to “mystream”
Remove the stream xd:> stream destroy —name mystream
![Page 22: Spring 4.0 - Evolution or Revolution](https://reader034.vdocuments.site/reader034/viewer/2022052310/554f54d5b4c905524c8b50da/html5/thumbnails/22.jpg)
Spring XD Demo
twitter stream
log
language counter
tweet counter
stream create tweets --definition "twitterstream | log”
stream create tweetcount --definition "tap:stream:tweets > aggregatecounter”
stream create tweetlang --definition "tap:stream:tweets > field-value-counter --fieldName=lang"
![Page 23: Spring 4.0 - Evolution or Revolution](https://reader034.vdocuments.site/reader034/viewer/2022052310/554f54d5b4c905524c8b50da/html5/thumbnails/23.jpg)
MICRO SERVICE ARCHITECTURE
INTRODUCTION
MODERNISATION
BIG DATA
MICRO SERVICE ARCHITECTURE
CONCLUSION
![Page 24: Spring 4.0 - Evolution or Revolution](https://reader034.vdocuments.site/reader034/viewer/2022052310/554f54d5b4c905524c8b50da/html5/thumbnails/24.jpg)
What’s exactly a MICRO SERVICE ARCHITECTURE?
Develop a single application as suite of small services
Organise services around business capabilities (not technologies)
Smart endpoints, dumb pipes (less BPEL, more REST)
Services do one thing (small enough to throw away, fit into the head)
* http://martinfowler.com/articles/microservices.html
![Page 25: Spring 4.0 - Evolution or Revolution](https://reader034.vdocuments.site/reader034/viewer/2022052310/554f54d5b4c905524c8b50da/html5/thumbnails/25.jpg)
MICRO SERVICE vs. monolithic architecture
* http://martinfowler.com/articles/microservices.html
functionality in one single process
scaling by replicating the
monolith
a micro architecture puts each functionality into a
service
scaling by distributing
services
![Page 26: Spring 4.0 - Evolution or Revolution](https://reader034.vdocuments.site/reader034/viewer/2022052310/554f54d5b4c905524c8b50da/html5/thumbnails/26.jpg)
Objectives for MICRO SERVICES
simple packaging (executable jar) -> embedded web containers
monitoring, expose insights
fast instantiation
polyglot persistence (SQL, NoSQL)
…
![Page 27: Spring 4.0 - Evolution or Revolution](https://reader034.vdocuments.site/reader034/viewer/2022052310/554f54d5b4c905524c8b50da/html5/thumbnails/27.jpg)
Spring Boot comes into play
Spring Boot makes it easy to create stand-alone (Spring based) applications that you can “just run”
Radically faster getting started experience
Well defined set of dependencies
Auto-configuration
“Non-functional” features out of the box
Metrics, Counters, Monitoring with Actuator
SSH access through remote shell
![Page 28: Spring 4.0 - Evolution or Revolution](https://reader034.vdocuments.site/reader034/viewer/2022052310/554f54d5b4c905524c8b50da/html5/thumbnails/28.jpg)
Spring Boot by Example
![Page 29: Spring 4.0 - Evolution or Revolution](https://reader034.vdocuments.site/reader034/viewer/2022052310/554f54d5b4c905524c8b50da/html5/thumbnails/29.jpg)
Spring Boot Conclusion
Not production-ready yet (version 1.0.0 still RC 5), but surprisingly stable
Packaging not only JAR
Will influence a bunch of other Spring Projects (e.g. Spring XD, Roo, etc.)
Perfect tool for quickly building Spring based applications
![Page 30: Spring 4.0 - Evolution or Revolution](https://reader034.vdocuments.site/reader034/viewer/2022052310/554f54d5b4c905524c8b50da/html5/thumbnails/30.jpg)
CONCLUSION
INTRODUCTION
MODERNISATION
BIG DATA
MICRO SERVICE ARCHITECTURE
CONCLUSION
* not our focus
![Page 31: Spring 4.0 - Evolution or Revolution](https://reader034.vdocuments.site/reader034/viewer/2022052310/554f54d5b4c905524c8b50da/html5/thumbnails/31.jpg)
Overall
Spring 4.0 evolved over the last years
Spring IO most probably a revolutionary approach (not only in terms of marketing)