SlideShare une entreprise Scribd logo
1  sur  58
Télécharger pour lire hors ligne
Spring Framework 4.0
The Next Generation

Sam Brannen
@sam_brannen
Soft-Shake | Geneva, Switzerland | 24 October 2013
Sam Brannen
•  Spring and Java Consultant @ Swiftmind
•  Java Developer for over 15 years
•  Spring Framework Core Committer since 2007
•  Spring Trainer
•  Presenter on Spring, Java, OSGi, and testing

2
Swiftmind
Your experts for Enterprise Java
Areas of expertise
•  Spring *
•  Java EE
•  OSGi
•  Agile Methodologies
•  Software Engineering Best Practices
Where you find us
•  Zurich, Switzerland
•  Twitter: @swiftmind
•  http://www.swiftmind.com
3
A Show of Hands…

4
Agenda
•  Spring 3.x in Review
•  Themes in 4.0
•  Java EE
•  Java SE
•  Spring 4 on Java 8

5
Spring 3.x in Review

6
Spring 3.x: Component Model
•  Powerful annotated component model
–  stereotypes, configuration classes, composable
annotations, profiles

•  Spring Expression Language (SpEL)
–  XML config files
–  @Value, @Cacheable, etc.
–  JSPs

7
Spring 3.x: Component Model
•  Comprehensive REST support
–  and other Spring @MVC additions

•  Support for async MVC processing
–  Spring MVC interacting with Servlet 3.0 async
callbacks

8
Spring 3.x: Component Model
•  Declarative validation and formatting
–  integration with JSR-303 Bean Validation

•  Declarative scheduling
–  trigger abstraction and cron support

•  Declarative caching
–  in-memory, Ehcache, etc.

9
Spring 3.x: Testing
•  Embedded databases via <jdbc /> namespace
•  @Configuration classes & @ActiveProfiles	
•  @WebAppConfiguration	
•  @ContextHierarchy	
•  Spring MVC Test framework

10
Spring 3.x: Key Specs
•  JSR-330
–  Dependency Injection for Java
–  @Inject, @Qualifier, Provider mechanism

•  JSR-303
–  Bean Validation 1.0
–  declarative constraints
–  embedded validation engine

11
Spring 3.x: Key Specs
•  JPA 2.0
–  persistence provider integration
–  Spring transactions

•  Servlet 3.0
–  web.xml-free deployment
–  async request processing

12
Typical Annotated Component

13
Composable Stereotypes
•  Combining meta-annotations on a custom stereotype
•  Automatically detected: no configuration necessary!

14
Configuration Classes

15
Spring 4.0 Themes

16
New Baselines
•  Java SE 6+
•  Java EE 6+
–  Servlet 3.0 focused, Servlet 2.5 compatible
•  All deprecated packages removed
•  Many deprecated methods removed as well

17
Third Party Libraries
•  Minimum versions ~ mid 2010 now
•  For example
–  Hibernate 3.6+
–  Quartz 1.8+
–  Ehcache 2.1+

18
Java 8 Language and API Features
•  Lambda expressions
•  Method references
•  JSR-310 Date and Time
•  Repeatable annotations
•  Parameter name discovery

19
Groovy + Spring 4.0
•  A smooth out-of-the-box experience for Groovy-based
Spring applications
•  AOP adaptations
–  special handling of GroovyObject calls
–  consider a Spring application with all components
written in the Groovy language instead of Java
•  Groovy-based bean definitions
–  formerly known as the Bean Builder in Grails
–  now to live alongside Spring's configuration class
model
20
Conditional Bean Definitions
•  A generalized model for conditional bean definitions
–  a more flexible and more dynamic variant of bean
definition profiles (as known from Spring 3.1)
–  can be used for smart defaulting
–  see Spring Boot J
•  @Conditional with programmatic Condition
implementations
–  can react to rich context (existing bean definitions,
etc.)
–  profile support now simply a ProfileCondition
implementation class
21
Annotation-based Components
•  Custom annotations may override specific attributes of
meta-annotations
•  Purely convention-based
–  use of same attribute name
@MyTransactional(readOnly = true)	
	
@MySessionScope(scopedProxyMode = TARGET_CLASS)	

22
Lazy Resolution Proxies
•  @Lazy on injection point
•  Alternative to Provider<MyTargetType>	

23
Ordered Injection of Lists & Arrays
•  Ordered / @Order on candidate beans
•  Relative order within specific injection result

24
DI and Generics
•  Type matching based on full generic type
–  e.g., MyRepository<Customer>	
•  Generic factory methods now fully supported in XML
config files
–  Mockito, EasyMock, etc.

25
spring-messaging
•  New org.springframework.messaging module
•  Extracted from Spring Integration
•  Core message and channel abstractions

26
WebSockets
•  WebSocket endpoint model along the lines of Spring MVC
•  JSR-356 but also covering SockJS and STOMP
•  Endpoints using generic messaging patterns

27
AsyncRestTemplate
•  Analogous to existing RestTemplate	
•  Based on ListenableFuture return values

28
Spring and Java EE

29
Java EE Support (1/2)
•  Spring 2.5
–  completed Java EE 5 support
–  J2EE 1.3 à Java EE 5

•  Spring 3.0
–  introduced Java EE 6 support
–  J2EE 1.4 à Java EE 6

30
Java EE Support (2/2)
•  Spring 3.1 / 3.2
–  strong Servlet 3.0 focus
–  J2EE 1.4 (deprecated) à Java EE 6

•  Spring 4.0
–  introduces explicit Java EE 7 support
–  Java EE 5 (with JPA 2.0 feature pack) à Java EE 7

31
Enterprise API Updates
•  JMS 2.0
–  delivery delay, JMS 2.0 createSession() variants, etc.
•  JTA 1.2
–  javax.transaction.Transactional annotation
•  JPA 2.1
–  unsynchronized persistence contexts
•  Bean Validation 1.1
–  method parameter and return value constraints
32
Spring and Java SE

