A system is called fail-fast if it stops immediately its execution when an error occurred. The system does not continue with the errors and these errors in the fail fast systems are immediately exposed. But, fail-safe system does the opposite thing. The fail-safe system does not stop its execution despite an error or a fault…

Posted in Java

Fail Fast vs Fail Safe in Java

Introduction 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…

Posted in Spring JDBC

Spring NamedParameterJdbcTemplate and Collections.singletonMap Example

With this example we will show you how to merge Collections in Spring. Since Spring 2.0, the container supports merging of collections. You can define <prop/>, <list/>, <map/> and <set/> of parent-style and then you can inherit the child-style element and override values of each type from parent collections. That is, the child collection’s values…

Posted in Spring Core

Collection merging in Spring

With this example we will show you how to inject Collections in Spring Bean set. In order to show how Collections can be injected in a Spring Bean we will create a simple Spring Bean with a property Set. If you already have an idea on how to create a maven project in Eclipse will…

Posted in Spring Core

Collection element set in Spring

With this example I will show you how to inject Collection Type Map in Spring Bean. I am going to show you in Spring Boot framework how to read map based key/value pair. I will also show you how to read the map based values from traditional XML config file. In order to show how…

Posted in Spring Core

Working with Collection Element Type Map in Spring Application

With this example I will show you how to inject List Collection in Spring application. The collection type I am going to show you is List or Array. I am going to use Spring Boot framework. I will show you various ways of loading a list of configurable properties in Spring application. The list of…

Posted in Spring Boot Spring Core

Collection Element List in Spring

With this example I will show you how to inject Collections type Props in Spring applications. This is similar to the element type Map I had shown in another example. I am going to use Spring Boot framework but I will show you both using application.properties file as well as traditional XML config file to…

Posted in Java Spring Core

Working with Collection Element Props in Spring Application