Entries

Spring MVC @PathVariable Tips

@PathVariable annotation is one of the Spring MVC features that allows creating RESTful Web application much easier. It indicates that a handler method parameter should be bound to a URI template. In this post I will present two useful tips for working with this annotation.

HOW-TO: Custom error pages in Tomcat with Spring MVC

Default Tomcat error pages look scary. In addition, they may expose valuable information including server version and exception stack trace. Servlet specification provides a way to configure an exceptional behavior through web.xml. One can configure either reaction on a specific Java exception or to a selected Http response code(s).

HOW-TO: Improve content assist for types with static members while creating JUnit tests in Eclipse

Usually while creating JUnit tests we statically import org.junit.Assert , org.hamcrest.Matchers , org.mockito.Mockito , org.mockito.Matchers when we want to use static members of these types. To make that Eclipse proposes members of mentioned types (or any other) without explicit static import we need to define the list in Eclipse's content assist configuration

HOW-TO: Method-level validation in Spring with @Validated annotation

@Validated is a Spring’s specific variant of JSR-303’s javax.validation.Valid, supporting the specification of validation groups. @Validated can be used with Spring MVC handler methods arguments as well as with method level validation. In this article, you will learn how to use @Validated annotation with method level validation in Spring.

Spring MVC 3.1 Quickstart Maven Archetype

Spring 3.1 brings many enhancements to its MVC framework. Many times I need to start some basic project to consult new things on the project for the presentation, blog post or just for myself. In order to make the creation of each project repeatable and easy process I decided to create Maven archetype for that puropose. Currently it is a snapshot version that support basic Spring MVC 3.1 project with JPA2.0 and Apache Tiles. See more details on the spring-mvc-quickstart-archetype project page how to get started with it . If you have any suggestions or you would like to join this project, please let me know.