What's new in Spring Data MongoDB 1.4 M1

Engineering | Thomas Darimont | December 04, 2013 | ...

As the first milestone of the Spring Data release train Codd has now cooled down a little bit, I'd like to highlight some of the new features shipped with the MongoDB module.

SpEL support for projections in aggregation framework

Sometimes it can be pretty complicated to define arithmetic expressions within MongoDB aggregation framework projections.

Assume a part of an aggregation for an order is the gross price of it, effectively calculated using the following formula: (netPrice * discountRate + fixedCharge) * taxRate. With a discount rate of 0.8, a fixed charge of 1.2 and a tax rate of 1.19, the according DBObject to encode this formula with the MongoDB aggregation…

This Week in Spring - December 3rd, 2013

Engineering | Josh Long | December 03, 2013 | ...

Welcome to another installment of This Week in Spring! This week I'm in Sofia, Bulgaria, talking to the great folks at the amazing Java2Days conference. This is my 5th year here and it's been an amazing show every time!

  1. Spring Integration 3.0 RC1 is now available! The new release features many nice, new features including a file-tailing inbound adapter, a JMX inbound adapter, redis queues, and much more.
  2. Don't miss Matt Stine as he discusses Spring with Immutability on Dec 10th!
  3. The replay of my webinar from last week, Have You Seen Spring Lately?, is now available online! The talk is a sort of introduction to the Spring IO platform, introducing many of the awesome technology released since the Spring team became part of Pivotal. It also introduces some new tech inside of Spring 4, as well as some oldies-but-goodies like Spring Social and Spring Batch, which continue to grow.
  4. Ben Hale's epic talk from SpringOne2GX 2013 which introduces REST API Design is now available online.
  5. Looking to get started quickly with Spring and application development? Check out this webinar replay of the SpringOne2GX 2013 talk introducing Spring Boot!
  6. InfoQ has a great post on how to use Spring Boot in conjunction with the Aerospike database
  7. Want to integrate a custom single-sign on authentication provider using Spring Security? This Stack Overflow discussion on integrating a custom single sign-on provider is very helpful! (I got this from the always-useful @SpringTip Twitter account)
  8. Xavier Padró's put together a nice post on how Spring Integration error handling works.
  9. Sergi Almar (@SergiAlmar) has put together a really great presentation on using Spring 4's websocket support. Definitely check it out!
  10. Also from @SpringTip, a great Stack Overflow post on how to filter database records using Spring Data REST and Spring MVC
  11. Nicolas Frankel is back at it again, this time with a nice post on using Spring Data SOLR

Spring Framework 4.0 and Java Generics

Engineering | Phil Webb | December 03, 2013 | ...

With the recent RC2 release of Spring Framework 4.0; and GA due before the year's end, here is a little teaser of some of the changes that should improve your life if you work with Java generic types.

Spring has had pretty good Java generics support for a while. For example, with version 3.2 you can easily inject all beans of a specific type into a generic List just by using the @Autowired annotation:

@Autowired
private List<MyType> beans; 
// all beans that extends MyType will be injected

Spring's conversion service, binding system and Web MVC framework are all 'generic aware' and there are also the handy GenericCollectionTypeResolver and GenericTypeResolver

This Week in Spring - November 26th, 2013

Engineering | Josh Long | November 27, 2013 | ...

Welcome to another installment of This Week in Spring! This week I'm in Gothenburg, Sweden talking to developers at the JDays 2013 conference about Spring. What a great crowd and a great reception. It's been a blast, but I'm headed home soon to scarf down some turkey with friends and family! If you celebrate the US Thanksgiving holiday, let us be the first to wish you a very happy holiday!

  1. Spring Batch lead Michael Minella has announced that Spring Batch 2.2.3 is now available!

Processing Big Data with Hadoop and Pivotal HD

Engineering | Mark Baars | November 19, 2013 | ...

For 2014 Pivotal is launching a new training around Apache Hadoop and Pivotal HD. Pivotal HD Enterprise offers the capabilities of Apache Hadoop in a fully supported, enterprise-ready distribution. This new comprehensive training will provide competent Java Developers with the skills necessary to exploit the extended Capabilities of Pivotal HD, “The world’s most powerful Apache Hadoop distribution”. The training commences with a grounding in the relevant core technologies:

  • Big/Fast data, NoSQL, and their role in modern Business applications
  • Background on Hadoop and the significance of the Pivotal HD distribution
  • Introduction to GemFire and SQLFire, distributed cache technologies

