1
1
[[spring-whats-new]]
2
2
= What's New in Spring Framework 4.x
3
3
4
- This chapter provides an overview of the new features and improvements that have been introduced with Spring Framework 4.3. If you are interested in more details, please see the link:https://jira.spring.io/issues/?jql=project%20%3D%20SPR%20AND%20fixVersion%20in%20(%224.3%20RC1%22%2C%20%224.3%20RC2%22%2C%20%224.3%20GA%22)%20ORDER%20BY%20issuetype%20DESC&startIndex=50[Issue Tracker tickets] that were resolved as part of the 4.3 development process.
4
+ This chapter provides an overview of the new features and improvements that have been
5
+ introduced with Spring Framework 4.3. If you are interested in more details, please see the link:
6
+ https://jira.spring.io/issues/?jql=project%20%3D%20SPR%20AND%20fixVersion%20in%20(%224.3%20RC1%22%2C%20%224.3%20RC2%22%2C%20%224.3%20GA%22)%20ORDER%20BY%20issuetype%20DESC&startIndex=50[Issue Tracker tickets]
7
+ that were resolved as part of the 4.3 development process.
8
+
9
+
5
10
6
11
7
12
[[new-in-4.0]]
8
13
== New Features and Enhancements in Spring Framework 4.0
14
+
9
15
The Spring Framework was first released in 2004; since then there have been significant
10
16
major revisions: Spring 2.0 provided XML namespaces and AspectJ support; Spring 2.5
11
17
embraced annotation-driven configuration; Spring 3.0 introduced a strong Java 5+ foundation
@@ -22,6 +28,7 @@ is available on the {wiki-spring-framework}[Spring Framework GitHub Wiki].
22
28
23
29
24
30
=== Improved Getting Started Experience
31
+
25
32
The new https://spring.io[spring.io] website provides a whole series of
26
33
https://spring.io/guides["Getting Started"] guides to help you learn Spring. You
27
34
can read more about the guides in the <<overview-getting-started-with-spring>> section
@@ -35,6 +42,7 @@ Framework release.
35
42
36
43
37
44
=== Removed Deprecated Packages and Methods
45
+
38
46
All deprecated packages, and many deprecated classes and methods have been removed with
39
47
version 4.0. If you are upgrading from a previous release of Spring, you should ensure
40
48
that you have fixed any deprecated calls that you were making to outdated APIs.
@@ -53,6 +61,7 @@ retained for the time being where Spring 3.2 had it; now just in deprecated form
53
61
54
62
55
63
=== Java 8 (as well as 6 and 7)
64
+
56
65
Spring Framework 4.0 provides support for several Java 8 features. You can make use of
57
66
__lambda expressions__ and __method references__ with Spring's callback interfaces. There
58
67
is first-class support for `java.time` (http://jcp.org/en/jsr/detail?id=310[JSR-310]),
@@ -65,9 +74,20 @@ Spring remains compatible with older versions of Java and the JDK: concretely, J
65
74
and above are still fully supported. However, for newly started development projects
66
75
based on Spring 4, we recommend the use of Java 7 or 8.
67
76
77
+ [NOTE]
78
+ ====
79
+ As of late 2017, JDK 6 is being phased out and therefore also Spring's JDK 6 support.
80
+ Oracle as well as IBM will terminate all commercial support efforts for JDK 6 in 2018.
81
+ While Spring will retain its JDK 6 runtime compatibility for the entire 4.3.x line,
82
+ we require an upgrade to JDK 7 or higher for any further support beyond this point:
83
+ in particular for JDK 6 specific bug fixes or other issues where an upgrade to JDK 7
84
+ addresses the problem.
85
+ ====
86
+
68
87
69
88
70
89
=== Java EE 6 and 7
90
+
71
91
Java EE version 6 or above is now considered the baseline for Spring Framework 4, with
72
92
the JPA 2.0 and Servlet 3.0 specifications being of particular relevance. In order to
73
93
remain compatible with Google App Engine and older application servers, it is possible
@@ -95,6 +115,7 @@ Spring Framework 4.0. The same applies to Hibernate Validator 5.0 as a Bean Vali
95
115
96
116
97
117
=== Groovy Bean Definition DSL
118
+
98
119
Beginning with Spring Framework 4.0, it is possible to define external bean configuration
99
120
using a Groovy DSL. This is similar in concept to using XML bean definitions but allows
100
121
for a more concise syntax. Using Groovy also allows you to easily embed bean definitions
@@ -129,6 +150,7 @@ For more information consult the `GroovyBeanDefinitionReader`
129
150
130
151
131
152
=== Core Container Improvements
153
+
132
154
There have been several general improvements to the core container:
133
155
134
156
* Spring now treats <<beans-generics-as-qualifiers,__generic types__ as a form of
@@ -156,6 +178,7 @@ There have been several general improvements to the core container:
156
178
157
179
158
180
=== General Web Improvements
181
+
159
182
Deployment to Servlet 2.5 servers remains an option, but Spring Framework 4.0 is now
160
183
focused primarily on Servlet 3.0+ environments. If you are using the
161
184
<<spring-mvc-test-framework,Spring MVC Test Framework>> you
@@ -175,6 +198,7 @@ have been made to Spring's Web modules:
175
198
176
199
177
200
=== WebSocket, SockJS, and STOMP Messaging
201
+
178
202
A new `spring-websocket` module provides comprehensive support for WebSocket-based,
179
203
two-way communication between client and server in web applications. It is compatible with
180
204
http://jcp.org/en/jsr/detail?id=356[JSR-356], the Java WebSocket API, and in addition
@@ -196,6 +220,7 @@ For further details, including a more thorough introduction, see the <<websocket
196
220
197
221
198
222
=== Testing Improvements
223
+
199
224
In addition to pruning of deprecated code within the `spring-test` module, Spring
200
225
Framework 4.0 introduces several new features for use in unit and integration testing.
201
226
@@ -230,7 +255,10 @@ Version 4.1 included a number of improvements, as described in the following sec
230
255
* <<v4_1-WebSocket-Messaging-Improvements>>
231
256
* <<v4_1-Testing-Improvements>>
232
257
258
+
259
+
233
260
=== JMS Improvements [[v4_1-JMS-Improvements]]
261
+
234
262
Spring 4.1 introduces a much simpler infrastructure <<jms-annotated,to register JMS
235
263
listener endpoints>> by annotating bean methods with
236
264
{api-spring-framework}/jms/annotation/JmsListener.html[`@JmsListener`].
@@ -260,6 +288,8 @@ Finally, Spring 4.1 provides additional miscellaneous improvements:
260
288
{api-spring-framework}/util/backoff/BackOff.html[`BackOff`] implementation
261
289
* JMS 2.0 shared consumers are supported
262
290
291
+
292
+
263
293
=== Caching Improvements [[v4_1-Caching-Improvements]]
264
294
265
295
Spring 4.1 supports <<cache-jsr-107,JCache (JSR-107) annotations>> using Spring's
@@ -280,6 +310,8 @@ Spring 4.1 also improves its own caching abstraction significantly:
280
310
Spring 4.1 also has a breaking change in the `Cache` interface as a new `putIfAbsent`
281
311
method has been added.
282
312
313
+
314
+
283
315
=== Web Improvements [[v4_1-Web-Improvements]]
284
316
285
317
* The existing support for resource handling based on the `ResourceHttpRequestHandler`
@@ -337,6 +369,8 @@ method has been added.
337
369
support (based on Groovy 2.3). See the `GroovyMarkupConfigurer` and respecitve
338
370
`ViewResolver` and `View' implementations.
339
371
372
+
373
+
340
374
=== WebSocket Messaging Improvements [[v4_1-WebSocket-Messaging-Improvements]]
341
375
342
376
* SockJS (Java) client-side support. See `SockJsClient` and classes in same package.
@@ -355,6 +389,8 @@ method has been added.
355
389
* Close STOMP/WebSocket connections that have no activity within 60 seconds after the
356
390
WebSocket session is established. See https://jira.spring.io/browse/SPR-11884[SPR-11884].
357
391
392
+
393
+
358
394
=== Testing Improvements [[v4_1-Testing-Improvements]]
359
395
360
396
* Groovy scripts can now be used to configure the `ApplicationContext` loaded for
@@ -403,6 +439,8 @@ Version 4.2 included a number of improvements, as described in the following sec
403
439
* <<v4_2-WebSocket-Messaging-Improvements>>
404
440
* <<v4_2-Testing-Improvements>>
405
441
442
+
443
+
406
444
=== Core Container Improvements [[v4_2-Core-Container-Improvements]]
407
445
408
446
* Annotations such as `@Bean` get detected and processed on Java 8 default methods as well,
@@ -507,6 +545,8 @@ public @interface MyTestConfig {
507
545
exposed through the `lang:std` element in XML. Supports e.g. JavaScript and JRuby.
508
546
(Note: JRubyScriptFactory and `lang:jruby` are deprecated now, in favor of using JSR-223.)
509
547
548
+
549
+
510
550
=== Data Access Improvements [[v4_2-Data-Access-Improvements]]
511
551
512
552
* `javax.transaction.Transactional` is now supported via AspectJ.
@@ -517,6 +557,8 @@ public @interface MyTestConfig {
517
557
`<jdbc:embedded-database>` supports a new `database-name` attribute.
518
558
See "Testing Improvements" below for further details.
519
559
560
+
561
+
520
562
=== JMS Improvements [[v4_2-JMS-Improvements]]
521
563
522
564
* The `autoStartup` attribute can be controlled via `JmsListenerContainerFactory`.
@@ -526,6 +568,8 @@ public @interface MyTestConfig {
526
568
* `@JmsListener` is now a repeatable annotation to declare several JMS containers on the same
527
569
method (use the newly introduced `@JmsListeners` if you're not using Java8 yet).
528
570
571
+
572
+
529
573
=== Web Improvements [[v4_2-Web-Improvements]]
530
574
531
575
* HTTP Streaming and Server-Sent Events support, see <<mvc-ann-async-http-streaming>>.
@@ -559,6 +603,8 @@ public @interface MyTestConfig {
559
603
* Introduced `ScriptTemplateView` as a JSR-223 based mechanism for scripted web views,
560
604
with a focus on JavaScript view templating on Nashorn (JDK 8).
561
605
606
+
607
+
562
608
=== WebSocket Messaging Improvements [[v4_2-WebSocket-Messaging-Improvements]]
563
609
564
610
* Expose presence information about connected users and subscriptions:
@@ -575,6 +621,8 @@ public @interface MyTestConfig {
575
621
`@MessageMapping` and `@SubscribeMapping` methods.
576
622
* `MarshallingMessageConverter` for XML payloads.
577
623
624
+
625
+
578
626
=== Testing Improvements [[v4_2-Testing-Improvements]]
579
627
580
628
* JUnit-based integration tests can now be executed with JUnit rules instead of the
@@ -650,6 +698,8 @@ Version 4.3 included a number of improvements, as described in the following sec
650
698
* <<v4_3-Testing-Improvements>>
651
699
* <<v4_3-Support-for-new-library-and-server-generations>>
652
700
701
+
702
+
653
703
=== Core Container Improvements [[v4_3-Core-Container-Improvements]]
654
704
655
705
* Core container exceptions provide richer metadata to evaluate programmatically.
@@ -670,11 +720,15 @@ Version 4.3 included a number of improvements, as described in the following sec
670
720
custom _composed annotations_ with attribute overrides.
671
721
* `@Scheduled` is properly supported on beans of any scope.
672
722
723
+
724
+
673
725
=== Data Access Improvements [[v4_3-Data-Access-Improvements]]
674
726
675
727
* `jdbc:initialize-database` and `jdbc:embedded-database` support a configurable
676
728
separator to be applied to each script.
677
729
730
+
731
+
678
732
=== Caching Improvements [[v4_3-Caching-Improvements]]
679
733
680
734
Spring 4.3 allows concurrent calls on a given key to be synchronized so that the
@@ -692,12 +746,16 @@ Spring 4.3 also improves the caching abstraction as follows:
692
746
* `@Cacheable`, `@CacheEvict`, `@CachePut`, and `@Caching` may now be used as
693
747
_meta-annotations_ to create custom _composed annotations_ with attribute overrides.
694
748
749
+
750
+
695
751
=== JMS Improvements [[v4_3-JMS-Improvements]]
696
752
697
753
* `@SendTo` can now be specified at the class level to share a common reply destination.
698
754
* `@JmsListener` and `@JmsListeners` may now be used as _meta-annotations_ to create
699
755
custom _composed annotations_ with attribute overrides.
700
756
757
+
758
+
701
759
=== Web Improvements [[v4_3-Web-Improvements]]
702
760
703
761
* Built-in support for <<mvc-ann-requestmapping-head-options,HTTP HEAD and HTTP OPTIONS>>.
@@ -721,10 +779,14 @@ Spring 4.3 also improves the caching abstraction as follows:
721
779
* `RestTemplate` and `AsyncRestTemplate` support strict URI variable encoding via `DefaultUriTemplateHandler`.
722
780
* `AsyncRestTemplate` supports request interception.
723
781
782
+
783
+
724
784
=== WebSocket Messaging Improvements [[v4_3-WebSocket-Messaging-Improvements]]
725
785
726
786
* `@SendTo` and `@SendToUser` can now be specified at class-level to share a common destination.
727
787
788
+
789
+
728
790
=== Testing Improvements [[v4_3-Testing-Improvements]]
729
791
730
792
* The JUnit support in the _Spring TestContext Framework_ now requires JUnit 4.12 or higher.
@@ -754,6 +816,8 @@ Spring 4.3 also improves the caching abstraction as follows:
754
816
whether the order of declaration for expectations should be ignored (see <<spring-mvc-test-client>>).
755
817
* Client-side REST Test supports expectations for form data in the request body.
756
818
819
+
820
+
757
821
=== Support for new library and server generations [[v4_3-Support-for-new-library-and-server-generations]]
758
822
759
823
* Hibernate ORM 5.2 (still supporting 4.2/4.3 and 5.0/5.1 as well, with 3.6 deprecated now)
0 commit comments