Today we are officially kicking off a new initiative called Spring XD whose theme is “tackling Big Data complexity”1.
The Spring Data team has been incredibly busy over the past few years, not only providing support for NoSQL datastores but also simplifying the development experience with Hadoop. With the creation of the Spring for Apache Hadoop project, we made it easier to get started developing Hadoop applications by providing a rich configuration model and a consistent programming model across Hadoop ecosystem projects such as Hive and Pig. As Spring users would expect, one can:
Welcome back to another installment of This Week in Spring! Here in San Francisco, we're experiencing the first fits of life and beautiful weather typical of spring time. Fitting, too, as things are busy-as-can-be in the Pivotal open source communities - including Cloud Foundry and SpringSource - as we march towards the Pivotal Initiative launch on April 24th. See you then!
Without further ado, let's get into this week's roundup:
Have you guys seen the amazing Java configuration support in Spring Batch 2.2.0.RC1? The code I've just linked you to demonstrates a complete working Spring Batch job that reads in a .csv file and then writes the records to a data source, all of which are configured in the class, entirely in Java. This demonstrates the @EnableBatchProcessing annotation in 2.2.0. Check it out!
Spring HATEOAS lead Oliver Gierke tweeted a link to this post, "How I Explained REST to my wife", which would seem at first to be just one person's attempt at explaining a fairly deep technology concept to a person who didn't have the same technical background, but quickly turns into a (I think really insightful) look at the applicability of REST. Check out Spring HATEOAS if you want to take your REST-fu to the next level.
I'm personally enamored of the new Java configuration APIs, both those recently released and those currently available in preview releases. I showed a very simple example of the Spring Batch API above. I also took a moment last week to write about the powerful Spring Social Java configuration API soon to be available in the 1.1.0.M2 release.
You can have Spring perform a sort of pre-condition check by using the @Required annotation to insist at runtime that a property be satisfied with a non-null value, or Spring will abort the construction of the object. This helps avoid any silent NullPointerExceptions. This JavaBeat post does a nice job explaining how to use @Required.
Spring, of course, has an amazing REST stack and I highly encourage people to check out how to build consolidated, streamlined REST services with Spring! Moving on... :)
James Rossiter has a good post on how to use a Spring InitBinder to Resolve Type Mismatch and bind Exceptions in POST from Spring MVC to Controller Actions.
@olivergierke brings up a great point on Twitter: how much code does it take to add the JTA 1.2 JSR javax.transaction.Transactional annotation to Spring? Almost nothing! Most of the code here is just unit tests. Otherwise, this is just a dead simple mapping of the JTA annotation to Spring’s already supported engine, which also currently supports the native Spring @Transactional and @javax.ejb.TransactionAttribute annotation.
Welcome to another installment of This Week in Spring! As usual, we’ve got a lot to cover, so let’s get to it!
<A href="https://twitter.com/adriancolyer">SpringSource CTO Adrian Colyer</a> outlines the direction and momentum of SpringSource and the Spring projects under the
<A href="http://gopivotal.com">Pivotal Initiative</a>, a new company spun out of EMC comprised of - among other things - SpringSource, Cloud Foundry, and GreenPlum.
This is <EM>definitely</EM> worth a read if you want to understand Spring's - <EM>ahem</EM> - <EM>Pivotal</EM> role in this new initiative!
<LI> Spring Batch lead Michael Minella has <A href="http://www.springsource.org/node/9666"> announced that Spring Batch 2.2.0.RC1 is now available</a>.
The new release includes preliminary support for Spring Data, Java configuration support, non-identifying job parameters
and numerous fixes and polishes. This release is amazing, and definitely worth a look. I, personally, <EM>love</EM> the Java configuration API that's
been surfaced. You don't need to write another Spring Batch XML file if you don't want to!
Spring Mobile lead Roy Clarkson has announced that Spring Mobile 1.1.0.M3 has been released featuring simpler configuration when using a custom domain strategy with SiteSwitcherHandlerInterceptor, support for Kindle Fire device detection (as tablet or mobile depending on which mode they are in), several resolved issues and compatibility with Spring Framework 3.2.2.
<LI>New SpringOne2GX replays now available in HD on YouTube: <a href="http://www.springsource.org/node/10268">Virtualizing and Tuning Large Scale Java Applications, From Spring and Java to Spring and Akka</a></LI>
<LI>The HMK blog has a <EM>really</EM> nice post on how to use the <A href= "http://github.com/CujoJS">Cujo.js</A>'s
<CODE>rest.js</CODE> and Spring MVC</a>. <EM>Very</EM> cool!
The <EM>JavaRevisited</EM> blog has put together a
<a href="http://javarevisited.blogspot.com/2013/04/spring-framework-tutorial-call-stored-procedures-from-java.html">post on calling stored procedures from Spring</code> using the <CODE>StoredProcedure</CODE> template object.
There are other ways to approach this same problem, including the <CODE>SimpleJdbcCall</CODE> object and simply using the
<CODE>update(String, Object ... params) </CODE> method on <CODE>JdbcTemplate</CODE>. Check it out!
The Spring Java Tutorial bloghas a nice post on using stored procedures with Spring, and it also uses the same domain example - an EmployeeDAO. They aren’t exacty the same - far from it - but it does seem like one heckuva coincadence! At any rate, more information’s always good.
Spring provides various lifecycle callback methods, <A href="http://www.javabeat.net/2013/04/custom-spring-callback-methods/">which this <EM>JavaBeat</EM> blog looks at</a>. </LI>
The <EM>Binary Beans</EM> blog has a post that <A href="http://www.binary-beans.com/2013/04/getting-started-with-spring-framework.html"> simply links to some interesting, introductory videos</a> that we've published on
<A href="http://youtube.com/SpringSourceDev">the SpringSourceDev YouTube Channel</A>. If you're a regular reader of this round up then you've seen these videos before.
But, it's a good 3 hours of introductory content and worth a look if you want a good getting started experience.
KH Yiu has put together a cool post <A href="http://kh-yiu.blogspot.com/2013/04/spring-implementing-factory-pattern.html"> introducing the concept of a factory pattern</a> (which you're no doubt already familiar with!)
in application code, built with Spring. This is <EM>not</EM> about how Spring uses the factory pattern, and was kind of an interesting approach.
<LI> Daniel Wong put together a really cool blog illustrating how to <A href="http://blog.shinetech.com/2013/04/09/integrating-springmvc-with-opencms/">tie together Spring MVC with OpenCMS</a>! Definitely worth a look. </LI>
The <EM> 11th Hour</EM> blog put together a nice post on <a href="http://deepeshdarshan.wordpress.com/2013/04/05/learn-spring-by-example-spring-expression-language-spel">how to use the Spring Expression Language with some examples</a>.
Wang Xiang's put together a blog.. more like a series of snippets.. demonstrating how <A href="http://wangxiangblog.blogspot.com/2013/04/eclipse-jetty-maven-setup.html">to setup Jetty, a <CODE>DataSource</CODE>, and Spring together</a>.
The <EM>Java Code Geeks</EM> blog has an introductory post <A href="http://www.javacodegeeks.com/2013/04/spring-mvc-form-validation-with-annotations-2.html">on using Spring MVC with JSR 303 bean validation</A>. Check it out!
The awesomely named <EM>Raging Goblin</EM> blog has a nice post on how to do <A href="http://raginggoblin.wordpress.com/2013/04/06/spring-roo-5-role-based-views/">role-based views using Spring Roo and Spring Security</a>.
Peter Chng describes a scheme that can be used to <A href="http://unitstep.net/blog/2013/04/07/spring-mvc-request-parameter-conversion-with-minimal-configuration/"> auto-register custom converters used for data type conversion</A> in core Spring, Spring MVC, and Spring Integration, among other places. Pretty smart!
Virtualizing and Tuning Large Scale Java Applications
This session shares many of the production proven methods of running Java on vSphere. Covering how to size JVMs, and VMs for large scale deployments. The session will have a special section on GC tuning and show how a wide range of JVMs can be tuned using a GC recipe developed over the past 15 years of actual field experience in tuning JVMs.
Three key trends and associated tuning techniques are discussed in this session. The key trends are: Consolidation, Elasticity and Flexibility, and Performance
Consolidation Many of our customers find that their middleware deployments have proliferated and are becoming an administrative challenge associated with higher costs. We see a trend across customers who look to virtualization as a way of reducing the number of server instances. At the same time, customers are taking the consolidation opportunity to rationalize the number of middleware components needed to service a particular load. Middleware components most commonly run within a Java Virtual Machine (JVM) with an observed scale of 100 to 1000s of JVM instances and provide many opportunities for JVM instance consolidation. Hence, middleware virtualization provides an opportunity to consolidate twice once to consolidate server instances, and, secondly, to consolidate JVM instances. This trend is far-reaching, because every IT shop on the planet is considering the cost savings of consolidation. One customer in the hospitality sector went through the process of consolidating their server footprint and at the same time consolidated many smaller JVMs that were less than 1GB heap. They consolidated many of these smaller 1GB JVMs into 2 categories, those that were 4GB, and others that were 6GB. They performed the consolidation in such manner that the net total amount of RAM available to the application was equal to the original amount of RAM, but with fewer JVM instances. They did all of this while improving performance and maintaining good SLAs. They also reduced the cost of administration considerably due to the reduced number of JVM instances they had to manage, and refined environment that helped easily achieve SLA.
Another customer, in the insurance industry, was able to achieve the same as the above customer, but additionally was able to over-commit CPU in development and QA environments in order to save on third party software license costs. On the other hand, sometimes we come across customers that have a legitimate business requirement to maintain one JVM for an application, and/or one JVM per a line of business. In these cases, you cannot really consolidate the JVM instances, as that would cause intermixing of the lifecycle of one application from one line of business with another. However, while such customers don’t benefit from eliminating additional JVM instances through JVM consolidation, they do benefit from more fully utilizing the available compute resource on the server hardware, that otherwise would have been underutilized in a non virtualized environment
Elasticity and Flexibility It is increasingly common to find applications with seasonal demands. For example, many of our customers run various marketing campaigns that drive seasonal traffic towards their application. With VMware, you can handle this kind of traffic burst, by automatically provisioning new virtual machines and middleware components when needed, and then automatically tear down these VMs when the load subsides. In addition, the ability to change updating/patching hardware without causing outage is paramount for middleware that supports the cloud era scale and uptime. VMware VMotion gives you the ability to move VMs around without needing to stop applicators and or the VM. This flexibility alone makes virtualization of middleware worthwhile when managing large-scale middleware deployments. One customer in the financial space, handling millions of transactions per day, used VMotion quite often to schedule their hardware upgrades without any time downtime. What otherwise would be a costly scheduled downtime to their business.
Performance Customers often report improved middleware platform performance when virtualizing. Performance improvements are partly due to the updated hardware that customers will typically refresh during a virtualization project. There is also some performance improvement due to the robust VMware hypervisor. A recent customer that reported a great level of performance provided the following testimony
“With our OrderExpress project we upgraded our Middleware Services, Commerce, Portal, WCM, Service Layer, DB2 Database; migrated from AIX to Linux; virtualized on VMware; moved the application into a three-tier DMZ; increased our transactions by over 150 percent; and added significant new capabilities that greatly improved the customer experience. Changing such a wide range of technology components at once was a huge challenge. However using VMware vSphere and additional architectural changes we were successful in improving performance by over 300 percent; lowered costs in the millions; improved security, availability, and scalability; and how we plan to continue evolving this application to maintain greater than 30 percent yearly growth.”
Jeff Battisti, Senior Enterprise Architect at Cardinal Health
In this session, I will show some actual JVM and VM sizes for middleware components both small and large JVMs. Will also detail out GC tuning recipe that I have developed over the years,that has been shown to handle JVM heap sizes form 4GB to 88GB+, and higher. Of course the introduction of in-memory databases has driven the trend to have these larger JVMs and hence why we will discuss what is the best way to tune the JVM, VM, and the hardware platform they are deployed on.
I see the sizing question as the most commonly asked question with our customer base,and as a result I plan to focus on it during the session.
Spring Mobile provides extensions to Spring MVC that aid in the development of cross-platform mobile web applications.
This release adds simpler configuration when using a custom domain strategy with SiteSwitcherHandlerInterceptor. Kindle Fire devices are now detected as tablet or mobile depending on which mode they are in. Additionally, several issues have been resolved in this release. This release is built and tested against Spring Framework 3.2.2. See the changelog and reference manual for more information. Many thanks to the community for their continued feedback and support in improving Spring Mobile.
By now you’ve probably heard about Pivotal. I’d like to take a moment here to explain what this means for Spring, and to tell you about some of our plans for 2013.
In case you missed it, here’s the essential background on Pivotal: Led by Paul Maritz, the initiative unites key people and projects from across EMC and VMware to bring “consumer grade” technology to the enterprise. We see a new generation of applications emerging that are powered by new data fabrics and will interact with and serve customers in the context of who they are, where they are, and what they are doing in the moment. These applications will be built, deployed, and scaled at unprecedented pace. They will store, manage, and deliver value from large data sets, and do all of this on one unified platform underpinned by open source technologies.