33
Java SE Support (1/2)
•  Spring 2.5
–  introduced Java 6 support
–  JDK 1.4 à JDK 6

•  Spring 3.0
–  raised the bar to Java 5+
–  JDK 5 à JDK 6

34
Java SE Support (2/2)
•  Spring 3.1 / 3.2
–  explicit Java 7 support
–  JDK 5 à JDK 7

•  Spring 4.0
–  introduces explicit Java 8 support
–  JDK 6 à JDK 8

35
Java 8 Programming Model

36
The State of Java 8
•  Delayed again...
•  Scheduled for GA in September 2013
•  Now just Developer Preview in September
•  OpenJDK 8 GA as late as March 2014 L

37
IDE Support for Java 8
•  IntelliJ
–  available since IDEA 12, released in Dec 2012
•  Eclipse
–  announced for June 2014 L
•  Spring Tool Suite
–  Eclipse-based beta support earlier

38
Java 8 Bytecode Level
•  Generated by -target 1.8	
–  compiler's default
•  Not accepted by ASM 4.x
–  Spring's bytecode parsing library
•  Spring Framework 4.0 comes with a patched (jarjar’ed)
ASM 4.1 variant

39
HashMap / HashSet Differences
•  Different hash algorithms in use
•  Leading to different hash iteration order
•  Code shouldn't rely on such an order but sometimes does

40
Java 8 Lambda Conventions
Simple rule: interface with single method
–  typically callback interfaces
–  for example: Runnable, Callable	
–  formerly “Single Abstract Method” (SAM) types
–  now “functional interfaces”

41
Lambda + Spring = Natural Fit
Many Spring APIs are candidates for lambdas
–  by naturally following the lambda interface conventions

42
Lambdas with JmsTemplate
MessageCreator
Message createMessage(Session session)	
	throws JMSException	

43
Lambdas with TransactionTemplate
TransactionCallback
Object doInTransaction(TransactionStatus status)	

44
Lambdas with JdbcTemplate
RowMapper
Object mapRow(ResultSet rs, int rowNum)	
	throws SQLException	

45
Ex: Lambdas with JdbcTemplate #1
JdbcTemplate jt = new JdbcTemplate(dataSource);	
jt.query(	
"SELECT name, age FROM person WHERE dep = ?",	
ps -> { ps.setString(1, "Sales"); },	
(rs, rowNum) -> new Person(rs.getString(1),	
rs.getInt(2))	
);	

46
Ex: Lambdas with JdbcTemplate #2
JdbcTemplate jt = new JdbcTemplate(dataSource);	
	
jt.query(	
"SELECT name, age FROM person WHERE dep = ?",	
ps -> {	
ps.setString(1, "Sales");	
},	
(rs, rowNum) -> {	
return new Person(rs.getString(1), rs.getInt(2));	
}	
);	

47
Method References
public List<Person> getPersonList(String department) {	
JdbcTemplate jt = new JdbcTemplate(dataSource);	
return jt.query(	
"SELECT name, age FROM person WHERE dep = ?",	
ps -> {	
ps.setString(1, "Sales");	
},	
this::mapPerson);	
}	
	
private Person mapPerson(ResultSet rs, int rowNum)	
throws SQLException {	
return new Person(rs.getString(1), rs.getInt(2));	
}	
	
	

48
JSR-310 Date and Time
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;	
	
// ...	
	
}	

49
Repeatable Annotations
Repeated

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

JDK 8

JDK 6+

50
Parameter Name Discovery
•  Java 8 defines a Parameter reflection type for methods
–  application sources to be compiled with –parameters	
•  Spring's StandardReflectionParameterNameDiscoverer	
–  reading parameter names via Java 8's new Parameter
type
•  Spring's DefaultParameterNameDiscoverer	
–  now checking Java 8 first (-parameters)
–  ASM-based reading of debug symbols next (-debug)

51
In Closing…

52
Spring Framework 4.0 Roadmap
•  RC1: end of October
•  RC2: mid November
•  GA:

end of 2013

53
Upgrade Considerations
•  Spring 3.2 does not support 1.8 bytecode level
–  upgrade to Spring 4.0 to enable Java 8 language
features
•  Spring Framework 4.0 still compatible with JDK 6 and 7
•  Spring Framework 3.2 is in maintenance mode

54
Acknowledgements
Special thanks to Spring Framework project lead
Juergen Hoeller for permitting reuse of his content.

55
Spring Resources
•  Spring Framework
–  http://projects.spring.io/spring-framework
•  Spring Forums
–  http://forum.spring.io
•  Spring JIRA
–  https://jira.springsource.org
•  Spring on GitHub
–  https://github.com/spring-projects/spring-framework
56
Blogs
•  Swiftmind Blog
–  http://www.swiftmind.com/blog

•  Spring Blog
–  http://spring.io/blog

57
Q&A
Sam Brannen
twitter: @sam_brannen
www.slideshare.net/sbrannen
www.swiftmind.com

58

Contenu connexe

Tendances

Spring bean mod02
Spring bean mod02Spring bean mod02
Spring bean mod02Guo Albert
 
Spring MVC framework
Spring MVC frameworkSpring MVC framework
Spring MVC frameworkMohit Gupta
 
Spring Framework - AOP
Spring Framework - AOPSpring Framework - AOP
Spring Framework - AOPDzmitry Naskou
 
Spring Framework - MVC
Spring Framework - MVCSpring Framework - MVC
Spring Framework - MVCDzmitry Naskou
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring FrameworkRaveendra R
 
Java spring framework
Java spring frameworkJava spring framework
Java spring frameworkRajiv Gupta
 
