Home » Tag Archives: Spring (page 5)

Tag Archives: Spring

Data aggregation with Spring Data MongoDB and Spring Boot

java-interview-questions-answers

MongoDB aggregation framework is designed for grouping documents and transforming them into an aggregated result. The aggregation query consists in defining several stages that will be executed in a pipeline. If you are interested in more in-depth details about the framework, then mongodb docs are a good point to start. The point of this post is to write a web ...

Read More »

Spring MVC: Trgger manual validation of a form object

spring-interview-questions-answers

Sometimes it may be needed to use manual validation in Spring MVC @Controller. This is very simple with Spring’s org.springframework.validation.ValidationUtils class. Learn how to invoke a validator in two different scenarios.             Scenario 1 – invoke validation In this scenario, I have a user form with username field. Username field is validated with custom validator ...

Read More »

Retry handling with Spring-Retry

spring-interview-questions-answers

Whenever software components communicate with each other, there is a chance for temporary self-correcting faults. Such faults include the temporary unavailability of a service, momentary loss of network connectivity, or timeouts that arise when a service is busy. In such situations a proper retry handling can reduce the problems these faults might cause. In this post we will see how ...

Read More »

Read property files with PropertyPlaceholderConfigurer

spring-interview-questions-answers

1. Introduction Usually when we are concerned with multiple servers where the application is deployed before going into production, we can configure the environment-specific parameters in an external property file. It might be the database details, which is different for test server and the production server. So it’s better we we choose to keep the database configuration file in an external property file. Similarly, we can choose ...

Read More »

Introducing The Delegate Pattern

spring-interview-questions-answers

Delegate: a person who is chosen or elected to vote or act for others – Merriam-Webster. Delegate pattern: In software engineering, the delegation pattern is a design pattern in object-oriented programming where an object, instead of performing one of its stated tasks, delegates that task to an associated helper object – Wikipedia. Make things as simple as possible, but not simpler – Albert ...

Read More »

SpringBoot : Working with MyBatis

mybatis-logo

MyBatis is a SQL Mapping framework with support for custom SQL, stored procedures and advanced mappings. SpringBoot doesn’t provide official support for MyBatis integration, but MyBatis community built a SpringBoot starter for MyBatis. You can read about the SpringBoot MyBatis Starter release announcement at http://blog.mybatis.org/2015/11/mybatis-spring-boot-released.html and you can explore the source code on GitHub https://github.com/mybatis/mybatis-spring-boot. Create a SpringBoot Maven project ...

Read More »

SpringBoot : Working with JOOQ

jooq-2-logo

In my previous article SpringBoot : Working with MyBatis  we have learned how to use SpringBoot MyBatis Starter to quickly get up and running with Spring and MyBatis. In this article we are going to learn about how to use SpringBoot JOOQ Starter. JOOQ (Java Object Oriented Querying) is a persistence framework which embraces SQL. JOOQ provides the following features: Building ...

Read More »

SpringBoot : Working with JdbcTemplate

spring-interview-questions-answers

Spring provides a nice abstraction on top of JDBC API using JdbcTemplate and also provides great transaction management capabilities using annotation based approach. First let’s take a quick look at how we generally use Spring’s JdbcTemplate (without SpringBoot) by registering DataSource, TransactionManager and JdbcTemplate beans and optionally we can register DataSourceInitializer bean to initialize our database. @Configuration @ComponentScan @EnableTransactionManagement @PropertySource(value ...

Read More »

How SpringBoot AutoConfiguration magic works?

spring-interview-questions-answers

In my previous post Why SpringBoot? we have looked at how to create a SpringBoot application. But you may or may not understand what is going on behind the scenes. You may want to understand the magic behind the SpringBoot’s AutoConfiguration. But before that you should know about Spring’s @Conditional feature based on which all the SpringBoot’s AutoConfiguration magic depends. ...

Read More »

Want to take your Java skills to the next level?

Grab our programming books for FREE!

Here are some of the eBooks you will get:

  • Advanced Java Guide
  • Java Design Patterns
  • JMeter Tutorial
  • Java 8 Features Tutorial
  • JUnit Tutorial
  • JSF Programming Cookbook
  • Java Concurrency Essentials