Dependency Injection(DI) is the most important feature of Spring Framework. Dependency Injection is a design pattern that removes the dependency between objects so that the objects are loosely coupled. In Spring there exist two major types of Dependency Injection. Setter Injection Constructor Injection … [Read more...]
Top 80 Spring Interview Questions
1. What is Spring Framework? Spring is an open-source framework created to address the complexity of building enterprise applications. It eases the development effort by providing IOC container, Dependency Injection, Aspect-oriented programming, etc. Spring framework also allows you to connect to other frameworks such as Struts, EJB, Hibernate, etc. 2. What are the advantages … [Read more...]
Spring Data MongoDB Example – MongoRepository
In this Spring Data MongoDB Example, we will build a Simple Spring Application and perform CRUD operations on the Mongo Database with the help of Spring Data MongoDB and MongoRepository. MongoDB is a document-based NoSQL database, providing high performance and high availability. Spring provides seamless integration with the Mongo database through Spring Data MongoDB which is a … [Read more...]
Spring Security REST Basic Authentication
In this article, let's learn how to enable Spring Security REST Basic Authentication. We will be setting up the Spring Security using XML configuration. We will be building the Employee Management system where in which you will be able to Create an Employee, Get all the Employee / particular Employee details, Modify an existing Employee and Delete the Employee. … [Read more...]
Spring XML Configuration Example
In this Spring XML Configuration Example, we will be creating a simple spring application using the spring xml configurations which displays Book and Library details and we will also be injecting book reference into library class. … [Read more...]
Spring Data JPA Many To Many Foreign Key Example
Previously we have learnt how to do One To One and One To Many Mapping using Spring Data JPA, in this article, we will learn about Spring Data JPA Many to Many mapping. Let's take the Example of Employee and Address, one Employee can have many Address and similarly, one Address can have many Employees. Let's dig into the code. … [Read more...]
Spring Data JPA One To Many Foreign Key Example
In this Spring Data JPA One To Many article, we will learn how to achieve One To Many Mapping using Spring Data JPA. In this approach, we will re-use the same two tables which we used in our previous Spring Data JPA One To One Example. … [Read more...]
Spring CRUD Example with JdbcTemplate + Maven + Oracle
In this Spring CRUD Example, we will build a Simple Spring Application and perform CRUD operations using Spring JdbcTemplate. We will create a simple Employee management application which has abilities to create a new employee, update the existing employee, get a particular employee/ all employee and finally delete the existing employee. … [Read more...]
Spring JdbcTemplate Example + JdbcDaoSupport
Spring framework provides excellent support to JDBC, it provides a super powerful utility class called "JdbcTemplate" which helps us avoid boiler-plate code from our database operations such as Creating Connection, Statement, Closing the Resultset and Connection, Exception handling, Transaction management etc. In this Spring JdbcTemplate Example, let's understand how … [Read more...]
Spring PropertyPlaceholderConfigurer Example – Reading a Property File
It’s never a good practice to hard code and combine any environment related details such a username, password or file path etc. along with spring bean configuration. Usually in Java we will be having those details written in a separate property file and it will be read during the execution, the same can be followed in the spring as well using … [Read more...]
Spring Bean Creation – Static Factory Method & Instance Factory Method
In Spring we can create bean using Spring FactoryBean, FactoryBean is an interface and we need to give implementations for the methods in it. If you don't want to go by that methodology but still want Java Factory Pattern to be implemented then we can go for Static Factory Method and Instance Factory Method. The client who requests for an object can simply make a call to … [Read more...]
Spring Bean Life Cycle – Bean Initialization and Destruction
Spring IoC container is also responsible for managing the Spring Bean Life Cycle, the life cycle of beans consist of call back methods such as Post initialization call back method and Pre destruction call back method. Below steps are followed by Spring IoC Container to manage bean life cycle. Spring Bean Life Cycle Creation of bean instance by a factory method. Set the … [Read more...]
- 1
- 2
- 3
- 4
- Next Page »