This Week in Spring - November 19th, 2013

Engineering | Josh Long | November 19, 2013 | ...

Welcome to another edition of This Week in Spring! As usual, we've got a lot to cover, so let's get to it!

I want to encourage everyone to join me on the 21st (this Thursday!) for my webinar, Have You Seen Spring Lately?. If you haven't been paying very deep attention to everything that's happening in the wide world of Spring since we became part of the Pivotal adventure, this is the one to watch! And even if you have, I'll bet you'll learn about something new and exciting, anyway. :) C'ya there!

  1. We published an article - Have You Seen Spring Lately? - to accompany the webinar today on the Pivotal blog.
  2. Mark Baars has just announced that we've just added Big Data with Hadoop and Pivotal HD to our training. Awesome!
  3. Spring Data ninja Thomas Risberg has just announced that the 1.0.2.GA release of Spring for Apache Hadoop is now available!
  4. Spring XD ninja Gunnar Hillert has just announced that Spring XD 1.0.0.M4 has just been released. The new release is packed with a lot of new things, so definitely check this release out!
  5. Spring Data lead Oliver Gierke and Spring Data Couchbase lead Michael Nitschinger have just announced the availability of milestone two for the Spring Data Couchbase module! Michael also followed up with an initial, but promising, pull request for Spring Boot support for Spring Data Couchbase, too! :)
  6. Excited about the recent Reactor 1.0 release and want to learn more? Check out the upcoming webinar featuring Reactor lead Jon Brisbin on December 3, 2013! I'll be there, eagerly listening, and I hope to see you there, too.
  7. Spring and Cloud Foundry ninja Matt Stine's doing a webinar on December 10th called Spring with Immutability that will introduce how Spring can help with item #15 in Josh Bloch's canonincal Effective Java book: minimize mutability.
  8. The replay for the SpringOne2GX2013 session from New Relic: Troubleshooting Live Java Web Applications is now available online.
  9. Spring Data GemFire 1.3.3 has been released!. Don't quite have a release note for it, yet, though.
  10. Check out this demo of Pivotal CF - the turnkey Cloud Foundry in a box for on-premises deployment - in action.
  11. Using Redis? We love Redis! We found this great post from a few years ago with various uses cases readily solved with Redis. Enjoy!
  12. Pinterest just launched their first web API. There's nothing Spring-related about this mention, yet, but I'm just throwing this out there because I'm taking bets on how soon we'll see someone in the community create a Spring Social Pinterest binding! :)
  13. Friendly reminder: you can get a lot of cool Spring / Pivotal stuff from Homebrew to flesh out your Java stack:

    $ brew tap pivotal/tap; $ brew install springboot springxd rest-shell maven groovy redis rabbitmq tomcat

  14. I really enjoyed this sort of look behind the curtain with Spring team engineer Greg Turnquist.
  15. The Spring Exchange, put on by our friends at Skills Matter, took place in in London recently. There were many great talks, and most (all?) of it has been recorded and put online! Enjoy!

This Week in Spring - November 12, 2013

Engineering | Josh Long | November 12, 2013 | ...

Welcome to another installment of This Week in Spring! This week, I'm in Antwerp, Belgium talking to Spring, RabbitMQ, Tomcat, Redis, and Cloud Foundry users at Devoxx Belgium. We at Pivotal have a booth and are showing Spring Boot and giving away t-shirts. Be sure to stop by and say hi!

  1. Spring Boot 0.5.M6 is now available! The new release is full of amazing new features and you can use it from gvm and Homebrew, too.
  2. The Reactor project 1.0 has just been released! Project lead Jon Brisbin has done an amazing job with the new release and the blog is full of win, so be sure to check it out.

This Week in Spring - November 5, 2013

Engineering | Josh Long | November 05, 2013 | ...

Welcome to another installment of This Week in Spring! I'm in Malmo, Sweden at the fantastic Øredev conference, talking to developers about Spring, Cloud Foundry, and more! I'll be at JMaghreb next week and then at Devoxx 2013 where I'll be talking to developers about Spring, Cloud Foundry, RabbitMQ and more along with my pals Dr. Dave Syer, Alvaro Videla, and Andy Piper. Looking forward to seeing you at any of these places! Ping me on Twitter (@starbuxman) if you want to talk Spring, the cloud, big data and anyting else!