Introduction to Spring Framework and Spring IoC
Introduction to Spring Framework and Spring IoCIntroduction to Spring Framework and Spring IoC
Introduction to Spring Framework and Spring IoCFunnelll
 
Spring Framework Presantation Part 1-Core
Spring Framework Presantation Part 1-CoreSpring Framework Presantation Part 1-Core
Spring Framework Presantation Part 1-CoreDonald Lika
 
JAZOON'13 - Sam Brannen - Spring Framework 4.0 - The Next Generation
JAZOON'13 - Sam Brannen - Spring Framework 4.0 - The Next GenerationJAZOON'13 - Sam Brannen - Spring Framework 4.0 - The Next Generation
JAZOON'13 - Sam Brannen - Spring Framework 4.0 - The Next Generationjazoon13
 
Spring framework in depth
Spring framework in depthSpring framework in depth
Spring framework in depthVinay Kumar
 
Preparing for java 9 modules upload
Preparing for java 9 modules uploadPreparing for java 9 modules upload
Preparing for java 9 modules uploadRyan Cuprak
 

Tendances (18)

Spring framework core
Spring framework coreSpring framework core
Spring framework core
 
Spring bean mod02
Spring bean mod02Spring bean mod02
Spring bean mod02
 
Spring Framework Training Course
Spring Framework Training Course Spring Framework Training Course
Spring Framework Training Course
 
Spring Framework Rohit
Spring Framework RohitSpring Framework Rohit
Spring Framework Rohit
 
Spring MVC framework
Spring MVC frameworkSpring MVC framework
Spring MVC framework
 
Spring Framework - AOP
Spring Framework - AOPSpring Framework - AOP
Spring Framework - AOP
 
Spring Framework - MVC
Spring Framework - MVCSpring Framework - MVC
Spring Framework - MVC
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
 
Spring 4 Web App
Spring 4 Web AppSpring 4 Web App
Spring 4 Web App
 
Java spring framework
Java spring frameworkJava spring framework
Java spring framework
 
Introduction to Spring Framework and Spring IoC
Introduction to Spring Framework and Spring IoCIntroduction to Spring Framework and Spring IoC
Introduction to Spring Framework and Spring IoC
 
Spring Framework Presantation Part 1-Core
Spring Framework Presantation Part 1-CoreSpring Framework Presantation Part 1-Core
Spring Framework Presantation Part 1-Core
 
Spring MVC Framework
Spring MVC FrameworkSpring MVC Framework
Spring MVC Framework
 
JAZOON'13 - Sam Brannen - Spring Framework 4.0 - The Next Generation
JAZOON'13 - Sam Brannen - Spring Framework 4.0 - The Next GenerationJAZOON'13 - Sam Brannen - Spring Framework 4.0 - The Next Generation
JAZOON'13 - Sam Brannen - Spring Framework 4.0 - The Next Generation
 
Spring framework in depth
Spring framework in depthSpring framework in depth
Spring framework in depth
 
Maven
MavenMaven
Maven
 
Preparing for java 9 modules upload
Preparing for java 9 modules uploadPreparing for java 9 modules upload
Preparing for java 9 modules upload
 
Java EE 8
Java EE 8Java EE 8
Java EE 8
 

En vedette

Spring MVC Annotations
Spring MVC AnnotationsSpring MVC Annotations
Spring MVC AnnotationsJordan Silva
 
REST APIs with Spring
REST APIs with SpringREST APIs with Spring
REST APIs with SpringJoshua Long
 
Java EE and Spring Side-by-Side
Java EE and Spring Side-by-SideJava EE and Spring Side-by-Side
Java EE and Spring Side-by-SideReza Rahman
 
Spring mvc my Faviourite Slide
Spring mvc my Faviourite SlideSpring mvc my Faviourite Slide
Spring mvc my Faviourite SlideDaniel Adenew
 
02 java spring-hibernate-experience-questions
02 java spring-hibernate-experience-questions02 java spring-hibernate-experience-questions
02 java spring-hibernate-experience-questionsDhiraj Champawat
 
Spring 3 Annotated Development
Spring 3 Annotated DevelopmentSpring 3 Annotated Development
Spring 3 Annotated Developmentkensipe
 
Spring Web Service, Spring JMS, Eclipse & Maven tutorials
Spring Web Service, Spring JMS, Eclipse & Maven tutorialsSpring Web Service, Spring JMS, Eclipse & Maven tutorials
Spring Web Service, Spring JMS, Eclipse & Maven tutorialsRaghavan Mohan
 
Spring @Transactional Explained
Spring @Transactional ExplainedSpring @Transactional Explained
Spring @Transactional ExplainedSmita Prasad
 
What's new in Spring 3?
What's new in Spring 3?What's new in Spring 3?
What's new in Spring 3?Craig Walls
 
Spring MVC Architecture Tutorial
Spring MVC Architecture TutorialSpring MVC Architecture Tutorial
Spring MVC Architecture TutorialJava Success Point
 
MVC Pattern. Flex implementation of MVC
MVC Pattern. Flex implementation of MVCMVC Pattern. Flex implementation of MVC
MVC Pattern. Flex implementation of MVCAnton Krasnoshchok
 
Introduction to Spring MVC
Introduction to Spring MVCIntroduction to Spring MVC
Introduction to Spring MVCRichard Paul
 
Spring 4.0 - Evolution or Revolution
Spring 4.0 - Evolution or RevolutionSpring 4.0 - Evolution or Revolution
Spring 4.0 - Evolution or RevolutionRaffael Schmid
 

En vedette (16)

Spring annotation
Spring annotationSpring annotation
Spring annotation
 
Spring MVC Annotations
Spring MVC AnnotationsSpring MVC Annotations
Spring MVC Annotations
 
Spring Web MVC
Spring Web MVCSpring Web MVC
Spring Web MVC
 
