SlideShare a Scribd company logo
1 of 38
Speaker: Oleg Tsal-Tsalko (@tsaltsol)
Next stop: Spring 4
About me
Oleg Tsal-Tsalko
• Senior Java Developer in EPAM Systems.
• Mostly working with enterprise business
applications.
• Member of LJC and JUG KPI communities.
What version of Spring are you using?
Bank
applications
Spring 3.1
(Previous stop)
• Environment abstraction and profiles
• Java-based application configuration
• Overhaul of the test context framework
• Cache abstraction & declarative caching
• Servlet 3.0 based web applications
• @MVC processing & flash attributes
• Support for Java SE 7
And much more…
Exposing entities via REST
XML based configuration
<beans …>
<cache:annotation-driven />
<bean id="cacheManager" class="org.springframework.cache.support.SimpleCacheManager">
…
</bean>
<context:property-placeholder location="classpath:/app-common.properties"/>
<bean id="bookStoreService" class="spring.samples.service.BookStoreService" c:bookStoreDao-
ref="bookStoreDao"/>
<bean id="bookStoreDao" class="spring.samples.dao.BookStoreDao">
<property name="dataSource" ref="dataSource"/>
</bean>
…
</beans>
ApplicationContext context = new ClassPathXmlApplicationContext("bookstore-app-context.xml");
Java based configuration
ApplicationContext context = new AnnotationConfigApplicationContext(BookStoreAppConfig.class);
Test context java based
configuration
Profiles in XML based configuration
<beans>
...
<beans profile="dev">
<jdbc:embedded-database id="dataSource">
<jdbc:script location="classpath:db/schema.sql"/>
<jdbc:script location="classpath:db/test-data.sql"/>
</jdbc:embedded-database>
</beans>
<beans profile="production">
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="oracle.jdbc.OracleDriver"/>
<property name="url" value="jdbc:oracle:thin:@localhost:1521:booklibrary"/>
<property name="username" value="admin"/>
<property name="password" value="admin"/>
</bean>
</beans>
...
</beans>
Profiles in Java based configuration
@Configuration
@Profile("dev")
public class DevProfileConfig {
@Bean(name="dataSource”)
public DataSource dataSource() {…}
}
@Configuration
@Profile("production")
public class ProductionProfileConfig {
@Bean(name="dataSource”)
public DataSource dataSource() {…}
}
@Configuration
@Import( { DevProfileConfig.class, ProductionProfileConfig.class } )
public class BookStoreAppConfig {
@Inject
private DataSource dataSource;
}
How to enable active profile?
1) Using JVM property, which is preferred way:
2) Programmatically in standalone app:
-Dspring.profiles.active=dev
3) In web.xml file:
Cache abstraction
• CacheManager and Cache abstraction in
org.springframework.cache
• Out of the box support for ConcurrentMap
and EhCache
• Ability to plug any Cache implementation (see
Spring GemFire project for GemFile adapter)
Declarative Cache support
Enable caching annotations
@Configuration
@EnableCaching
public class AppConfig {
@Bean
public CacheManager cacheManager() {…}
…
}
<beans …>
<cache:annotation-driven />
<bean id="cacheManager"
class="org.springframework.cache.support.SimpleCacheManager">
…
</bean>
…
</beans>
Servlet 3.0 support
• such as Tomcat 7 and GlassFish 3
Explicit support
for Servlet 3.0
containers
• Servlet 3.0's ServletContainerInitializer mechanism
• Spring 3.1's
AnnotationConfigWebApplicationContext
• Spring 3.1's environment abstraction
Support for XML-
free web
application setup
• such as standard Servlet 3.0 file upload behind
Spring's MultipartResolver abstraction
Exposure of native
Servlet 3.0
functionality in
Spring MVC
Spring MVC without web.xml
Spring 3.2
(Current stop)
• Gradle-based build
• Sources moved to GitHub
• Sources built against Java 7
• Async MVC processing on Servlet 3.0
• Spring MVC test support
• MVC configuration and SpEL refinements
And much more…
Async MVC processing: Callable
- thread managed by Spring MVC
- good for long running database jobs, 3rd party REST API calls, etc
Async MVC Processing: DeferredResult
- thread managed outside of Spring MVC
- JMS or AMQP message listener, another HTTP request, etc.
Async MVC Processing: WebAsyncTask
- same as Callable, with extra features
- override timeout value for async processing
- lets you specify a specific AsyncTaskExecutor
MVC Test Framework Server
MVC Test Framework Client
Spring 4
Engineering works will be held till the end of the year…
Spring 4
(Next stop)
We are expecting to see:
• Comprehensive Java 8 support
• Support for Java EE 7 APIs
• Focus on message-oriented architectures
• Annotation-driven JMS endpoint model
• Revised application event mechanism
• WebSocket support in Spring MVC
• Next-generation Groovy support
And more…
Java 8 & Java EE 7 support
Comprehensive Java 8
support
• Lambdas
• Date and Time API (JSR-310)
• Parameter name discovery
• Repeatable annotations
• Concurrency enhancement
Support for Java EE 7 APIs
• Asynchronous API for RestTemplate
• Bean Validation 1.1 (JSR-349)
• Expression Language 3.0 (JSR-341)
• JMS 2.0 (JSR-343)
• Concurrency Utilities for Java EE (JSR-
236)
• JPA 2.1 (JSR-338)
• Servlet 3.1 (JSR-340)
• JSF 2.2 (JSR-344)
Annotation driven message
endpoints
<jms:annotation-driven>
@JmsListener(destination="myQueue")
public void handleMessage(TextMessage payload);
@JmsListener(destination="myQueue", selector="...")
public void handleMessage(String payload);
@JmsListener(destination="myQueue")
public String handleMessage(String payload);
However this is not implemented yet -
https://jira.springsource.org/browse/SPR-9882
Bean Validation 1.1 support
MethodValidationInterceptor autodetects Bean Validation 1.1's ExecutableValidator API now
and uses it in favor of Hibernate Validator 4.2's native variant.
JMS 2.0 support
What was done already:
• Added "deliveryDelay" property on JmsTemplate
• Added support for "deliveryDelay" and CompletionListener to
CachedMessageProducer
• Added support for the new "create(Shared)DurableConsumer" variants in
Spring’s CachingConnectionFactory
• Added support for the new "createSession" variants with fewer
parameters in Spring’s SingleConnectionFactory
Known constraints:
• There is no special support for the simplified JMSContext API, and likely
never will be, because of different Spring mechanism of managing
connection pools and sessions
• JmsTemplate has no out-of-the-box support for send calls with an async
completion listener.
JEE7 concurrency utilities in Spring 4
This is built into ConcurrentTaskExecutor and ConcurrentTaskScheduler now,
automatically detecting the JSR-236 ExecutorService variants and adapting
to them.
Example of ManagedExecutorService usage introduced in JEE7:
JPA 2.1 support
EntityManagerFactory.createEntityManager(
SynchronizationType.SYNCHRONIZED/UNSYNCHRONIZED, Map)
@PersistenceContext(
synchronizationType=SYNCHRONIZED/UNSYNCHRONIZED)
Support for both transactional and extended EntityManagers
and for both Spring-managed resource transactions and JTA
transactions
WebSockets server side support
WebSockets server side support
WebSockets server side support
WebSockets Client side support
Programatic approach:
Configuration based approach:
JDK8 support in depth
• Implicit use of LinkedHashMap/Set instead of simple
HashMap/Set to preserve ordering diffs in JDK7 and JDK8
• Embed ASM4.1 into Spring codebase to support JDK8
bytecode changes and to keep compatibility with CGLib3.0
• Support for JDK 8 Data & Time (JSR-310) encorporated with
Spring’s Joda Time lib
• Add awaitTerminationSeconds/commonPool properties to
ForkJoinPoolFactoryBean to support JDK8 changes in it.
• Encorporate JDK8 changes in reflection API (such as
java.lang.reflect.Parameter)
Other changes…
• Replace Burlap with Hessian (lightweight binary WS protocol)
• Introduced @Conditional annotation (@Profile annotation
has been refactored)
• Updated to Gradle 1.6
How to track progress?
• Track JIRA -
https://jira.springsource.org/issues/?jql=proje
ct%20%3D%20SPR%20AND%20labels%20%3D
%20%22major-theme-4.0%22
• Check commits to codebase -
https://github.com/SpringSource/spring-
framework/commits/master
Thank you!
Oleg Tsal-Tsalko
Email: oleg.tsalko@gmail.com
Twitter: @tsaltsol
Special thanks to Josh Long (@starbuxman) for
sharing quite useful info…

