Spring framework articles

How does Spring Framework manage compatibility with different Java versions ?

Java 9 comes quietly to Java ecosystem and Spring Framework already successfully tested the build on early release on the new Java version. If we add to this the backward compatibility between Java 8, 7 and 6, we could ask us the question: How does it succeed that ?

Continue Reading β†’

Testing views with HtmlUnit in Spring

Testing view part of web applications in Spring isn't a simple task. But to simplify it, you can use libraries as HtmlUnit, a kind of command-line browser written in Java. And Spring Test MVC HtmlUnit allows to integrate this library inside Spring test cases and to write more complex test cases.

Continue Reading β†’

Asynchronous events in Spring

Synchronous events have one major drawback: they're natively executed in the calling thread. If the listener handling on of synchronous events takes 5 seconds to respond, the final user won't able to see the response within at least 5 seconds. However, one alternative solution is proposed to this problem - asynchronous events.

Continue Reading β†’

Asynchronous and scheduled tasks in Spring

Native Java offers a lot of possibilities to create thread pools, retrieve task results as Future instances. But Spring isn't worse and with its scheduling package allows to work with threads executed in background.

Continue Reading β†’

Custom namespace parser in Spring

In Spring we can configure dependencies in several ways: with XML files or directly in Java using annotations. This first way is usual considered as clearer and simpler to maintain. And if you're working with it, you certainly met some of Spring XML namespaces, as those one for Spring Security or Spring MVC projects. In this article we'll focus on this aspect of Spring.

Continue Reading β†’

Design patterns in Spring Framework - part 5

Through 4 previous articles, we saw that Spring adopts a big number of creational and structural design patterns. They're not so much behavioral ones and it's why we discover two of them in this article, the last one about design patterns used in Spring.

Continue Reading β†’

Design patterns in Spring Framework - part 4

This article is the 4th about design patterns used in Spring framework. It'll present new 3 patterns implemented in this framework.

Continue Reading β†’

Design patterns in Spring Framework - part 3

In two previous articles we saw some of design patterns implemented in Spring framework. This time we'll discover 3 new patterns used by this popular framework.

Continue Reading β†’

Design patterns in Spring Framework - part 2

The last time we talked about design patterns in Spring, we discovered 3 creational and 1 behavioral patterns. This time we'll focus more on structural and behavioral ones.

Continue Reading β†’

Design patterns in Spring Framework - part 1

Design patterns help to follow good practices of programming. Spring framework, as one of the most popular web frameworks, also uses some of them.

Continue Reading β†’

Properties placeholder in Spring Framework

Sometimes you will need to share properties values through multiple configuration files. They can, for example, have the same authentication information about database user, but, they can use different databases. In Spring we can resolve this problem with properties placeholders.

Continue Reading β†’

Events and listeners in Spring Framework

Events, and generally callback idea, are very popular in technologies associated to GUI (JavaScript, Swing). On the server side of web applications they're less popular. However it doesn't mean that we can't implement one event-oriented architecture on it. Above all when we're working with Spring.

Continue Reading β†’

Handling annotations with Spring AnnotationUtils

Annotations in Java let us, programmers, to transfer some of configuration from configuration files into Java classes. For example, in Spring, we can configure URL mapping directly inside the controllers thanks to @RequestMapping annotation. But it couldn't be possible without several utilitary classes, like AnnotationUtils, described here.

Continue Reading β†’

Bean post processors in Spring

We've already discovered the bean post processor factory in Spring. However, they left one similar concept to explain, bean post processors.

Continue Reading β†’

Bean factory post processors in Spring

Spring allows us to make a lot of operations with beans. We can decide if they should be unique instance on container (singleton) or not (prototype). We can also make some of operations "in the fly", thanks to bean factory post processors.

Continue Reading β†’

Singleton and prototype beans in Spring framework

Dependency injection in Spring facilitates development. You can simply put @Autowired annotation, followed by visibility tag and object, to can use every object managed by Spring context. But beware, all of these objects are a kind of Spring-managed singleton.

Continue Reading β†’

Context loader in Spring

Like we already know, application context is the container where Spring-managed beans live. But the question that we didn't ask, is how this context is created ? We'll reply to this question in this article.

Continue Reading β†’

Application context in Spring

Previously we've told that Spring beans were living in application context. In this article we'll develop this idea and present application context more in detail.

Continue Reading β†’

Spring integration testing for controllers

Previously we discovered the basics of integration testing in Spring. So now it's a great time to deepen this subject.

Continue Reading β†’

Introduction to integration tests in Spring Framework

Making the code testable is one of the crucial points of maintainable software. Without the tests, the code is exposed to surprising bugs on every change.

Continue Reading β†’