Spring MVC Basics
Spring MVC BasicsSpring MVC Basics
Spring MVC Basics
 
REST APIs with Spring
REST APIs with SpringREST APIs with Spring
REST APIs with Spring
 
Java EE and Spring Side-by-Side
Java EE and Spring Side-by-SideJava EE and Spring Side-by-Side
Java EE and Spring Side-by-Side
 
Spring mvc my Faviourite Slide
Spring mvc my Faviourite SlideSpring mvc my Faviourite Slide
Spring mvc my Faviourite Slide
 
02 java spring-hibernate-experience-questions
02 java spring-hibernate-experience-questions02 java spring-hibernate-experience-questions
02 java spring-hibernate-experience-questions
 
Spring 3 Annotated Development
Spring 3 Annotated DevelopmentSpring 3 Annotated Development
Spring 3 Annotated Development
 
Spring Web Service, Spring JMS, Eclipse & Maven tutorials
Spring Web Service, Spring JMS, Eclipse & Maven tutorialsSpring Web Service, Spring JMS, Eclipse & Maven tutorials
Spring Web Service, Spring JMS, Eclipse & Maven tutorials
 
Spring @Transactional Explained
Spring @Transactional ExplainedSpring @Transactional Explained
Spring @Transactional Explained
 
What's new in Spring 3?
What's new in Spring 3?What's new in Spring 3?
What's new in Spring 3?
 
Spring MVC Architecture Tutorial
Spring MVC Architecture TutorialSpring MVC Architecture Tutorial
Spring MVC Architecture Tutorial
 
MVC Pattern. Flex implementation of MVC
MVC Pattern. Flex implementation of MVCMVC Pattern. Flex implementation of MVC
MVC Pattern. Flex implementation of MVC
 
Introduction to Spring MVC
Introduction to Spring MVCIntroduction to Spring MVC
Introduction to Spring MVC
 
Spring 4.0 - Evolution or Revolution
Spring 4.0 - Evolution or RevolutionSpring 4.0 - Evolution or Revolution
Spring 4.0 - Evolution or Revolution
 

Similaire à Spring Framework 4.0 - The Next Generation - Soft-Shake 2013

Spring 4-groovy
Spring 4-groovySpring 4-groovy
Spring 4-groovyGR8Conf
 
Testing Spring MVC and REST Web Applications
Testing Spring MVC and REST Web ApplicationsTesting Spring MVC and REST Web Applications
Testing Spring MVC and REST Web ApplicationsSam Brannen
 
Spring Framework 3.2 - What's New
Spring Framework 3.2 - What's NewSpring Framework 3.2 - What's New
Spring Framework 3.2 - What's NewSam Brannen
 
Spring 3.1 in a Nutshell - JAX London 2011
Spring 3.1 in a Nutshell - JAX London 2011Spring 3.1 in a Nutshell - JAX London 2011
Spring 3.1 in a Nutshell - JAX London 2011Sam Brannen
 
Spring Day | Spring 3.1 in a Nutshell | Sam Brannen
Spring Day | Spring 3.1 in a Nutshell | Sam BrannenSpring Day | Spring 3.1 in a Nutshell | Sam Brannen
Spring Day | Spring 3.1 in a Nutshell | Sam BrannenJAX London
 
Spring 3.1 to 3.2 in a Nutshell - Spring I/O 2012
Spring 3.1 to 3.2 in a Nutshell - Spring I/O 2012Spring 3.1 to 3.2 in a Nutshell - Spring I/O 2012
Spring 3.1 to 3.2 in a Nutshell - Spring I/O 2012Sam Brannen
 
A Journey through the JDKs (Java 9 to Java 11)
A Journey through the JDKs (Java 9 to Java 11)A Journey through the JDKs (Java 9 to Java 11)
A Journey through the JDKs (Java 9 to Java 11)Markus Günther
 
Spring Framework 4.1
Spring Framework 4.1Spring Framework 4.1
Spring Framework 4.1Sam Brannen
 
Apache maven and its impact on java 9 (Java One 2017)
Apache maven and its impact on java 9 (Java One 2017)Apache maven and its impact on java 9 (Java One 2017)
Apache maven and its impact on java 9 (Java One 2017)Robert Scholte
 
Playing with Java Classes and Bytecode
Playing with Java Classes and BytecodePlaying with Java Classes and Bytecode
Playing with Java Classes and BytecodeYoav Avrahami
 
Composable Software Architecture with Spring
Composable Software Architecture with SpringComposable Software Architecture with Spring
Composable Software Architecture with SpringSam Brannen
 
Scala at Treasure Data
Scala at Treasure DataScala at Treasure Data
Scala at Treasure DataTaro L. Saito
 
Java jdk-update-nov10-sde-v3m
Java jdk-update-nov10-sde-v3mJava jdk-update-nov10-sde-v3m
Java jdk-update-nov10-sde-v3mSteve Elliott
 
The Meteor Framework
The Meteor FrameworkThe Meteor Framework
The Meteor FrameworkDamien Magoni
 
JUnit 5 - from Lambda to Alpha and beyond
JUnit 5 - from Lambda to Alpha and beyondJUnit 5 - from Lambda to Alpha and beyond
JUnit 5 - from Lambda to Alpha and beyondSam Brannen
 
Summary of JDK10 and What will come into JDK11
Summary of JDK10 and What will come into JDK11Summary of JDK10 and What will come into JDK11
Summary of JDK10 and What will come into JDK11なおき きしだ
 

Similaire à Spring Framework 4.0 - The Next Generation - Soft-Shake 2013 (20)

Spring 4-groovy
Spring 4-groovySpring 4-groovy
Spring 4-groovy
 
Testing Spring MVC and REST Web Applications
Testing Spring MVC and REST Web ApplicationsTesting Spring MVC and REST Web Applications
Testing Spring MVC and REST Web Applications
 
