Java articles

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 →

Authentication and authorization in Play Framework

If you remember well our previous article, we introduced the concept of forms and validation. To illustrate it, we used the register form case. Now, when user can register, he also should be able to login.

Continue Reading →

Forms rendering in Play Framework

Previous article presented forms and validation in Play Framework. But we didn't described how to display and format forms in the templates.

Continue Reading →

Handler execution chain in Spring Web

Spring's DispatcherServlet couldn't dispatch the requests without several elements. One of the most important of them is handler execution chain.

Continue Reading →

Future in Java

Concurrent programming isn't not only about executing several tasks in parallel threads. It's only about analyzing results of these process. In Java, we can analyze them thanks to the idea of futures.

Continue Reading →

Executor services in Java

Java 1.5 introduced a concept of executors, very useful for concurrent environments. Thanks to them we can easily create thread pools and even manipulate results generated by the threads. This article will cover this subject.

Continue Reading →

Tests in multi-threading environment with JUnit

Tests driven developpement (TDD) has a lot of advantages. We can simply rewrite a class and be sure that the application will still work after thanks to appropriated test cases. It's pretty simple to write them in single threading environment. But what to do when a test must be executed in multi-threading environment ?

Continue Reading →

CountDownLatch in Java

Java's version 1.5 introduced more of features to help to deal with multi-threading programs. One of these features is a class which allows a main thread to wait another threads before continue. The name of this class is CountDownLatch.

Continue Reading →

Locking in Hibernate JPA

Locking is very useful for the applications based on concurrency. Thanks to it, we can avoid the collision being a results from simultaneous updates to the same data by two or more different users.

Continue Reading →

Difference between SessionFactory and EntityManagerFactory

There are two ways to handle persistence in Hibernate: session and entity manager. Through this article, we'll see the differences between this two mechanisms.

Continue Reading →

Forms and validation in Play Framework

When user can't interact with the application, he loses the interest for it. It's why forms and other input methods are a useful to satisfy the final user demand. Play Framework also supports operations on forms, as generation from POJO or dynamic validation with annotations.

Continue Reading →

Sessions in Play Framework

In our's Play application, user can navigate on the site, add several products to his shopping cart and, at the end, terminate his shopping. As in all "classical" web applications, in Play this persistence is possible thanks to sessions.

Continue Reading →

Instruction try-with-resources

Java 7 was released on July 28, 2011. But they're still the places where we don't use all features of this version (because of installed 6 version or no budget to make the migration). One of these Java 7 elements which can improve code readability is, try-with-resources instruction.

Continue Reading →

Bean scopes in Spring

Spring beans, like the ones from JavaBeans, use the scopes. We've already seen two of them, singleton and prototype. It's the right time to discover 3 new scopes.

Continue Reading →

HTTP parameters and routes in Play Framework

E-commerce store with static URLs would kill even the most powerful server. It's why, to resolve dynamic behavior, we use HTTP parameters. GET ones are particularly useful.

Continue Reading →

Database and JPA in Play Framework

The next step in Play Framework discovery is the work with database data. Thanks to it, we can use centralized and dynamically managed data.

Continue Reading →