More Related Content

What's hot

Spring bean mod02
Spring bean mod02Spring bean mod02
Spring bean mod02
Guo Albert
 

What's hot (19)

Spring Framework - Core
Spring Framework - CoreSpring Framework - Core
Spring Framework - Core
 
Spring MVC
Spring MVCSpring MVC
Spring MVC
 
Spring MVC 5 & Hibernate 5 Integration
Spring MVC 5 & Hibernate 5 IntegrationSpring MVC 5 & Hibernate 5 Integration
Spring MVC 5 & Hibernate 5 Integration
 
Spring introduction
Spring introductionSpring introduction
Spring introduction
 
Spring Framework - MVC
Spring Framework - MVCSpring Framework - MVC
Spring Framework - MVC
 
Spring framework in depth
Spring framework in depthSpring framework in depth
Spring framework in depth
 
Spring Framework 4.0 - The Next Generation - Soft-Shake 2013
Spring Framework 4.0 - The Next Generation - Soft-Shake 2013Spring Framework 4.0 - The Next Generation - Soft-Shake 2013
Spring Framework 4.0 - The Next Generation - Soft-Shake 2013
 
Spring framework core
Spring framework coreSpring framework core
Spring framework core
 
Java spring framework
Java spring frameworkJava spring framework
Java spring framework
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
 
