Slides from the Spring Framework 4.0 webinar as delivered on January 23rd, 2014. This deck covers the state of the Spring Framework 4.0.1 release, scheduled for release a few days later.
public class MyBookAdminService implements BookAdminService { @Autowired @Qualifier("production") public MyBookAdminService(AccountRepository repo) { ... } } @Bean @Qualifier("production") public AccountRepository myAccountRepository() { return new MyAccountRepositoryImpl(); }
method=GET) public Book findBook(@PathVariable long id) { return this.bookAdminService.findBook(id); } @RequestMapping("/books/new") public void newBook(Book book) { this.bookAdminService.storeBook(book); } }
architectures • embedded web servers and non-traditional datastores • lightweight messaging and WebSocket-style architectures • custom asynchronous processing with convenient APIs ▪ A new baseline • Java SE 6+ (minimum API level: JDK 6 update 18, ~ early 2010) • Java EE 6+ (Servlet 3.0 focused, Servlet 2.5 compatible at runtime) • all deprecated packages removed • many deprecated methods removed as well
for Java 8 language and API features • lambda expressions • method references • JSR-310 Date and Time • repeatable annotations • parameter name discovery ▪ Full runtime compatibility with JDK 8 • for Spring apps built against JDK 6/7 but running against JDK 8 • when moving existing apps to a JDK 8 based deployment platform
jt.query("SELECT name, age FROM person WHERE dep = ?", ps -> ps.setString(1, "Sales"), (rs, rowNum) -> new Person(rs.getString(1), rs.getInt(2))); 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)); });
bean definitions • a more flexible and more dynamic variant of bean definition profiles (as known from Spring 3.1) • can e.g. be used for smart defaulting • see Spring Boot (projects.spring.io/spring-boot) ▪ @Conditional with programmatic Condition implementations • can react to rich context (existing bean definitions etc) • profile support now simply a ProfileCondition impl class • enabling new deployment styles
points • requesting a lazy-initialization proxy individually per injection point ▪ Ordered injection of arrays and lists • sorting injected beans by Ordered / @Order ▪ Target-class proxies for classes with arbitrary constructors • creating CGLIB proxies using Objenesis, not invoking any constructor ▪ Composable annotations in the test context framework • e.g. @ContextConfiguration, @WebAppConfiguration, @ActiveProfiles ▪ Time zone management with dedicated Spring MVC support • through LocaleContextResolver and TimeZoneAwareLocaleContext
core message and channel abstractions • endpoints using generic messaging patterns ▪ WebSocket endpoint model along the lines of Spring MVC • JSR-356 and native server support, with SockJS fallback option • STOMP for higher-level messaging on top of raw WebSocket ▪ AsyncRestTemplate • based on ListenableFuture return values
(WebSocket on Tomcat 7.0.47+ and 8.0) ▪ Jetty 7.5+ (WebSocket on Jetty 9.0 and 9.1) ▪ JBoss 6.1+ (WebSocket on WildFly 8.0) ▪ GlassFish 3.1+ (WebSocket on GlassFish 4.0) ▪ WebLogic 10.3.4+ (with JPA 2.0 patch applied) ▪ WebSphere 7.0.0.9+ (with JPA 2.0 feature pack) ▪ We generally support library versions <=3 years back • Spring Framework 4.0: minimum versions ~ early 2011 • e.g. Hibernate 3.6+, EhCache 2.1+, Quartz 1.8+, Jackson 1.8+
does not support the 1.8 bytecode level • However, it does support running JDK 6/7 based apps on JDK 8 ▪ We strongly recommend an early upgrade to Spring 4 • Spring Framework 3.2 is in maintenance mode already • See github.com/spring-projects/spring-framework/wiki/ Migrating-from-earlier-versions-of-the-Spring-Framework ▪ Spring Framework 4.0 GA released in December 2013 ▪ Spring Framework 4.0.1 to be released on Monday (January 27th) ▪ Spring Framework 4.0.2 scheduled for late March 2014
handling • resource pipelining, cache control refinements ▪ Caching support revisited • alignment with JCache 1.0 final, user-requested enhancements ▪ JMS support overhaul • alignment with messaging module, annotation-driven endpoints ▪ Performance improvements • application startup, SpEL expression evaluation ▪ Spring Framework 4.1 RC1 in June 2014 ▪ Spring Framework 4.1 GA in August 2014
Check out Spring Boot: projects.spring.io/spring-boot ▪ Upcoming releases: Spring Framework 4.0.1 on Jan 27 Spring Framework 4.0.2 on Mar 25 Twitter: twitter.com/springcentral YouTube: spring.io/video LinkedIn: spring.io/linkedin Google Plus: spring.io/gplus