With that, we've got a lot of really great stuff this week so let's get to it!

  1. First, the big news: Spring Framework 4.0 RC1 has been released! The new release includes full compatability with OpenJDK 8 developer previews, Groovy configured beans, improvements to Spring MVC, smarter proxies, time zone resolution (connected to JSR 310 and Joda-Time), Spring HATEOAS-inspired link-building, improved websocket support, and a lot more! Get the bits, test your apps, and be sure to let us know how you like it!
  2. Spring Security lead Rob Winch is at it again, this time with a Spring Security 3.2.0 RC2 release which includes resolutions for 80+ issues, and a slew of upates - some breaking, so to be sure to update and verify everything.
  3. Additionally, Rob's just released Spring LDAP 2.0.0.M1, which adds a lot of new functionality including Spring Data repository and QueryDSL support, a fluent LDAP query builder, a custom XML namespace for LDAP, Java 5 featues, and some restructuring
  4. P.S.: If you happen to be in the London area or with easy access to it, check out the Spring eXchange: a packed two-day show on Nov 14/15, with key Spring engineers presenting the latest and greatest - of course including Spring Framework 4.0!
  5. I gave a talk at JavaOne called the Spring Update that looks at a lot of the cool new things coming out of the Spring division at Pivotal. The talk is now online at Parleys.com so check it out!
  6. Paul Chapman's put together a very good post explaining error handling strategies in Spring MVC
  7. Daniel Lipp and Tobias Mattsson, from Magnolia, did a nice webinar introducing how to integrate the Magnolia CMS with Spring and Grails based applications. Cool stuff!
  8. Greg Turnquist continues the narrative on Spring Boot and talks about how to add property support to a custom Spring Boot module.
  9. Blogger Hébert Oliveira has put together an epic post on using Spring MVC, Spring Data, Spring Security, Bootstrap, and Angular.js together. Definitely worth a look!
  10. I'm excited to see Thymeleaf 2.1 support for automatic Spring Security CSRF integration. Nice job!
  11. Spring's documentation is now moving to Asciidoc! This is interesting mostly because it'll be easier to update and maintain the documentation now, and you can expect even better docs as a result!
  12. Spring Boot tip thanks to Dr. Dave Syer: any bean of type TomcatConnectorCustomizer in a Spring Boot application will give you a callback reference to the Connector which you can then use to customize the embedded Tomcat instance. One possible application of this is applying SSL to the embedded Tomcat instance.
  13. Speaking of Spring Boot, check out this Spring Boot Java app, a "full-featured" reference app that runs on @CloudFoundry that's designed to monitor builds. Nice job, Ben Hale!

Exception Handling in Spring MVC

Engineering | Paul Chapman | November 01, 2013 | ...

NOTE: Revised April 2018

Spring MVC provides several complimentary approaches to exception handling but, when teaching Spring MVC, I often find that my students are confused or not comfortable with them.

Today I'm going to show you the various options available. Our goal is to not handle exceptions explicitly in Controller methods where possible. They are a cross-cutting concern better handled separately in dedicated code.

There are three options: per exception, per controller or globally.

A demonstration application that shows the points discussed here can be found at http://github.com/paulc4/mvc-exceptions. See Sample Application

Empowering your apps with Spring Boot's property support

Engineering | Greg L. Turnquist | October 30, 2013 | ...

Spring Boot is continuing to gather steam. Last month I wrote Contributing to Spring Boot with a pull request. I peeled back the layers of Spring Boot to demonstrate it's incredible autoconfiguration features and CLI support.

In this post, I want to dig into Spring Boot's amazing support for properties. Properties are something that are small, not highly visible, yet can quickly strengthen your application in very practical ways. In this post, I'll walk through how I added property support to the Spring JMS support I coded in the previous blog post.

What are properties?

Properties are…

Get the Spring newsletter

Stay connected with the Spring newsletter

Subscribe

Get ahead

VMware offers training and certification to turbo-charge your progress.

Learn more

Get support

Tanzu Spring offers support and binaries for OpenJDK™, Spring, and Apache Tomcat® in one simple subscription.

Learn more

Upcoming events

Check out all the upcoming events in the Spring community.

View all