Building web applications with Java & Spring
Building web applications with Java & SpringBuilding web applications with Java & Spring
Building web applications with Java & Spring
 
Spring mvc
Spring mvcSpring mvc
Spring mvc
 
PUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBootPUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBoot
 
Java EE 8 Web Frameworks: A Look at JSF vs MVC
Java EE 8 Web Frameworks: A Look at JSF vs MVCJava EE 8 Web Frameworks: A Look at JSF vs MVC
Java EE 8 Web Frameworks: A Look at JSF vs MVC
 
Spring Framework Rohit
Spring Framework RohitSpring Framework Rohit
Spring Framework Rohit
 
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
 
Jspprogramming
JspprogrammingJspprogramming
Jspprogramming
 
Spring framework
Spring frameworkSpring framework
Spring framework
 

Viewers also liked

Spring 3.x - Spring MVC
Spring 3.x - Spring MVCSpring 3.x - Spring MVC
Spring 3.x - Spring MVC
Guy Nir
 
The Spring Framework: A brief introduction to Inversion of Control
The Spring Framework:A brief introduction toInversion of ControlThe Spring Framework:A brief introduction toInversion of Control
The Spring Framework: A brief introduction to Inversion of Control
VisualBee.com
 
Spring mvc my Faviourite Slide
Spring mvc my Faviourite SlideSpring mvc my Faviourite Slide
Spring mvc my Faviourite Slide
Daniel Adenew
 
02 java spring-hibernate-experience-questions
02 java spring-hibernate-experience-questions02 java spring-hibernate-experience-questions
02 java spring-hibernate-experience-questions
Dhiraj Champawat
 

Viewers also liked (17)

Spring 4 - A&BP CC
Spring 4 - A&BP CCSpring 4 - A&BP CC
Spring 4 - A&BP CC
 
Spring 3.x - Spring MVC
Spring 3.x - Spring MVCSpring 3.x - Spring MVC
Spring 3.x - Spring MVC
 
the Spring 4 update
the Spring 4 updatethe Spring 4 update
the Spring 4 update
 
Spring MVC Annotations
Spring MVC AnnotationsSpring MVC Annotations
Spring MVC Annotations
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
 
Spring MVC Basics
Spring MVC BasicsSpring MVC Basics
Spring MVC Basics
 
Introducción al desarrollo web moderno
Introducción al desarrollo web modernoIntroducción al desarrollo web moderno
Introducción al desarrollo web moderno
 
Introducción a ASP.NET MVC
Introducción a ASP.NET MVCIntroducción a ASP.NET MVC
Introducción a ASP.NET MVC
 
Arquitectura MVC
Arquitectura MVCArquitectura MVC
Arquitectura MVC
 
The Spring Framework: A brief introduction to Inversion of Control
The Spring Framework:A brief introduction toInversion of ControlThe Spring Framework:A brief introduction toInversion of Control
The Spring Framework: A brief introduction to Inversion of Control
 
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 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 3 Annotated Development
Spring 3 Annotated DevelopmentSpring 3 Annotated Development
Spring 3 Annotated Development
 
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
 

Similar to Next stop: Spring 4

Jsp and Servlets
Jsp and ServletsJsp and Servlets
Jsp and Servlets
Raghu nath
 
