Browsed by
Category: Spring

Spring Core- Dependency Injection using setter method

Spring Core- Dependency Injection using setter method

In Java programming language, it is common that one class contains reference of other class. This is said to be “HAS A relationship” in OOP.

Spring framework provides facility to inject one bean to another bean to achieve “HAS  A” relationship.

The below example demonstrate dependency injection using setter method.

Read More Read More

Spring Core – Create bean(POJO) using constructor

Spring Core – Create bean(POJO) using constructor

Constructor is common way to create a instance of class. In Spring framework we have facility to create a bean using constructors. The below example demonstrate how to create a bean using constructor.

To create bean(POJO) using setter method, click here.

1) School.java

We have a School bean which contain name and noOfFaculties as instance variables.

Read More Read More