Serving Static Web Content with Spring Boot

Engineering | Roy Clarkson | December 19, 2013 | ...

We made a few announcements recently about the Spring getting started guides, including that the catalog of guides have been migrated to Asciidoctor. We also added several new client-side guides illustrating how to connect to Spring services from a variety of client technologies.

In this post I want to highlight an interesting capability of Spring Boot; within many of the client-side guides we utilized Spring Boot to stand up a Tomcat instance and serve static content. In these guides we are demonstrating JavaScript client code, not Java or Groovy! If you are already familiar with Boot, then…

This Week in Spring (Spring 4 Edition!) - December 17th, 2013

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

Welcome to another installment of This Week in Spring! This week, well, I'm taking some vacation :) That, of course, means that this week's roundup was even more fun for me - I got to play with the just-released Spring 4! And, to sweeten my vacation, the steady stream of new releases based on Spring 4.0 from the other Spring projects has already started!

If you're using Spring (Spring 4, Spring Boot, and anything else) and have some great new blog, video or sample project you think people should see, don't hesitate to share it with me on Twitter! Matt Raible has already made a helpful blog post: A Webapp Makeover with Spring 4 and Spring Boot where he upgrades his existing Spring 3.2.5, Spring Security 3.1.4 and Jersey 1.18 app to run Spring Framework 4 and Spring Boot.

  1. First, the BIG news! Spring CTO Adrian Colyer just announced that Spring 4 has gone GA! If you, like me, have been eagerly awaiting this all year, then don't wait a second longer! Grab those bits as soon as you can. Spring 4, of course, is the first major-version increment since Spring 3.0 back in 2009, and represents a major leap forward for application developers. Join Juergen Hoeller (and many other engineers) on January 9, 2014 for the launch webinar: Introduction to Spring Framework 4.0.
  2. Concurrent with the Spring 4 release, we've just added several new guides to the insanely popular Getting Started guides collection. Among the new guides, you'll find help on CORS, jQuery-, Sencha-, Angular.js-integration, and much more!
  3. Rob Winch followed very shortly after, announcing that Spring Security 3.2.0 RELEASE is available! Now, I'm going to finally update the code to my talk on using Spring's REST stack, along with Spring Security and Spring Security OAuth, to the new revision! Join Rob on January 16th, 2014 for a talk focused on the new release of Spring Security 3.2.
  4. Once Spring 4 was released, Spring Integration lead Gary Russell wasted no time in getting the long-awaited Spring Integration 3.0 out the door! This new release features many new improvements, which were mostly covered in the release candidate announcement.
  5. Projects lead Martin Lippert has just announced that Spring Tool Suite and Groovy/Grails Tool Suite 3.5.0.M1 are now available. This update revs to Groovy 2.2, Grails 2.3.4, and tc Server 2.9.4, and advanced content-assist for Spring Boot projects, improved dashboard feeds, and support for the new client-side getting started guides. This cut builds on Eclipse Kepler SR1. Check it out!
  6. Spring Data project lead Oliver Gierke has just announced the latest Spring Data release train, Spring Data Babbage SR2, has just been released. The service release bundles a bunch of important enhancements and bug fixes and is a recommended upgrade. You can find all issues fixed in this release in our JIRA
  7. Spring ninja Greg Turnquist put together a very nice look at the aforementioned Getting Started guides' migration to Asciidotor, behind the scenes.
  8. Spring ninja and Boot co-lead Phil Webb and I did a talk, Improving Your Java Configuration Muscle Memory, for SpringOne2GX 2013, which is now available as a replay on our YouTube channel. Check it out!
  9. Patrick Grimard's written a post introducing how to setup a Spring MVC interceptor to handle CORS requests. For more details on the subject of CORS, check out our Understanding CORS page, and then check out our new Getting Started guide which shows a Servlet Filter-centric alternative approach to basically do the same thing. This builds on Spring Boot, and uses a Filter instead of an interceptor, but the effect is the same.
  10. Our pal Bozhidar Bozhanov has written a great post all about web sockets, which of course work great with Spring 4!, complete with slides and codes! Be sure to check it out! This post uses a more low level approach to websockets, which Spring also supports, where all messages get funneled through one handler. Me personally, I like using the higher level STOMP support to avoid having to funnel all requests through the same handler, and then picking each request apart with a switch statement. Either way, this is a great post and - because it's lower level - gives you a better understanding of what's happening underneath the hood. Check it out!
  11. With a new release comes updated Maven artifacts. Last week, I mentioned that Spring 4 now features a very handy bill of materials Maven pom.xml. You should use that to simplify things. Additionally, if you're a BinTray user, be aware that the new release is already available there, as well.

Getting Started with Client-Side Development in Spring