Struts 2-overview2
Struts 2-overview2Struts 2-overview2
Struts 2-overview2
divzi1913
 
Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5
Tuna Tore
 
springmvc-150923124312-lva1-app6892
springmvc-150923124312-lva1-app6892springmvc-150923124312-lva1-app6892
springmvc-150923124312-lva1-app6892
Tuna Tore
 

Similar to Next stop: Spring 4 (20)

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
 
Java EE 8 Update
Java EE 8 UpdateJava EE 8 Update
Java EE 8 Update
 
Jsp and Servlets
Jsp and ServletsJsp and Servlets
Jsp and Servlets
 
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
 
Spring Framework
Spring Framework  Spring Framework
Spring Framework
 
Unit 38 - Spring MVC Introduction.pptx
Unit 38 - Spring MVC Introduction.pptxUnit 38 - Spring MVC Introduction.pptx
Unit 38 - Spring MVC Introduction.pptx
 
Spring 3.1: a Walking Tour
Spring 3.1: a Walking TourSpring 3.1: a Walking Tour
Spring 3.1: a Walking Tour
 
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
 
Integrating Servlets and JSP (The MVC Architecture)
Integrating Servlets and JSP  (The MVC Architecture)Integrating Servlets and JSP  (The MVC Architecture)
Integrating Servlets and JSP (The MVC Architecture)
 
Cloud compiler - Minor Project by students of CBPGEC
Cloud compiler - Minor Project by students of CBPGEC  Cloud compiler - Minor Project by students of CBPGEC
Cloud compiler - Minor Project by students of CBPGEC
 
Java Server Faces (JSF) - Basics
Java Server Faces (JSF) - BasicsJava Server Faces (JSF) - Basics
Java Server Faces (JSF) - Basics
 
Java EE8 - by Kito Mann
Java EE8 - by Kito Mann Java EE8 - by Kito Mann
Java EE8 - by Kito Mann
 
Struts 2-overview2
Struts 2-overview2Struts 2-overview2
Struts 2-overview2
 
Struts 2 - Introduction
Struts 2 - Introduction Struts 2 - Introduction
Struts 2 - Introduction
 
Session 41 - Struts 2 Introduction
Session 41 - Struts 2 IntroductionSession 41 - Struts 2 Introduction
Session 41 - Struts 2 Introduction
 
Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5
 
springmvc-150923124312-lva1-app6892
springmvc-150923124312-lva1-app6892springmvc-150923124312-lva1-app6892
springmvc-150923124312-lva1-app6892
 
IP UNIT III PPT.pptx
 IP UNIT III PPT.pptx IP UNIT III PPT.pptx
IP UNIT III PPT.pptx
 
Java J2EE Interview Question Part 2
Java J2EE Interview Question Part 2Java J2EE Interview Question Part 2
Java J2EE Interview Question Part 2
 

More from Oleg Tsal-Tsalko

More from Oleg Tsal-Tsalko (14)

Developer on a mission (Devoxx UA 2021)
Developer on a mission (Devoxx UA 2021)Developer on a mission (Devoxx UA 2021)
Developer on a mission (Devoxx UA 2021)
 
Developer on a mission
Developer on a missionDeveloper on a mission
Developer on a mission
 
From Streams to Reactive Streams
From Streams to Reactive StreamsFrom Streams to Reactive Streams
From Streams to Reactive Streams
 
Java 9 Jigsaw HackDay
Java 9 Jigsaw HackDayJava 9 Jigsaw HackDay
Java 9 Jigsaw HackDay
 
JUG UA AdoptJSR participation
JUG UA AdoptJSR participationJUG UA AdoptJSR participation
JUG UA AdoptJSR participation
 
Develop modern apps using Spring ecosystem at time of BigData
Develop modern apps using Spring ecosystem at time of BigData Develop modern apps using Spring ecosystem at time of BigData
Develop modern apps using Spring ecosystem at time of BigData
 
Java 8 features
Java 8 featuresJava 8 features
Java 8 features
 
Lambdas HOL
Lambdas HOLLambdas HOL
Lambdas HOL
 
Java 8 date & time javaday2014
Java 8 date & time javaday2014Java 8 date & time javaday2014
Java 8 date & time javaday2014
 
Java 8 date & time
Java 8 date & timeJava 8 date & time
Java 8 date & time
 
Get ready for spring 4
Get ready for spring 4Get ready for spring 4
Get ready for spring 4
 
