This document discusses new features and enhancements in Spring Framework 4, including first-class support for Java 8 language features like lambda expressions, first-class support for Groovy including Groovy-based bean definitions and AOP treatment for Groovy classes, and support for upcoming Java EE 7 specifications. It also discusses the state of Java 8 and challenges supporting it, as well as the potential for Groovy to serve as the primary programming language for Spring applications.
Presented at BJUG, 6/12/2012 by Roger Brinkley
This talk is on 55 new features in Java 7 you (probably) didn't hear about in an ignite format of one per minute. No stopping, no going back....Questions, sure but only if time remains (otherwise save for later).
This talk introduces some of the compelling features coming in Spring 3.1, 3.2 and then gazes into the future and looks at some of the powerful new features in the upcoming Spring 4.0 release.
Alternatives of JPA
Requery provide simple Object Mapping & Generate SQL to execute without reflection and session, so fast than JPA, simple and easy to learn.
Spring Data Requery is alternatives of Spring Data JPA
Requery is lightweight ORM for DBMS (MySQL, PostgreSQL, H2, SQLite, Oracle, SQL Server)
Spring Data Requery provide Query By Native Query, Query By Example and Query By Property like Spring Data JPA
Spring Data Requery is better performance than JPA
Presented at BJUG, 6/12/2012 by Roger Brinkley
This talk is on 55 new features in Java 7 you (probably) didn't hear about in an ignite format of one per minute. No stopping, no going back....Questions, sure but only if time remains (otherwise save for later).
This talk introduces some of the compelling features coming in Spring 3.1, 3.2 and then gazes into the future and looks at some of the powerful new features in the upcoming Spring 4.0 release.
Alternatives of JPA
Requery provide simple Object Mapping & Generate SQL to execute without reflection and session, so fast than JPA, simple and easy to learn.
Spring Data Requery is alternatives of Spring Data JPA
Requery is lightweight ORM for DBMS (MySQL, PostgreSQL, H2, SQLite, Oracle, SQL Server)
Spring Data Requery provide Query By Native Query, Query By Example and Query By Property like Spring Data JPA
Spring Data Requery is better performance than JPA
RxJava maakt het mogelijk om gemakkelijk schaalbare code op een reactive manier te schrijven. Het kan echter ook een uitdaging zijn om de code leesbaar te maken, en kunnen debuggen wat er gebeurt. Deze sessie beschrijft onze ervaringen met het inzetten van RxJava als basis-onderdeel in onze codebase: een suite educatieve applicaties voor basis-, voortgezet- en beroepsonderwijs, grootschalig ingezet in vijf landen. Ruim tien agile teams werken samen aan deze op micro-services gebaseerde suite. RxJava heeft ons belangrijke voordelen gebracht. De introductie van dit nieuwe framework gaf ons ook verschillende verwachte uitdagingen en een paar interessante verrassingen. Deze sessie gaat in op de lessons learned en valkuilen waar je rekening mee kunt houden als je start met RxJava. Onder andere de volgende onderwerpen worden besproken: introduceren RxJava in bestaande codebase, stappen om als team RxJava te leren, hoe je een aantal standaard workflows effectief in RxJava kunt programmeren, foutafhandeling en debugging. Daarnaast wordt besproken hoe je RxJava kunt combineren met Java EE en Spring, en wat de voordelen kunnen zijn van RxJava in een enterprise applicatie.
Slides accompanying a presentation on Dropwizard I gave at the DevIgnition conference ( www.devignition.com ) on April 29, 2016. The sample code is on GitHub at https://github.com/sleberknight/dropwizard-devignition-2016
Data Migrations in the App Engine DatastoreRyan Morlok
Data migration is a core problem when dealing with web frameworks. Rails and Django have their own built-in migration tools to help you manage data, but with Google Cloud Datastore, things are bit more manual. This presentation walks through several techniques and Python examples that leverage deferred tasks or map reduce to keep the data for your app consistent with the state of your code.
A short introduction (with many examples) to the Scala programming language and also an introduction to using the Play! Framework for modern, safe, efffcient and reactive web applications.
Asynchronous web apps with the Play Framework 2.0Oscar Renalias
Brief introduction to the asynchronous and reactive IO capabilities available in Play 2.0.
Source code of the demos available here: https://github.com/oscarrenalias/wjax-2012-play-async-apps
This is a basic tutorial on Spring core.
Best viewed when animations and transitions are supported, e.g., view in MS Powerpoint. So, please try to view it with animation else the main purpose of this presentation will be defeated.
Spring Framework 4.0 is the latest generation of the popular open source framework for Enterprise Java developers, focusing on the future with support for Java SE 8 and Java EE 7. In this presentation core Spring committer Sam Brannen will provide attendees an overview of the new enterprise features in the framework as well as new programming models made possible with the adoption of JDK 8 language features and APIs.
Specifically, this talk will cover support for lambda expressions and method references against Spring callback interfaces, JSR-310 Date-Time value types for Spring data binding and formatting, Spring's new @Conditional mechanism for activation of bean definitions, and a new WebSocket endpoint model. The presentation also provides an overview of Spring 4.0's updated support for enterprise APIs such as JMS 2.0, JPA 2.1, Bean Validation 1.1, Servlet 3.1, and JCache. Last but not least, Sam will highlight some of the major themes for the upcoming Spring Framework 4.1 release such as support for JCache 1.0 annotations, annotation-driven JMS listeners, and testing improvements.
Spring Framework 4.0 - The Next Generation - Soft-Shake 2013Sam Brannen
Spring Framework 4.0 is the next generation of the popular open source framework for Enterprise Java developers, focusing on the future with support for Java SE 8 and Java EE 7. In this presentation core Spring committer Sam Brannen will provide attendees an overview of the new enterprise features in the framework as well as new programming models made possible with the adoption of JDK 8 language features and APIs.
Specifically, this talk will cover support for lambda expressions and method references against Spring callback interfaces, JSR-310 Date-Time value types for Spring data binding and formatting, Spring's new @Conditional mechanism for activation of bean definitions, and a new WebSocket endpoint model. Regarding enterprise APIs, the presentation will cover Spring 4.0's new support for JMS 2.0, JPA 2.1, Bean Validation 1.1, Servlet 3.1, JCache, and JSR-236 concurrency. Last but not least, Sam will discuss improvements to Spring's testing support and point out which deprecated APIs have been pruned from the framework.
RxJava maakt het mogelijk om gemakkelijk schaalbare code op een reactive manier te schrijven. Het kan echter ook een uitdaging zijn om de code leesbaar te maken, en kunnen debuggen wat er gebeurt. Deze sessie beschrijft onze ervaringen met het inzetten van RxJava als basis-onderdeel in onze codebase: een suite educatieve applicaties voor basis-, voortgezet- en beroepsonderwijs, grootschalig ingezet in vijf landen. Ruim tien agile teams werken samen aan deze op micro-services gebaseerde suite. RxJava heeft ons belangrijke voordelen gebracht. De introductie van dit nieuwe framework gaf ons ook verschillende verwachte uitdagingen en een paar interessante verrassingen. Deze sessie gaat in op de lessons learned en valkuilen waar je rekening mee kunt houden als je start met RxJava. Onder andere de volgende onderwerpen worden besproken: introduceren RxJava in bestaande codebase, stappen om als team RxJava te leren, hoe je een aantal standaard workflows effectief in RxJava kunt programmeren, foutafhandeling en debugging. Daarnaast wordt besproken hoe je RxJava kunt combineren met Java EE en Spring, en wat de voordelen kunnen zijn van RxJava in een enterprise applicatie.
Slides accompanying a presentation on Dropwizard I gave at the DevIgnition conference ( www.devignition.com ) on April 29, 2016. The sample code is on GitHub at https://github.com/sleberknight/dropwizard-devignition-2016
Data Migrations in the App Engine DatastoreRyan Morlok
Data migration is a core problem when dealing with web frameworks. Rails and Django have their own built-in migration tools to help you manage data, but with Google Cloud Datastore, things are bit more manual. This presentation walks through several techniques and Python examples that leverage deferred tasks or map reduce to keep the data for your app consistent with the state of your code.
A short introduction (with many examples) to the Scala programming language and also an introduction to using the Play! Framework for modern, safe, efffcient and reactive web applications.
Asynchronous web apps with the Play Framework 2.0Oscar Renalias
Brief introduction to the asynchronous and reactive IO capabilities available in Play 2.0.
Source code of the demos available here: https://github.com/oscarrenalias/wjax-2012-play-async-apps
This is a basic tutorial on Spring core.
Best viewed when animations and transitions are supported, e.g., view in MS Powerpoint. So, please try to view it with animation else the main purpose of this presentation will be defeated.
Spring Framework 4.0 is the latest generation of the popular open source framework for Enterprise Java developers, focusing on the future with support for Java SE 8 and Java EE 7. In this presentation core Spring committer Sam Brannen will provide attendees an overview of the new enterprise features in the framework as well as new programming models made possible with the adoption of JDK 8 language features and APIs.
Specifically, this talk will cover support for lambda expressions and method references against Spring callback interfaces, JSR-310 Date-Time value types for Spring data binding and formatting, Spring's new @Conditional mechanism for activation of bean definitions, and a new WebSocket endpoint model. The presentation also provides an overview of Spring 4.0's updated support for enterprise APIs such as JMS 2.0, JPA 2.1, Bean Validation 1.1, Servlet 3.1, and JCache. Last but not least, Sam will highlight some of the major themes for the upcoming Spring Framework 4.1 release such as support for JCache 1.0 annotations, annotation-driven JMS listeners, and testing improvements.
Spring Framework 4.0 - The Next Generation - Soft-Shake 2013Sam Brannen
Spring Framework 4.0 is the next generation of the popular open source framework for Enterprise Java developers, focusing on the future with support for Java SE 8 and Java EE 7. In this presentation core Spring committer Sam Brannen will provide attendees an overview of the new enterprise features in the framework as well as new programming models made possible with the adoption of JDK 8 language features and APIs.
Specifically, this talk will cover support for lambda expressions and method references against Spring callback interfaces, JSR-310 Date-Time value types for Spring data binding and formatting, Spring's new @Conditional mechanism for activation of bean definitions, and a new WebSocket endpoint model. Regarding enterprise APIs, the presentation will cover Spring 4.0's new support for JMS 2.0, JPA 2.1, Bean Validation 1.1, Servlet 3.1, JCache, and JSR-236 concurrency. Last but not least, Sam will discuss improvements to Spring's testing support and point out which deprecated APIs have been pruned from the framework.
Sample code available at: https://github.com/alvarosanchez/grails-angular-springsecurity-gr8days-warsaw
Grails 3.1 enhances and improves the profile system introduced in Grails 3.0. One of the new profiles ease the creation and development of applications where the the front-end is an Angular JS application, and the backend is a Grails REST API.
In this session, Álvaro (member of the Grails team at OCI, Grails committer and author of several plugins) will demonstrate how to use the Angular profile to create an application using Grails 3.1, Angular JS and Spring Security REST.
Peter Doschkinow, langjähriger Java-Experte und Mitarbeiter bei Oracle, gab in seiner Präsentation einen Überblick über die interessantesten und spannendsten Neuerungen in der neusten Java Standard- und Enterprise Edition.
Spring Day | Spring 3.1 in a Nutshell | Sam BrannenJAX London
2011-10-31 | 11:45 AM - 12:30 PM
Spring 3.1 introduces several eagerly awaited features including bean definition profiles (a.k.a., environment-specific configuration), enhanced Java-based application and infrastructure configuration (a la XML namespaces), and a new cache abstraction. This session will provide attendees with a high-level overview of these major new features, plus a quick look at additional enhancements to the framework such as the new c: namespace for constructor arguments, support for Servlet 3.0, improvements to Spring MVC and REST, and Spring's new integration testing support for profiles and configuration classes.
Spring 3.1 to 3.2 in a Nutshell - Spring I/O 2012Sam Brannen
Spring 3.1 introduced several eagerly awaited features including bean definition profiles (a.k.a., environment-specific configuration), enhanced Java-based application and infrastructure configuration (a la XML namespaces), and a new cache abstraction. This session will provide attendees a high-level overview of these major new features plus a quick look at additional enhancements to the framework such as the new c: namespace for constructor arguments, support for Servlet 3.0, improvements to Spring MVC and REST, and Spring's new integration testing support for profiles and configuration classes. In addition, this talk will introduce new features under development in the Spring 3.2 roadmap.
Spring Framework 4.1 is the latest release of the popular open source application framework for Java developers with continued innovation for Java SE 8 and enterprise Java. In this presentation core Spring committer Sam Brannen will provide attendees an overview of the new enterprise features in the framework as well as new programming models and testing features.
Specifically, this talk will cover support for annotation-driven JMS listeners, JMS 2.0's shared subscriptions, JCache (JSR-107) annotations, a compiler mode for the Spring Expression Language (SpEL), flexible resolution and transformation of static web resources, and Web MVC support for Groovy markup templates.
The presentation also provides an overview of Spring 4.1's refinements in other areas, for example: Java 8's Optional type for injection points, declarative MVC view resolution, Jackson's JsonView, WebSocket scope, SockJS client support, declarative SQL scripts and programmatic transactions in the TestContext framework, integration testing with Groovy scripts, and more.
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)Red Hat Developers
JBoss EAP7 brings support for the most recent industry standards and technologies, including Java EE7, the latest edition of the premier enterprise development standard. This session will provide an overview of the major additions to Java EE7, and how your team can use these capabilities on the advanced EAP7 runtime to produce better applications with less code.
Mumbai Academics is Mumbai’s first dedicated Professional Training Center for Training with Spoke and hub model with Multiple verticles . The strong foundation of Mumbai Academics is laid by highly skilled and trained Professionals, carrying mission to provide industry level input to the freshers and highly skilled and trained Software Professionals/other professional to IT companies.
Speaker: Jacob Aae Mikkelsen
Once you have successfully developped your application in Grails, Ratpack or your other favorite framework, you would like to see it deployed as fast and painless as possible, right?
This talk will cover some of the supporting cast members of a succesful modern infrastructure, that developers can understand and use efficiently, and with good DevOps practices.
Key elements are
Docker
Infrastructure as Code
Container Orchestration
The demo-goods will hopefully be on our side, as this talk includes quite some live demos!
Creating and testing REST contracts with Accurest Gradle GR8Conf
REST does not come with an in-built contract compliance mechanism, which in many ways is a great thing. However, while working with microservice-based systems, it often appears that a practical mechanism that would provide help in shaping and describing REST contracts would come in handy. Similarly, creating integration and acceptance tests in such systems presents many challenges.
In this talk, I will present Accurest, a Gradle plugin that allows for both: easily shaping REST contracts and verifying if our app adheres to them using automatically generated Spock tests. I will show how, using Accurest, we can quickly generate automatically-tested stubs from simple Groovy DSL scripts. I will talk about the typical usages and script examples, as well as possible problems and ways of handling them.
Mum, I want to be a Groovy full-stack developerGR8Conf
How many times have you ever heard the term "Full-Stack developer"? In most of the cases it means that you have to be fluent with a backend language, html, javascript, maybe Android or iOS... What if I told you that you can be a Full-Stack developer using only Groovy?
In this talk I'll present the technological stack of Polaromatic, the application with I won the Learning Spring Boot contest, and you'll learn that it's possible to write the whole stack with Groovy: Backend, Javascript, HTML, Android, test, build tool,... Isn't that amazing?
Groovy is a dynamic language that provides different types of metaprogramming techniques. In this talk we’ll mainly see runtime metaprogramming. You’ll understand the Groovy Meta-Object-Protocol (MOP), the metaclass, how to intercept method calls, how to deal with method missing and property missing, the use of mixins, traits and categories. All of these topics will be explained with examples in order to understand them.
Also, you’ll see a little bit about compile-time metaprogramming with AST Transformations. AST Transformations provide a wonderful way of manipulating code at compile time via modifications of the Abstract Syntax Tree. You’ll see a basic but powerful example of what we can do with AST transformations.
Geb is a wonderful tool for testing your Html pages. However, scraping is an unexplored use case where Geb can shine too.
In this talk I will show you different scraping examples powered by Geb, after which you will be able to use Geb beyond functional testing
How to create a conference android app with Groovy and AndroidGR8Conf
In this talk Sergio del Amo will show you how to:
Create conference websites with Wordpress custom post types and custom fields
Use a Groovy Android library to consume your Wordpress’s generated JSON API
Develop a simple Android App with Groovy which shows the conference data.
After this talk you will be able to jump into development for Android with Groovy and consume easily custom Wordpress backends
So you've built your neato Ratpack microservices, but it's already 5 o`clock and you're still fighting your way through testing, deployment and interaction instead of having your usual at the bar; What a PITA! In this talk I'll show you how to harness the power of Gradle and Docker to ease you through service orchestration and make it to the bar on time for happy hour!
"Clean Code" by Bob Martin is probably one of the most important practical documents out there; A must read for all developers, if you will. In this talk I will show how you can use Groovy and its rich ecosystem to apply the discussed principals, thus cleaning and vastly improving your codebase while still maintaining your sanity and joy.
By Noam Tenne
Cut your Grails application to pieces - build feature pluginsGR8Conf
Reuse has been taught in CS classes since the very beginning. But how should you practically do to reuse functionality from one Grails application in other applications? The plugin subsystem in Grails is an awesome machinery that makes it easy to separate functionality into distinct plugins. Plugins that can be used in many applications with similar functionality. Yet have unique features without creating a maintenance hell.
In this session you will learn how to think "feature plugins" when you're designing and developing your Grails applications. We will cover topics like inter-plugin communication using application events and how to support different look and feel for each application using "theme plugins". You will also learn how each plugin can be tested and documented separately from the application.
After this session "grails create-plugin" will be your best friend.
Grails has great performance characteristics but as with all full stack frameworks, attention must be paid to optimize performance. In this talk Lari will discuss common missteps that can easily be avoided and share tips and tricks which help profile and tune Grails applications.
One of the goals of Grails 3 is to reach out of the servlet container. Grails 3 has a concept of application profiles for choosing a certain set of core plugins to use. In this talk Lari will present how Ratpack fits in Grails 3. He will also talk about how Grails 3 supports micro service architectures.
Grails & DevOps: continuous integration and delivery in the cloudGR8Conf
Nowadays, companies require very short release cycles, especially in lean startup environments.
But to release often:
deployments should be routine, not terrifying.
configuration should require a few clicks, not a thousand-line shell script.
problems should be easy to spot, not buried in a log file.
You are a developer that need to release every week or every day with a single git commit and zero-downtime? Easily spot release performance or bugs issues? If required, roll back to previous version in few seconds and one click? And you don't want to manage any dedicated repository, monitoring, build, staging, production servers? So this talk is for you!
We will explore Lean startup and DevOps concepts and share our experience on how to create a simple and fully automated build pipeline for Grails apps with a live demo, based on SaaS/cloud services: GitHub, Travis CI, NewRelic, AWS (ElasticBeanstalk, CloudFront), etc.
Functional testing your Grails app with GEBGR8Conf
GEB (pronounced 'jeb') is a browser automation solution.
It brings together the power of WebDriver, the elegance of jQuery content selection, the robustness of Page Object modelling and the expressiveness of the Groovy language.
We'll cover what it takes to test your grails application with GEB and discuss successful strategies and drawbacks about the tool.
Deploying, Scaling, and Running Grails on AWS and VPCGR8Conf
This talk will cover how to get your application running on AWS VPC and related services. We will go over some related services and their current state like RDS, autoscaling, s3, cloudfront, s3fs, ebs, elastic beanstalk, etc and how your Grails application can benefit from using these. The networking can also be confusing with your application so we'll cover the basics here as well. I will share lots of random nuggets of information that I have learned the hard and and recommended practices of configuration of your VPC as well.
Grails is a complete web application framework that runs on the Java JVM. It is a full-stack framework, and handles all layers from the user interface to the persistence layer. Grails is based on known and proven technologies, such as the Spring Framework and Hibernate. It has been around since 2006, and has made considerable progress around the globe in the past few years.
This workshop aims to show how to get from 0 to running application with Grails in three hours - so hold on to your hats! We will touch the following points:
Grails application structure
Domain model and persistence
Controllers
Services
Testing
User Interface
Going beyond the basics of how to use Spock this talk will discuss writing expressive, readable & maintainable specifications using the features of Spock and the Groovy language itself. Concrete examples backed up with live coding will cover a range of topics such as how to structure assertions, effective use of the where: block, appropriate use of mocks and stubs, and driving specifications from a database. The focus will always remain on creating tests that are readable, robust and helpful when you need to deal with regressions.
Groovy is a well established player in the JVM since a few years ago. It's increased popularity across the years has spawned several projects that conform the Groovy Ecosystem. You've probably heard of Grails, Gradle, Griffon and Spock. But what about the rest of projects that are just waiting around the corner to be discovered and make your life easier? This talk presents them tools and libraries that use Groovy as the main driving force to get the job done.
Groovy 3 and the new Groovy Meta Object Protocol in examplesGR8Conf
Groovy3 and the new MOP are closing in! But the time of this talk the new MOP will not be done, but I will show some examples of how old Groovy code will look like transferred to the new MOP.
Apache Camel is versatile integration library that supports a huge number of components, enterprise integration patterns, and programming languages.
In this this talk I first introduce you to Apache Camel and its concepts. Then we move on to see how you can use the Groovy programming language with Camel as a first class Groovy DSL to build integration flows.
You will also learn how to build a new Camel and Groovy app from scratch from a live demo.
And we also touch how you can use Camel from grails using the grails-camel plugin.
I will also show the web console tools that give you insight into your running Apache Camel applications, including visual route diagrams with tracing, debugging, and profiling capabilities.
This session will be taught with a 50/50 mix of slides and live demos, and it will conclude with Q&A time.
CRaSH the shell for the Java Virtual MachineGR8Conf
CRaSH is the open source shell for the JVM. The shell can be accessed by various ways, remotely using network protocols such as SSH, locally by attaching a shell to a running virtual machine or via a web interface. Commands are written Groovy and can be developed live making the extensibility of the shell easy with quick development cycles. Since the version 1.3, the REPL also speaks the Groovy language, allowing Groovy combination of command using pipes.
CRaSH comes with commands such as thread management, log management, database access and JMX. The session will begin with an introduction to the shell. The main part of the session will focus on showing CRaSH commands development with few examples, showing how easy and powerful the development is.
The audience will learn how to use CRaSH for their own needs: it can be a simple usage or more advanced like developing a command or embedding the shell in their own runtime like a web application or a Grails application.
2. 22www.springsource.org
Review: Spring 3 Component Model Themes
Powerful annotated component model
• stereotypes, configuration classes, composable annotations
Spring Expression Language
• and its use in value injection
Comprehensive REST support
• and other Spring @MVC additions
Support for async MVC processing
• Spring MVC interacting with Servlet 3.0 async callbacks
Declarative validation and formatting
• integration with JSR-303 Bean Validation
Declarative scheduling
• trigger abstraction, cron support
Declarative caching
3. 33www.springsource.org
A Typical Annotated Component
@Service
public class MyBookAdminService implements BookAdminService {
@Inject
public MyBookAdminService(AccountRepository ar) {
…
}
@Transactional
public BookUpdate updateBook(Addendum addendum) {
…
}
}
4. 44www.springsource.org
Configuration Classes
@Configuration
public class MyBookAdminConfig {
@Bean
public BookAdminService myBookAdminService() {
MyBookAdminService service = new MyBookAdminService();
service.setDataSource(bookAdminDataSource());
return service;
}
@Bean
public DataSource bookAdminDataSource() {
…
}
}
5. 55www.springsource.org
Next Stop: Spring Framework 4.0
First-class support for Java 8 language and API features
• lambda expressions
• JSR-310 Date and Time
• java.util.concurrency updates
First-class support for Groovy (in particular: Groovy 2)
• Groovy-based bean definitions (a.k.a. Grails Bean Builder)
• AOP treatment for Groovy classes
A WebSocket endpoint model along the lines of Spring MVC
• deploying Spring-defined endpoint beans to a WebSocket runtime
• using JSR-356 compliant runtimes or alternative engines
6. 66www.springsource.org
Spring 4.0: Upcoming Enterprise Specs
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
JSR-236 Concurrency Utilities
• EE-compliant TaskScheduler backend with trigger support
JSR-107 JCache
• standard CacheManager backend, standard caching annotations
7. 77www.springsource.org
Spring and Common Java SE Generations
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
Spring 3.1/3.2: explicit Java 7 support
• JDK 5 – JDK 7
Spring 4.0 introducing explicit Java 8 support now
• JDK 6 – JDK 8
8. 88www.springsource.org
Spring and Common Java EE Generations
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
Spring 3.1/3.2: strong Servlet 3.0 focus
• J2EE 1.4 (deprecated) – Java EE 6
Spring 4.0 introducing explicit Java EE 7 support now
• Java EE 5 (with JPA 2.0 feature pack) – Java EE 7
9. 99www.springsource.org
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 (!)
IDE support for Java 8 language features
• IntelliJ: available since IDEA 12, released in December 2012
• Eclipse: announced for June 2014 (!)
• Spring Tool Suite: trying to get some Eclipse-based support earlier
Spring Framework 4.0 scheduled for GA in October 2013
• with best-effort Java 8 support on OpenJDK 8 Developer Preview
10. 1010www.springsource.org
JSR-310 Date-Time
Specialized date and time value types in java.time package
• replacing java.util.Date/Calendar, along the lines of the Joda-Time project
• Spring 4.0: annotation-driven date formatting
public class Customer {
// @DateTimeFormat(iso=ISO.DATE)
private LocalDate birthDate;
@DateTimeFormat(pattern="M/d/yy h:mm")
private LocalDateTime lastContact;
}
11. 1111www.springsource.org
Lambda Conventions
Many common Spring APIs are candidates for lambdas
• through naturally following the lambda interface conventions
• formerly "single abstract method" types, now "functional interfaces"
JdbcTemplate
• ResultSetExtractor, RowCallbackHandler, RowMapper
JmsTemplate
• MessageCreator, MessagePostProcessor, BrowserCallback
TaskExecutor
• Runnable, Callable
12. 1212www.springsource.org
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)));
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));
});
Java 8 Lambdas with Spring's JdbcTemplate
13. 1313www.springsource.org
public List<Person> getPersonList(String department) {
JdbcTemplate jt = new JdbcTemplate(this.dataSource);
return jt.query(
"SELECT name, age FROM person WHERE dep = ?",
ps -> {
ps.setString(1, "test");
},
this::mapPerson;
}
private Person mapPerson(ResultSet rs, int rowNum)
throws SQLException {
return new Person(rs.getString(1), rs.getInt(2));
}
Java 8 Method References with Spring's JdbcTemplate
14. 1414www.springsource.org
Groovy Closures versus Lambdas
Java 8 lambdas are quite restricted in their applicability
• always coerced into a specific target expression
• primarily a replacement for anonymous inner classes
At the same time, lambdas are syntactically attractive
• concise (at least for Java terms)
• identifying overloaded methods through parameter name clause
Groovy closures are a quite different beast
• a powerful first-class language and API construct
• mandatory "as“ clause for type coercion
15. 1515www.springsource.org
Spring 4 and Groovy Closures
Groovy closures to be equally attractive for Spring's callback APIs
• i.e. equally applicable to Java 8's functional interface conventions
• providing use cases for Groovy language enhancements
Groovy 2.2: no "as“ clause necessary for unique type scenarios
• like with Java 8 lambdas, infer type from target context
• "as“ clause just to be used for overloaded methods
Groovy 3.0: researching lambda/closure interoperability
• support for dedicated lambda syntax in Groovy?
• applying lambda expressions to Groovy Closure arguments?
16. 1616www.springsource.org
Groovy-based Bean Definitions
Essentially, Grails Bean Builder turning into a Spring feature
• revised bean builder API but same configuration format
• with Grails 3.0 building on it
beans {
dataSource(BasicDataSource) {
driverClassName = "org.h2.Driver"
url = "jdbc:h2:mem:grailsDB"
username = "sa"
password = ""
}
}
17. 1717www.springsource.org
AOP Treatment for Groovy Classes
Exclusion of internal Groovy interfaces from AOP proxying
• special detection of GroovyObject methods
• done in Grails already
• now in Spring's core AOP framework
Applying aspects through Groovy AST transformations
• e.g. @Transactional processing
• Spring has separate "proxy" and "aspectj" modes already
• researching what a corresponding "groovy" mode could look like
• only makes sense for 100% Groovy-based application classes
18. 1818www.springsource.org
Groovy as Language of Choice for Spring Apps
The idea is simple:
• implementing a traditional Spring-style application architecture
• but with 100% Groovy instead of Java
Spring's programming and configuration style with Groovy
• with the entire set of traditional Spring guidelines applying
• just replace an app's Java source files with Groovy source files
Groovy 2's static compilation mode might be a good fit
• using @CompileStatic or @TypeChecked for semantics closer to Java
• potentially attractive to first-time Groovy adopters
19. 1919www.springsource.org
Spring Framework 4.0 M1 & M2
4.0 M1 (May 2013)
• general pruning and dependency upgrades (JDK 6+, JPA 2.0+, etc)
• initial Java 8 support based on OpenJDK 8 build 88
• JMS 2.0, JTA 1.2, JPA 2.1, Bean Validation 1.1, JSR-236 Concurrency
• initial WebSocket endpoint model
4.0 M2 (July 2013)
• enhanced use of attributes on stereotype annotations
• generic type support for injection points
• Groovy-based bean definitions
• AOP treatment for Groovy classes