Spring @MatrixVariable

In this tutorial I will show you how to use @MatrixVariable annotation in Spring Web MVC (Model View Controller) application. The URI has the possibility of including name-value pairs within path segments. The general “URI path parameters” could be applied although the more unique “Matrix URIs”, originating from an old post by Tim Berners-Lee, is also frequently used and fairly…

Spring Web MVC @PathVariable with Regular Expressions

This tutorial will show you how we use @PathVariable annotation with Regular Expressions in Spring Web MVC. Sometimes you need more precision in defining URI template variables. The @RequestMapping and @GetMapping annotations support the use of regular expressions in URI template variables. The syntax is {varName:regex} where the first part defines the variable name and the second – the regular…

Spring Boot Web MVC @PathVariable

Path Variable This tutorial will show you how to use @PathVariable annotation in Spring MVC. The @PathVariable annotation is used on a method argument to bind it to the value of a URI template variable. You can also make this path variable optional in the URI. Path variable can appear in any path segment of the URI.

Spring Web MVC

This tutorial will show you how we configure Spring MVC, maven and Tomcat 7. For this tutorial we will create maven based web project in Eclipse. If you already have an idea on how to create a maven project in Eclipse will be great otherwise I will tell you here how to create a maven project in Eclipse.

Spring NamedParameterJdbcTemplate And Collections.singletonMap Example

NamedParameterJdbcTemplate and Collections.singletonMap In this post I will show you how to use NamedParameterJdbcTemplate and Collections.singletonMap to execute query for returning result. The NamedParameterJdbcTemplate class adds support for programming JDBC statements using named parameters, as opposed to programming JDBC statements using only classic placeholder (?) arguments. The NamedParameterJdbcTemplate class wraps a JdbcTemplate, and delegates to the wrapped JdbcTemplate to do…

Spring NamedParameterJdbcTemplate And BeanPropertySqlParameterSource Example

BeanPropertySqlParameterSource In this post I will show you how to use NamedParameterJdbcTemplate and BeanPropertySqlParameterSource to execute query. The NamedParameterJdbcTemplate class adds support for programming JDBC statements using named parameters, as opposed to programming JDBC statements using only classic placeholder (?) arguments. The NamedParameterJdbcTemplate class wraps a JdbcTemplate, and delegates to the wrapped JdbcTemplate to do much of its work. An…

Spring NamedParameterJdbcTemplate and MapSqlParameterSource Example

Introduction In this post I will show you how to use NamedParameterJdbcTemplate and MapSqlParameterSource to execute query for inserting or retrieving results from database table. The NamedParameterJdbcTemplate class adds support for programming JDBC statements using named parameters, as opposed to programming JDBC statements using only classic placeholder (?) arguments. An SqlParameterSource is a source of named parameter values to a…

Get Auto-generated Id in Spring JDBC using SimpleJdbcInsert

Auro-generated Id In this post I will show you how to get auto generated id of a newly inserted row in table. Spring provides an easy way to get this auto-generated key using executeAndReturnKey() method of SimpleJdbcInsert which is supported Spring JDBC 3 onwards. For most of the records I will use auto generated Id value on database side to…

Auto-generated Id In Spring JDBC Using PreparedStatement

Generated Id In this post I will show you how to get auto generated id of a newly inserted row in table. Spring provides an easy way to get this auto-generated key using KeyHolder which is supported Spring JDBC 3 onward. I am going to use PreparedStatement to get the auto generated id value. For most of the records, I…

EhCache Implementation Using Spring Boot Framework

EhCache In this tutorial I am going to explain you how to use EhCache in application with Spring Boot framework. Caching mechanism improves application’s performance by loading the repeated data from the cache instead of fetching it from persistent storage, thus reducing the network round trips. The terms “buffer” and “cache” tend to be used interchangeably; note however they represent…