Enterprise Integration Patterns
Enterprise Integration PatternsEnterprise Integration Patterns
Enterprise Integration Patterns
 
Distributed systems and scalability rules
Distributed systems and scalability rulesDistributed systems and scalability rules
Distributed systems and scalability rules
 
JUG involvment in JCP and AdopJSR program
JUG involvment in JCP and AdopJSR programJUG involvment in JCP and AdopJSR program
JUG involvment in JCP and AdopJSR program
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 

Next stop: Spring 4

  • 1. Speaker: Oleg Tsal-Tsalko (@tsaltsol) Next stop: Spring 4
  • 2. About me Oleg Tsal-Tsalko • Senior Java Developer in EPAM Systems. • Mostly working with enterprise business applications. • Member of LJC and JUG KPI communities.
  • 3. What version of Spring are you using? Bank applications
  • 4. Spring 3.1 (Previous stop) • Environment abstraction and profiles • Java-based application configuration • Overhaul of the test context framework • Cache abstraction & declarative caching • Servlet 3.0 based web applications • @MVC processing & flash attributes • Support for Java SE 7 And much more…
  • 6. XML based configuration <beans …> <cache:annotation-driven /> <bean id="cacheManager" class="org.springframework.cache.support.SimpleCacheManager"> … </bean> <context:property-placeholder location="classpath:/app-common.properties"/> <bean id="bookStoreService" class="spring.samples.service.BookStoreService" c:bookStoreDao- ref="bookStoreDao"/> <bean id="bookStoreDao" class="spring.samples.dao.BookStoreDao"> <property name="dataSource" ref="dataSource"/> </bean> … </beans> ApplicationContext context = new ClassPathXmlApplicationContext("bookstore-app-context.xml");
  • 7. Java based configuration ApplicationContext context = new AnnotationConfigApplicationContext(BookStoreAppConfig.class);
  • 8. Test context java based configuration
  • 9. Profiles in XML based configuration <beans> ... <beans profile="dev"> <jdbc:embedded-database id="dataSource"> <jdbc:script location="classpath:db/schema.sql"/> <jdbc:script location="classpath:db/test-data.sql"/> </jdbc:embedded-database> </beans> <beans profile="production"> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName" value="oracle.jdbc.OracleDriver"/> <property name="url" value="jdbc:oracle:thin:@localhost:1521:booklibrary"/> <property name="username" value="admin"/> <property name="password" value="admin"/> </bean> </beans> ... </beans>
  • 10. Profiles in Java based configuration @Configuration @Profile("dev") public class DevProfileConfig { @Bean(name="dataSource”) public DataSource dataSource() {…} } @Configuration @Profile("production") public class ProductionProfileConfig { @Bean(name="dataSource”) public DataSource dataSource() {…} } @Configuration @Import( { DevProfileConfig.class, ProductionProfileConfig.class } ) public class BookStoreAppConfig { @Inject private DataSource dataSource; }
  • 11. How to enable active profile? 1) Using JVM property, which is preferred way: 2) Programmatically in standalone app: -Dspring.profiles.active=dev 3) In web.xml file:
  • 12. Cache abstraction • CacheManager and Cache abstraction in org.springframework.cache • Out of the box support for ConcurrentMap and EhCache • Ability to plug any Cache implementation (see Spring GemFire project for GemFile adapter)
  • 14. Enable caching annotations @Configuration @EnableCaching public class AppConfig { @Bean public CacheManager cacheManager() {…} … } <beans …> <cache:annotation-driven /> <bean id="cacheManager" class="org.springframework.cache.support.SimpleCacheManager"> … </bean> … </beans>
  • 15. Servlet 3.0 support • such as Tomcat 7 and GlassFish 3 Explicit support for Servlet 3.0 containers • Servlet 3.0's ServletContainerInitializer mechanism • Spring 3.1's AnnotationConfigWebApplicationContext • Spring 3.1's environment abstraction Support for XML- free web application setup • such as standard Servlet 3.0 file upload behind Spring's MultipartResolver abstraction Exposure of native Servlet 3.0 functionality in Spring MVC
  • 17. Spring 3.2 (Current stop) • Gradle-based build • Sources moved to GitHub • Sources built against Java 7 • Async MVC processing on Servlet 3.0 • Spring MVC test support • MVC configuration and SpEL refinements And much more…
  • 18. Async MVC processing: Callable - thread managed by Spring MVC - good for long running database jobs, 3rd party REST API calls, etc
  • 19. Async MVC Processing: DeferredResult - thread managed outside of Spring MVC - JMS or AMQP message listener, another HTTP request, etc.
  • 20. Async MVC Processing: WebAsyncTask - same as Callable, with extra features - override timeout value for async processing - lets you specify a specific AsyncTaskExecutor
  • 23. Spring 4 Engineering works will be held till the end of the year…
  • 24. Spring 4 (Next stop) We are expecting to see: • Comprehensive Java 8 support • Support for Java EE 7 APIs • Focus on message-oriented architectures • Annotation-driven JMS endpoint model • Revised application event mechanism • WebSocket support in Spring MVC • Next-generation Groovy support And more…
  • 25. Java 8 & Java EE 7 support Comprehensive Java 8 support • Lambdas • Date and Time API (JSR-310) • Parameter name discovery • Repeatable annotations • Concurrency enhancement Support for Java EE 7 APIs • Asynchronous API for RestTemplate • Bean Validation 1.1 (JSR-349) • Expression Language 3.0 (JSR-341) • JMS 2.0 (JSR-343) • Concurrency Utilities for Java EE (JSR- 236) • JPA 2.1 (JSR-338) • Servlet 3.1 (JSR-340) • JSF 2.2 (JSR-344)
  • 26. Annotation driven message endpoints <jms:annotation-driven> @JmsListener(destination="myQueue") public void handleMessage(TextMessage payload); @JmsListener(destination="myQueue", selector="...") public void handleMessage(String payload); @JmsListener(destination="myQueue") public String handleMessage(String payload); However this is not implemented yet - https://jira.springsource.org/browse/SPR-9882
  • 27. Bean Validation 1.1 support MethodValidationInterceptor autodetects Bean Validation 1.1's ExecutableValidator API now and uses it in favor of Hibernate Validator 4.2's native variant.
  • 28. JMS 2.0 support What was done already: • Added "deliveryDelay" property on JmsTemplate • Added support for "deliveryDelay" and CompletionListener to CachedMessageProducer • Added support for the new "create(Shared)DurableConsumer" variants in Spring’s CachingConnectionFactory • Added support for the new "createSession" variants with fewer parameters in Spring’s SingleConnectionFactory Known constraints: • There is no special support for the simplified JMSContext API, and likely never will be, because of different Spring mechanism of managing connection pools and sessions • JmsTemplate has no out-of-the-box support for send calls with an async completion listener.
  • 29. JEE7 concurrency utilities in Spring 4 This is built into ConcurrentTaskExecutor and ConcurrentTaskScheduler now, automatically detecting the JSR-236 ExecutorService variants and adapting to them. Example of ManagedExecutorService usage introduced in JEE7:
  • 30. JPA 2.1 support EntityManagerFactory.createEntityManager( SynchronizationType.SYNCHRONIZED/UNSYNCHRONIZED, Map) @PersistenceContext( synchronizationType=SYNCHRONIZED/UNSYNCHRONIZED) Support for both transactional and extended EntityManagers and for both Spring-managed resource transactions and JTA transactions
  • 34. WebSockets Client side support Programatic approach: Configuration based approach:
  • 35. JDK8 support in depth • Implicit use of LinkedHashMap/Set instead of simple HashMap/Set to preserve ordering diffs in JDK7 and JDK8 • Embed ASM4.1 into Spring codebase to support JDK8 bytecode changes and to keep compatibility with CGLib3.0 • Support for JDK 8 Data & Time (JSR-310) encorporated with Spring’s Joda Time lib • Add awaitTerminationSeconds/commonPool properties to ForkJoinPoolFactoryBean to support JDK8 changes in it. • Encorporate JDK8 changes in reflection API (such as java.lang.reflect.Parameter)
  • 36. Other changes… • Replace Burlap with Hessian (lightweight binary WS protocol) • Introduced @Conditional annotation (@Profile annotation has been refactored) • Updated to Gradle 1.6
  • 37. How to track progress? • Track JIRA - https://jira.springsource.org/issues/?jql=proje ct%20%3D%20SPR%20AND%20labels%20%3D %20%22major-theme-4.0%22 • Check commits to codebase - https://github.com/SpringSource/spring- framework/commits/master
  • 38. Thank you! Oleg Tsal-Tsalko Email: oleg.tsalko@gmail.com Twitter: @tsaltsol Special thanks to Josh Long (@starbuxman) for sharing quite useful info…