Spring MVC Test with HtmlUnit

Engineering | Rob Winch | March 25, 2014 | ...

In my previous post I introduced Spring Test MVC HtmlUnit and explained the motivation behind the project. In this post I will describe how to use Spring MVC Test with HtmlUnit.

Updating Dependencies

Before you use the project, you must ensure to update your dependencies. Instructions for both Maven and Gradle can be found on the site documentation.

Using HtmlUnit

Now that we have the correct dependencies, we can use HtmlUnit in our unit tests. Our example assumes you already have JUnit as a dependency. If you have not added it, please update your classpath accordingly. The complete code sample for using HtmlUnit and Spring MVC Test can be found in MockMvcHtmlUnitCreateMessageTest

SpringOne2GX 2013 Replay: AOP-ing your JavaScript

News | Pieter Humphrey | March 25, 2014 | ...

Recorded at SpringOne2GX 2013 in Santa Clara, CA.

Speaker: Brian Cavalier

Loose coupling. Your web front-end has that, right? Your JavaScript is using pubsub, event emitters, and message buses! Guess again, you can do better. Aspect Oriented Programming (AOP) is a technique for augmenting the behavior of objects, methods, and functions non-invasively. AOP adds new behaviors and modifies existing behaviors "from the outside". Using AOP, it's possible to create connections between components without either having any knowledge of the other and without any extra library dependencies in your code. While you may be familiar with AOP in Spring, you may not yet have applied it in JavaScript. In this talk, we'll do just that. We'll introduce simple techniques for applying AOP in pure JavaScript using no additional libraries, and then look at meld.js (https://github.com/cujojs/meld), the AOP library that powers Cujo.js (http://cujojs.com). We'll work from simple examples of making connections between components to more sophisticated examples that integrate pubsub, message buses, etc. in a truly loosely coupled way.

!{iframe width="560" height="315" src="//www.youtube.com/embed/MoZgJY2IF4A" frameborder="0" allowfullscreen}{/iframe}

SpringOne2GX 2013 Replay: Tips and Tricks for Client Side Performance

News | Pieter Humphrey | March 25, 2014 | ...

Recorded at SpringOne2GX 2013 in Santa Clara, CA

Speaker: Jeremy Grelle

As the complexity of web and mobile apps increases, so does the importance of ensuring that your client-side resources load and execute in an optimal and efficient manner. Differences in resource loading techniques can have a dramatic impact on how fast an application feels to your users, and can be the catalyst for whether they have a joyful or frustrating experience. This talk will discuss performance techniques aimed at keeping your users on the joyful end of this user experience spectrum. We'll take a look at:

  • Pragmatic tools for measuring client-side performance
  • Techniques for optimizing resources and their resulting impact
  • Approaches to maximizing dev-time happiness and production performance
  • Easy incorporation of these techniques into your everyday tool-chain
!{iframe width="560" height="315" src="//www.youtube.com/embed/wrdNdp1Dyrc" frameborder="0" allowfullscreen}{/iframe}

Spring Boot 1.0.0.RC5 Available Now

Releases | Phil Webb | March 22, 2014 | ...

Spring Boot 1.0.0.RC5 has been released and is available in the repo.spring.io repository. This is mainly a bug fix release, although a couple of new features have been added:

  • A new @IntegrationTest annotation has been added to help when writing integration tests for Spring Boot.
  • The CRaSH shell now exposes an endpoint command that can be used to obtain actuator information.

We now also have a fairly comprehensive reference manual.

This is the last planned release candidate, so please give it a try and report any bugs. We plan to release GA very soon.

Java 8 in Enterprise Projects

News | Juergen Hoeller | March 20, 2014 | ...

With the GA release of Java 8 finally having arrived this week, let's all rejoice and celebrate - and then wake up and wonder how to introduce this to our everyday work environments...

This is easy enough to do for prototyping purposes: grab a JDK 8 download, IntelliJ IDEA or Eclipse's recently completed Java 8 support, and off you go. The challenging part comes a step later: You need to figure out how to deploy your app to a Java 8 enabled environment.

Of course, in practice, that consideration probably comes much earlier: Before you're willing or allowed to try Java 8, you need to have a…

Manning Publications: First class functions in Java 8

News | Pieter Humphrey | March 20, 2014 | ...

Java developers have heard a lot about functional-style programming - particularly with Java 8's addition of lambda expressions.

"First-class functions in Java 8" is a 12 minute video tutorial from Java 8 in Action: Lambdas, Streams, and functional-style programming by Raoul-Gabriel Urma, Mario Fusco and Alan Mycroft.

This video introduces method references and lambda expressions, the mechanisms Java 8 provides to pass a behavior as an argument to a method.

To save 38% on this or any other Manning books, just enter vturma01 in the Promotional Code box when you check out at manning.com.

!{iframe width="560" height="315" src="//www.youtube.com/embed/gDTzlfjMe98" frameborder="0" allowfullscreen}{/iframe}