Spring Framework 3.2 - What's New
Spring Framework 3.2 - What's NewSpring Framework 3.2 - What's New
Spring Framework 3.2 - What's New
 
Spring 3.1 in a Nutshell - JAX London 2011
Spring 3.1 in a Nutshell - JAX London 2011Spring 3.1 in a Nutshell - JAX London 2011
Spring 3.1 in a Nutshell - JAX London 2011
 
Spring Day | Spring 3.1 in a Nutshell | Sam Brannen
Spring Day | Spring 3.1 in a Nutshell | Sam BrannenSpring Day | Spring 3.1 in a Nutshell | Sam Brannen
Spring Day | Spring 3.1 in a Nutshell | Sam Brannen
 
Spring 3.1 to 3.2 in a Nutshell - Spring I/O 2012
Spring 3.1 to 3.2 in a Nutshell - Spring I/O 2012Spring 3.1 to 3.2 in a Nutshell - Spring I/O 2012
Spring 3.1 to 3.2 in a Nutshell - Spring I/O 2012
 
Get ready for spring 4
Get ready for spring 4Get ready for spring 4
Get ready for spring 4
 
A Journey through the JDKs (Java 9 to Java 11)
A Journey through the JDKs (Java 9 to Java 11)A Journey through the JDKs (Java 9 to Java 11)
A Journey through the JDKs (Java 9 to Java 11)
 
Java SE 8 & EE 7 Launch
Java SE 8 & EE 7 LaunchJava SE 8 & EE 7 Launch
Java SE 8 & EE 7 Launch
 
Spring Framework 4.1
Spring Framework 4.1Spring Framework 4.1
Spring Framework 4.1
 
Apache maven and its impact on java 9 (Java One 2017)
Apache maven and its impact on java 9 (Java One 2017)Apache maven and its impact on java 9 (Java One 2017)
Apache maven and its impact on java 9 (Java One 2017)
 
Playing with Java Classes and Bytecode
Playing with Java Classes and BytecodePlaying with Java Classes and Bytecode
Playing with Java Classes and Bytecode
 
Composable Software Architecture with Spring
Composable Software Architecture with SpringComposable Software Architecture with Spring
Composable Software Architecture with Spring
 
JSF2
JSF2JSF2
JSF2
 
Scala at Treasure Data
Scala at Treasure DataScala at Treasure Data
Scala at Treasure Data
 
Java 8
Java 8Java 8
Java 8
 
Java jdk-update-nov10-sde-v3m
Java jdk-update-nov10-sde-v3mJava jdk-update-nov10-sde-v3m
Java jdk-update-nov10-sde-v3m
 
The Meteor Framework
The Meteor FrameworkThe Meteor Framework
The Meteor Framework
 
JUnit 5 - from Lambda to Alpha and beyond
JUnit 5 - from Lambda to Alpha and beyondJUnit 5 - from Lambda to Alpha and beyond
JUnit 5 - from Lambda to Alpha and beyond
 
Summary of JDK10 and What will come into JDK11
Summary of JDK10 and What will come into JDK11Summary of JDK10 and What will come into JDK11
Summary of JDK10 and What will come into JDK11
 

Plus de Sam Brannen

Testing with Spring, AOT, GraalVM, and JUnit 5 - Spring I/O 2023
Testing with Spring, AOT, GraalVM, and JUnit 5 - Spring I/O 2023Testing with Spring, AOT, GraalVM, and JUnit 5 - Spring I/O 2023
Testing with Spring, AOT, GraalVM, and JUnit 5 - Spring I/O 2023Sam Brannen
 
Testing with JUnit 5 and Spring - Spring I/O 2022
Testing with JUnit 5 and Spring - Spring I/O 2022Testing with JUnit 5 and Spring - Spring I/O 2022
Testing with JUnit 5 and Spring - Spring I/O 2022Sam Brannen
 
JUnit 5 - Evolution and Innovation - SpringOne Platform 2019
JUnit 5 - Evolution and Innovation - SpringOne Platform 2019JUnit 5 - Evolution and Innovation - SpringOne Platform 2019
JUnit 5 - Evolution and Innovation - SpringOne Platform 2019Sam Brannen
 
JUnit 5: What's New and What's Coming - Spring I/O 2019
JUnit 5: What's New and What's Coming - Spring I/O 2019JUnit 5: What's New and What's Coming - Spring I/O 2019
JUnit 5: What's New and What's Coming - Spring I/O 2019Sam Brannen
 
JUnit 5 - New Opportunities for Testing on the JVM
JUnit 5 - New Opportunities for Testing on the JVMJUnit 5 - New Opportunities for Testing on the JVM
JUnit 5 - New Opportunities for Testing on the JVMSam Brannen
 
Get the Most out of Testing with Spring 4.2
Get the Most out of Testing with Spring 4.2Get the Most out of Testing with Spring 4.2
Get the Most out of Testing with Spring 4.2Sam Brannen
 
Testing with Spring: An Introduction
Testing with Spring: An IntroductionTesting with Spring: An Introduction
Testing with Spring: An IntroductionSam Brannen
 
Testing with Spring 4.x
Testing with Spring 4.xTesting with Spring 4.x
Testing with Spring 4.xSam Brannen
 
Testing Web Apps with Spring Framework 3.2
Testing Web Apps with Spring Framework 3.2Testing Web Apps with Spring Framework 3.2
Testing Web Apps with Spring Framework 3.2Sam Brannen
 
Spring 3.1 and MVC Testing Support - 4Developers
Spring 3.1 and MVC Testing Support - 4DevelopersSpring 3.1 and MVC Testing Support - 4Developers
Spring 3.1 and MVC Testing Support - 4DevelopersSam Brannen
 