Engineering | Craig Walls | December 17, 2013 | ...

Dear Spring Community,

At SpringOne, we launched a brand new Spring web site, including a collection of Getting Started Guides. These quick-hit guides are proving very popular as they get right to the point on how to use Spring to address several common tasks such as caching, messaging, and integration.

We are very pleased to announce the addition of several new Getting Started Guides that present Spring as providing services that back rich and mobile clients developed in Backbone, AngularJS, iOS, and other client-side frameworks and platforms. These guides include:

Spring's Getting Started Guides migrated to Asciidoctor

Engineering | Greg L. Turnquist | December 13, 2013 | ...

"If Markdown is a 1st-grader, then AsciiDoc is a PhD student."[sic] -- Dan Allen, project lead of AsciiDoctor

We recently migrated all of our Getting Started Guides to Asciidoctor. Why? Because Asciidoctor provides so many valuable features!

  • Several built in directives make it possible to pull in entire code files, small fragments of code, and external chunks of reusable content.
  • Rendering is now embedded into spring.io's website.
  • No need to "generate" the guide, which always puts you at risk of being out of sync with the code, the build files, and the document itself.
  • Lines up with how many of our projects are migrating away from DocBook towards AsciiDoctor to reduce maintenance.

This Week in Spring - December 10th , 2013

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

Welcome to another installation of This Week in Spring! This week I'm going to be in Los Angeles, talking to developers at Disney about Spring. If you're in the area, I'd love to see you all there, too. We're hosting a user-group meeting on December 11th. Here are some details on the event, which takes place tomorrow! I look forward to seeing you there!

Can you believe we're already staring down the end of the year? @_@

That means it's time for the annual release of Spring Framework, 4.0! We look forward to your feedback on the release.

Spring Framework

  1. Don't miss the Spring Framework 4.0 launch webinar, "Introduction to Spring Framework 4.0", with none other than Juergen Hoeller, on Jan 9th, 2014, first major Spring Framework release since 2009!
  2. Be sure to check out the webinar by busiest guy in code-business and Spring Security lead Rob Winch on Jan 16, 2014 to hear about Spring Security 3.2.
  3. Spring Framework committer and co-lead of Spring Boot Phil Webb introduces Spring 4's new support for Java generics in Spring 4.
  4. Thomas Darimont introduces what's new in Spring Data MongoDB 1.4 M1, including the phenomenal new projection framework and SpEL integration.
  5. If you're a user of the Spring-powered Broadleaf e-commerce engine, then you might want to register for the v3.1 web event.
  6. Our pal Tobias Flohre is back with yet another awesome post, Batch processing and the Java Enterprise Edition (JSR-352, JEE7, Spring Batch). The title speaks for itself - its a good quick overview of where the technologies sit.
  7. And, Petri Kainulainen is back at it again with an awesome followup to his series on adding social features to a Spring MVC Web Application with Spring Social. This post is on unit testing that integration.
  8. The @GoPivotal blog has an interesting case study of RabbitMQ's deployment at Norwegian Broadcast corporation.
  9. Speaking of Phil Webb and Rob Winch, one of the amazing things included in last week's announcement of Spring Framework RC2 was their wonderful addition of a "bill of materials" Maven POM: spring-framework-bom. Use it like this:

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-framework-bom</artifactId>
                <version>4.0.0.RC2</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
    

    Then, simply import the version of the Spring dependency that you want without specifying the version in your pom.xml.

  10. There's another case study on the GoPivotal blog, this on now Hulu scaled serving 4 billion videos using Redis. That's awesome!

  11. Sudhir Dharmadhikari put together an interesting post on using Spring Roo's aspect approach the AndroMDA project
  12. Bozhidar Bozhanov, who I loved getting to see again last week in Sofia, has moved the Spring Social Google+ code to GitHub.
  13. Last but not least, It's Pivotal day at Manning!  
    

    All Spring and Groovy books half price on special deal days, to celebrate the Spring Framework 4.0 launch, Pivotal is sponsoring Spring and Groovy day in Manning's Countdown to 2014! On certain deal days like Monday Dec 9,10; Thursday Dec 12, 13; Monday Dec 23, 24; and Thursday Dec 26, 27, you can get any of Manning's Spring and Groovy books for half off-eBook, pBook, or MEAP. Just go to Manning.com and choose any (or all) of these selected books. Enter gpivdotd13 in the Promotional Code box when you check out to get the discount. BONUS: If you register for Manning's Countdown to 2014, you'll have a chance to win one of two eBooks given…

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…

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 - 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

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!

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!

Get the Spring newsletter

Thank you for your interest. Someone will get back to you shortly.

Get ahead

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

Learn more

Get support

Tanzu Spring Runtime 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