0 votes
1 view
in Java by (10.2k points)

I am yet to find a high-level definition of Spring beans that I can understand. I see them referenced often in Grails documentation and books, but I think that understanding what they are would be beneficial. So what are Spring beans? How can they be used? Do they have something to do with Dependency Injection?

1 Answer

0 votes
by (46.1k points)
edited by

The objects that set the vertebrae of your application and that are controlled by the Spring IoC* package are called beans. A bean is an object that is instantiated, collected, and contrarily managed by a Spring IoC container. These beans are designed with the configuration metadata that you provide to the container, for instance, in the form of XML representations.

Want to learn Spring from the scratch? Here's is the right video for you on Spring provided by Intellipaat

More to learn about beans and field from SpringSource:

When you build a bean definition of what you are planning is a method for performing actual instances of the class defined by that bean definition. The thought that a bean definition is a recipe is important because it means that, just like a class, you can potentially have many object instances generated from a single method.

You can command not only the various provinces and configuration values that are to be filled into an object that is created from a distinct bean definition but also the range of the objects produced from a particular bean definition. This method is very potent and provides you the versatility to determine the scope of the objects you plan through configuration rather than having to 'bake in' the range of an object at the Java class level. Beans can be determined to be deployed in one of several scopes

*IoC: Inversion of Control

Welcome to Intellipaat Community. Get your technical queries answered by top developers !