While the term "lambda expression" may sound abstract and academic, Java 8 Lambdas can have a big impact on how you program every day. In simplest terms, a lambda expression is a function—a bit of code—that you can pass to another method as an argument. Thus, you can cope with changing requirements by using a behavior, represented by a lambda, as a parameter. Java 8's functional programming features, like lambdas and the new Stream API that enables a cleaner way to iterate through collections, can help you write concise, maintainable code that scales easily and performs well on multicore architectures. Java 8 in Action is a clearly-written guide to Java 8 lambdas and functional programming in Java. It begins with a practical introduction to the structure and benefits of lambda expressions in real-world Java code. The book then introduces the Stream API and shows how it can make collections-related code radically easier to understand and maintain. Along the way, you'll discover new FP-oriented design patterns with Java 8 for code reuse, code readability, exception handling, data manipulation, and concurrency. For developers also exploring other functional languages on the JVM, the book concludes with a quick survey of useful functional features in Scala and Clojure.

Introducing Spring Test MVC HtmlUnit

Engineering | Rob Winch | March 19, 2014 | ...

On Monday I announced the release of the first milestone of Spring Test MVC HtmlUnit with the promise of a blog series that would introduce it. This is the first of a four part blog series introducing Spring Test MVC HtmlUnit. The series outline can be seen below:

  • In this first post we will explore the motivation behind Spring Test MVC HtmlUnit.
  • The second post will demonstrate how we can integrate Spring MVC Test and HtmlUnit.
  • Our third post will demonstrate how we can integrate Spring MVC Test with WebDriver.
  • Finally, we will demonstrate how we can integrate Spring MVC Test with Geb.


This Week in Spring, Java 8 Edition - March 18th, 2014

Engineering | Josh Long | March 18, 2014 | ...

Welcome to another installment of This Week in Spring!

Today, Oracle released Java 8 and all its many wonderful features at EclipseCon. Java 8 is finally here! Be sure to grab your JDK today.

There are lots of fine features - like lambas - that enhance Spring application development. To learn more, be sure to check out Spring project lead Juergen Hoeller's webinar on the 25th of March on the subject of Spring 4 and Java 8. I'll be there!

As usual, we've got a lot to cover so let's get to it.

  1. InfoQ has posted a very nice article introducing Spring Boot today by Dan Woods. Dan does a very good job, I'd recommend it.

SpringOne2GX 2013 Replay: Reactor - a foundation for asynchronous applications on the JVM

News | Pieter Humphrey | March 18, 2014 | ...

Recorded at SpringOne2GX 2013 in Santa Clara, CA.

Speakers: Jon Brisbin, Stephane Maldini Reactor was recently made public after a two-year incubation, evolving slowly alongside frameworks like Storm, Akka, Play, GPars or Vert.x. Integrated with Grails starting with version 2.3, Reactor takes the best ideas from several asynchronous toolsets and synthesizes them into a coherent framework that supports a variety of runtime topologies and makes it easy for developers to efficiently leverage their cloud or traditional hardware assets. Reactor is equally at home inside or outside a Spring ApplicationContext and also provides first-class Groovy support in the form of DSLs and language extensions. Special attention has been given to make Reactor easy enough to use to create single-file node.js-like applications, while maintaining a solid asynchronous toolset that works with Big and Fast Data tools like Gemfire, Spring Integration, and Spring Batch. This talk will give Reactor a proper introduction and show sample code that demonstrates the event-driven and composition-based nature of Reactor applications.


Learn more about Spring Framework 4.0 http://projects.spring.io/spring-framework

Learn more about Spring Boot http://projects.spring.io/spring-boot

Learn more about using CloudFoundry at: http://cloudfoundry.org/

!{iframe width="560" height="315" src="//www.youtube.com/embed/XEkR6EaIZW4" frameborder="0" allowfullscreen}{/iframe}

SpringOne2GX 2013 Replay: Building Smart Clients with Spring

News | Pieter Humphrey | March 18, 2014 | ...

Recorded at SpringOne2GX 2013, in Santa Clara, CA

Speakers: Roy Clarkson and Josh Long

No application is an island and this is more obvious today than ever as applications extend their reach into people's pockets, desktops, tablets, TVs, Blu-ray players and cars. What's a modern developer to do to support these many platforms? In this talk, join Josh Long to learn how Spring can extend your reach through (sometimes Spring Security OAuth-secured) RESTful services exposed through Spring MVC, HTML5 and client-specific rendering thanks to Spring Mobile, and powerful, native support for Android with Spring Android.

Learn more about Mobile and Spring at: http://projects.spring.io/spring-framework (Spring MVC + Spring MVC's REST impl)






!{iframe width="560" height="315" src="//www.youtube.com/embed/pNlCO3s8bxM" frameborder="0" allowfullscreen}{/iframe}

Get the Spring newsletter

Thank you!

Get ahead

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

Learn more

Get support

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