Effective out-of-container Integration Testing - 4Developers
Effective out-of-container Integration Testing - 4DevelopersEffective out-of-container Integration Testing - 4Developers
Effective out-of-container Integration Testing - 4DevelopersSam Brannen
 
Spring 3.1 to 3.2 in a Nutshell - SDC2012
Spring 3.1 to 3.2 in a Nutshell - SDC2012Spring 3.1 to 3.2 in a Nutshell - SDC2012
Spring 3.1 to 3.2 in a Nutshell - SDC2012Sam Brannen
 
Spring 3.1 and MVC Testing Support
Spring 3.1 and MVC Testing SupportSpring 3.1 and MVC Testing Support
Spring 3.1 and MVC Testing SupportSam Brannen
 
Spring 3.1 in a Nutshell
Spring 3.1 in a NutshellSpring 3.1 in a Nutshell
Spring 3.1 in a NutshellSam Brannen
 
Spring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. RESTSpring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. RESTSam Brannen
 
Effective out-of-container Integration Testing
Effective out-of-container Integration TestingEffective out-of-container Integration Testing
Effective out-of-container Integration TestingSam Brannen
 
What's New in Spring 3.0
What's New in Spring 3.0What's New in Spring 3.0
What's New in Spring 3.0Sam Brannen
 
Modular Web Applications with OSGi
Modular Web Applications with OSGiModular Web Applications with OSGi
Modular Web Applications with OSGiSam Brannen
 
Enterprise Applications With OSGi and SpringSource dm Server
Enterprise Applications With OSGi and SpringSource dm ServerEnterprise Applications With OSGi and SpringSource dm Server
Enterprise Applications With OSGi and SpringSource dm ServerSam Brannen
 

Plus de Sam Brannen (19)

Testing with Spring, AOT, GraalVM, and JUnit 5 - Spring I/O 2023
Testing with Spring, AOT, GraalVM, and JUnit 5 - Spring I/O 2023Testing with Spring, AOT, GraalVM, and JUnit 5 - Spring I/O 2023
Testing with Spring, AOT, GraalVM, and JUnit 5 - Spring I/O 2023
 
Testing with JUnit 5 and Spring - Spring I/O 2022
Testing with JUnit 5 and Spring - Spring I/O 2022Testing with JUnit 5 and Spring - Spring I/O 2022
Testing with JUnit 5 and Spring - Spring I/O 2022
 
JUnit 5 - Evolution and Innovation - SpringOne Platform 2019
JUnit 5 - Evolution and Innovation - SpringOne Platform 2019JUnit 5 - Evolution and Innovation - SpringOne Platform 2019
JUnit 5 - Evolution and Innovation - SpringOne Platform 2019
 
JUnit 5: What's New and What's Coming - Spring I/O 2019
JUnit 5: What's New and What's Coming - Spring I/O 2019JUnit 5: What's New and What's Coming - Spring I/O 2019
JUnit 5: What's New and What's Coming - Spring I/O 2019
 
JUnit 5 - New Opportunities for Testing on the JVM
JUnit 5 - New Opportunities for Testing on the JVMJUnit 5 - New Opportunities for Testing on the JVM
JUnit 5 - New Opportunities for Testing on the JVM
 
Get the Most out of Testing with Spring 4.2
Get the Most out of Testing with Spring 4.2Get the Most out of Testing with Spring 4.2
Get the Most out of Testing with Spring 4.2
 
Testing with Spring: An Introduction
Testing with Spring: An IntroductionTesting with Spring: An Introduction
Testing with Spring: An Introduction
 
Testing with Spring 4.x
Testing with Spring 4.xTesting with Spring 4.x
Testing with Spring 4.x
 
Testing Web Apps with Spring Framework 3.2
Testing Web Apps with Spring Framework 3.2Testing Web Apps with Spring Framework 3.2
Testing Web Apps with Spring Framework 3.2
 
Spring 3.1 and MVC Testing Support - 4Developers
Spring 3.1 and MVC Testing Support - 4DevelopersSpring 3.1 and MVC Testing Support - 4Developers
Spring 3.1 and MVC Testing Support - 4Developers
 
Effective out-of-container Integration Testing - 4Developers
Effective out-of-container Integration Testing - 4DevelopersEffective out-of-container Integration Testing - 4Developers
Effective out-of-container Integration Testing - 4Developers
 
Spring 3.1 to 3.2 in a Nutshell - SDC2012
Spring 3.1 to 3.2 in a Nutshell - SDC2012Spring 3.1 to 3.2 in a Nutshell - SDC2012
Spring 3.1 to 3.2 in a Nutshell - SDC2012
 
Spring 3.1 and MVC Testing Support
Spring 3.1 and MVC Testing SupportSpring 3.1 and MVC Testing Support
Spring 3.1 and MVC Testing Support
 
Spring 3.1 in a Nutshell
Spring 3.1 in a NutshellSpring 3.1 in a Nutshell
Spring 3.1 in a Nutshell
 
Spring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. RESTSpring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. REST
 
Effective out-of-container Integration Testing
Effective out-of-container Integration TestingEffective out-of-container Integration Testing
Effective out-of-container Integration Testing
 
What's New in Spring 3.0
What's New in Spring 3.0What's New in Spring 3.0
What's New in Spring 3.0
 
Modular Web Applications with OSGi
Modular Web Applications with OSGiModular Web Applications with OSGi
Modular Web Applications with OSGi
 
Enterprise Applications With OSGi and SpringSource dm Server
Enterprise Applications With OSGi and SpringSource dm ServerEnterprise Applications With OSGi and SpringSource dm Server
Enterprise Applications With OSGi and SpringSource dm Server
 

