Spring Boot MVC with Tiles and AJAX

In my previous tutorials I have shown how to create a Spring Boot MVC application, here I will show you how to create an AJAX based Spring Boot MVC application with Tiles. What is Tiles (https://tiles.apache.org/) A free open-sourced templating framework for modern Java applications. Based upon the Composite pattern Continue Reading…

Spring MVC and JDBC CRUD Example

This tutorial shows an example on how MVC(Model, View, Controller) works in Spring 4.x. In this tutorial you will also find how JDBC works with Spring MVC. We will also see how annotation like @Autowired works in Spring. You will also see how datasource is configured in Spring. This example Continue Reading…

Spring NamedParameterJdbcTemplate and Collections.singletonMap Example

In this post I will show you how to use NamedParameterJdbcTemplate and Collections.singletonMap 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 Continue Reading…

Spring NamedParameterJdbcTemplate and BeanPropertySqlParameterSource Example

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 Continue Reading…

Spring NamedParameterJdbcTemplate and MapSqlParameterSource Example

In this post I will show you how to use NamedParameterJdbcTemplate and MapSqlParameterSource 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 Continue Reading…

Get auto-generated id in Spring JDBC using SimpleJdbcInsert

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 this tutorial we will create a standalone Continue Reading…

Get auto-generated id in Spring JDBC using PreparedStatement

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 onwards. For this tutorial we will create a standalone maven project in Continue Reading…

Spring @PostConstruct and @PreDestroy Example

This tutorial will show you how we can use @PostConstruct and @PreDestroy in Spring. @PostConstruct and @PreDestroy annotations are generally considered best practice for receiving lifecycle callbacks in a modern Spring application. Using these annotations means that our beans are not coupled to Spring specific interfaces. For more information please Continue Reading…