What does it mean that Spring framework has a "POJO implementation"

cpatel :

I read somewhere that "Spring framework is lightweight because of its POJO implementation". But what does "POJO implementation" mean?

Jesper :

One of the important principles of Spring is that it wants to help you to create loosely coupled software - which means that there should be no unnecessary dependencies between the components of your software.

One of the ways it does this is by allowing you to work with POJOs (Plain Old Java Objects) - just simple Java classes that don't need to extend classes or implement interfaces from the Spring Framework, and that don't need dependencies on other parts of the framework.

Since these POJO classes don't have any dependencies on the framework, you can easily reuse them in other applications where you are not using the Spring Framework.

It also helps to understand the history of the Spring Framework. Many years ago, when Java EE (or J2EE, as it was known then) was new, it was hard to create an EJB. You had to implement special J2EE interfaces and implement special lifecycle methods. This made it hard to use. The Spring Framework was created as a reaction to this. In contrast to J2EE, you could implement your business logic in simple POJO classes without the complicated boilerplate code that J2EE required.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=142388&siteId=1