Dernier

Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
Presentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxPresentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxRosabel UA
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxVanesaIglesias10
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptxmary850239
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
Millenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxMillenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxJanEmmanBrigoli
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmStan Meyer
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
EMBODO Lesson Plan Grade 9 Law of Sines.docx
EMBODO Lesson Plan Grade 9 Law of Sines.docxEMBODO Lesson Plan Grade 9 Law of Sines.docx
EMBODO Lesson Plan Grade 9 Law of Sines.docxElton John Embodo
 

Dernier (20)

Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
Presentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxPresentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptx
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
 
Paradigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTAParadigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTA
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
Millenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxMillenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptx
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and Film
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
EMBODO Lesson Plan Grade 9 Law of Sines.docx
EMBODO Lesson Plan Grade 9 Law of Sines.docxEMBODO Lesson Plan Grade 9 Law of Sines.docx
EMBODO Lesson Plan Grade 9 Law of Sines.docx
 

Spring Framework 4.0 - The Next Generation - Soft-Shake 2013

  • 1. Spring Framework 4.0 The Next Generation Sam Brannen @sam_brannen Soft-Shake | Geneva, Switzerland | 24 October 2013
  • 2. Sam Brannen •  Spring and Java Consultant @ Swiftmind •  Java Developer for over 15 years •  Spring Framework Core Committer since 2007 •  Spring Trainer •  Presenter on Spring, Java, OSGi, and testing 2
  • 3. Swiftmind Your experts for Enterprise Java Areas of expertise •  Spring * •  Java EE •  OSGi •  Agile Methodologies •  Software Engineering Best Practices Where you find us •  Zurich, Switzerland •  Twitter: @swiftmind •  http://www.swiftmind.com 3
  • 4. A Show of Hands… 4
  • 5. Agenda •  Spring 3.x in Review •  Themes in 4.0 •  Java EE •  Java SE •  Spring 4 on Java 8 5
  • 6. Spring 3.x in Review 6
  • 7. Spring 3.x: Component Model •  Powerful annotated component model –  stereotypes, configuration classes, composable annotations, profiles •  Spring Expression Language (SpEL) –  XML config files –  @Value, @Cacheable, etc. –  JSPs 7
  • 8. Spring 3.x: Component Model •  Comprehensive REST support –  and other Spring @MVC additions •  Support for async MVC processing –  Spring MVC interacting with Servlet 3.0 async callbacks 8
  • 9. Spring 3.x: Component Model •  Declarative validation and formatting –  integration with JSR-303 Bean Validation •  Declarative scheduling –  trigger abstraction and cron support •  Declarative caching –  in-memory, Ehcache, etc. 9
  • 10. Spring 3.x: Testing •  Embedded databases via <jdbc /> namespace •  @Configuration classes & @ActiveProfiles •  @WebAppConfiguration •  @ContextHierarchy •  Spring MVC Test framework 10
  • 11. Spring 3.x: Key Specs •  JSR-330 –  Dependency Injection for Java –  @Inject, @Qualifier, Provider mechanism •  JSR-303 –  Bean Validation 1.0 –  declarative constraints –  embedded validation engine 11
  • 12. Spring 3.x: Key Specs •  JPA 2.0 –  persistence provider integration –  Spring transactions •  Servlet 3.0 –  web.xml-free deployment –  async request processing 12
  • 14. Composable Stereotypes •  Combining meta-annotations on a custom stereotype •  Automatically detected: no configuration necessary! 14
  • 17. New Baselines •  Java SE 6+ •  Java EE 6+ –  Servlet 3.0 focused, Servlet 2.5 compatible •  All deprecated packages removed •  Many deprecated methods removed as well 17
  • 18. Third Party Libraries •  Minimum versions ~ mid 2010 now •  For example –  Hibernate 3.6+ –  Quartz 1.8+ –  Ehcache 2.1+ 18
  • 19. Java 8 Language and API Features •  Lambda expressions •  Method references •  JSR-310 Date and Time •  Repeatable annotations •  Parameter name discovery 19
  • 20. Groovy + Spring 4.0 •  A smooth out-of-the-box experience for Groovy-based Spring applications •  AOP adaptations –  special handling of GroovyObject calls –  consider a Spring application with all components written in the Groovy language instead of Java •  Groovy-based bean definitions –  formerly known as the Bean Builder in Grails –  now to live alongside Spring's configuration class model 20
  • 21. Conditional Bean Definitions •  A generalized model for conditional bean definitions –  a more flexible and more dynamic variant of bean definition profiles (as known from Spring 3.1) –  can be used for smart defaulting –  see Spring Boot J •  @Conditional with programmatic Condition implementations –  can react to rich context (existing bean definitions, etc.) –  profile support now simply a ProfileCondition implementation class 21
  • 22. Annotation-based Components •  Custom annotations may override specific attributes of meta-annotations •  Purely convention-based –  use of same attribute name @MyTransactional(readOnly = true) @MySessionScope(scopedProxyMode = TARGET_CLASS) 22
  • 23. Lazy Resolution Proxies •  @Lazy on injection point •  Alternative to Provider<MyTargetType> 23
  • 24. Ordered Injection of Lists & Arrays •  Ordered / @Order on candidate beans •  Relative order within specific injection result 24
  • 25. DI and Generics •  Type matching based on full generic type –  e.g., MyRepository<Customer> •  Generic factory methods now fully supported in XML config files –  Mockito, EasyMock, etc. 25
  • 26. spring-messaging •  New org.springframework.messaging module •  Extracted from Spring Integration •  Core message and channel abstractions 26
  • 27. WebSockets •  WebSocket endpoint model along the lines of Spring MVC •  JSR-356 but also covering SockJS and STOMP •  Endpoints using generic messaging patterns 27
  • 28. AsyncRestTemplate •  Analogous to existing RestTemplate •  Based on ListenableFuture return values 28
  • 30. Java EE Support (1/2) •  Spring 2.5 –  completed Java EE 5 support –  J2EE 1.3 à Java EE 5 •  Spring 3.0 –  introduced Java EE 6 support –  J2EE 1.4 à Java EE 6 30
  • 31. Java EE Support (2/2) •  Spring 3.1 / 3.2 –  strong Servlet 3.0 focus –  J2EE 1.4 (deprecated) à Java EE 6 •  Spring 4.0 –  introduces explicit Java EE 7 support –  Java EE 5 (with JPA 2.0 feature pack) à Java EE 7 31
  • 32. Enterprise API Updates •  JMS 2.0 –  delivery delay, JMS 2.0 createSession() variants, etc. •  JTA 1.2 –  javax.transaction.Transactional annotation •  JPA 2.1 –  unsynchronized persistence contexts •  Bean Validation 1.1 –  method parameter and return value constraints 32
  • 34. Java SE Support (1/2) •  Spring 2.5 –  introduced Java 6 support –  JDK 1.4 à JDK 6 •  Spring 3.0 –  raised the bar to Java 5+ –  JDK 5 à JDK 6 34
  • 35. Java SE Support (2/2) •  Spring 3.1 / 3.2 –  explicit Java 7 support –  JDK 5 à JDK 7 •  Spring 4.0 –  introduces explicit Java 8 support –  JDK 6 à JDK 8 35
  • 36. Java 8 Programming Model 36
  • 37. The State of Java 8 •  Delayed again... •  Scheduled for GA in September 2013 •  Now just Developer Preview in September •  OpenJDK 8 GA as late as March 2014 L 37
  • 38. IDE Support for Java 8 •  IntelliJ –  available since IDEA 12, released in Dec 2012 •  Eclipse –  announced for June 2014 L •  Spring Tool Suite –  Eclipse-based beta support earlier 38
  • 39. Java 8 Bytecode Level •  Generated by -target 1.8 –  compiler's default •  Not accepted by ASM 4.x –  Spring's bytecode parsing library •  Spring Framework 4.0 comes with a patched (jarjar’ed) ASM 4.1 variant 39
  • 40. HashMap / HashSet Differences •  Different hash algorithms in use •  Leading to different hash iteration order •  Code shouldn't rely on such an order but sometimes does 40
  • 41. Java 8 Lambda Conventions Simple rule: interface with single method –  typically callback interfaces –  for example: Runnable, Callable –  formerly “Single Abstract Method” (SAM) types –  now “functional interfaces” 41
  • 42. Lambda + Spring = Natural Fit Many Spring APIs are candidates for lambdas –  by naturally following the lambda interface conventions 42
  • 43. Lambdas with JmsTemplate MessageCreator Message createMessage(Session session) throws JMSException 43
  • 44. Lambdas with TransactionTemplate TransactionCallback Object doInTransaction(TransactionStatus status) 44
  • 45. Lambdas with JdbcTemplate RowMapper Object mapRow(ResultSet rs, int rowNum) throws SQLException 45
  • 46. Ex: Lambdas with JdbcTemplate #1 JdbcTemplate jt = new JdbcTemplate(dataSource); jt.query( "SELECT name, age FROM person WHERE dep = ?", ps -> { ps.setString(1, "Sales"); }, (rs, rowNum) -> new Person(rs.getString(1), rs.getInt(2)) ); 46
  • 47. Ex: Lambdas with JdbcTemplate #2 JdbcTemplate jt = new JdbcTemplate(dataSource); jt.query( "SELECT name, age FROM person WHERE dep = ?", ps -> { ps.setString(1, "Sales"); }, (rs, rowNum) -> { return new Person(rs.getString(1), rs.getInt(2)); } ); 47
  • 48. Method References public List<Person> getPersonList(String department) { JdbcTemplate jt = new JdbcTemplate(dataSource); return jt.query( "SELECT name, age FROM person WHERE dep = ?", ps -> { ps.setString(1, "Sales"); }, this::mapPerson); } private Person mapPerson(ResultSet rs, int rowNum) throws SQLException { return new Person(rs.getString(1), rs.getInt(2)); } 48
  • 49. JSR-310 Date and Time 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; // ... } 49
  • 50. Repeatable Annotations Repeated @Scheduled(cron = "0 0 12 * * ?") @Scheduled(cron = "0 0 18 * * ?") public void performTempFileCleanup() { /* ... */ } Container @Schedules({ @Scheduled(cron = "0 0 12 * * ?"), @Scheduled(cron = "0 0 18 * * ?") }) public void performTempFileCleanup() { /* ... */ } JDK 8 JDK 6+ 50
  • 51. Parameter Name Discovery •  Java 8 defines a Parameter reflection type for methods –  application sources to be compiled with –parameters •  Spring's StandardReflectionParameterNameDiscoverer –  reading parameter names via Java 8's new Parameter type •  Spring's DefaultParameterNameDiscoverer –  now checking Java 8 first (-parameters) –  ASM-based reading of debug symbols next (-debug) 51
  • 53. Spring Framework 4.0 Roadmap •  RC1: end of October •  RC2: mid November •  GA: end of 2013 53
  • 54. Upgrade Considerations •  Spring 3.2 does not support 1.8 bytecode level –  upgrade to Spring 4.0 to enable Java 8 language features •  Spring Framework 4.0 still compatible with JDK 6 and 7 •  Spring Framework 3.2 is in maintenance mode 54
  • 55. Acknowledgements Special thanks to Spring Framework project lead Juergen Hoeller for permitting reuse of his content. 55
  • 56. Spring Resources •  Spring Framework –  http://projects.spring.io/spring-framework •  Spring Forums –  http://forum.spring.io •  Spring JIRA –  https://jira.springsource.org •  Spring on GitHub –  https://github.com/spring-projects/spring-framework 56
  • 57. Blogs •  Swiftmind Blog –  http://www.swiftmind.com/blog •  Spring Blog –  http://spring.io/blog 57