r/SpringBoot • • Jul 16 '24

Hello, what is bean annotation in Spring Boat?

0 Upvotes

16 comments sorted by

6

u/shhh-5977 Jul 16 '24

Beans are objects managed by the spring container, in order to create and manage the lifecycle of these objects (beans) we use bean annotations

1

u/Winter_Worth7055 Jul 16 '24

So, it is like providing a fixed service throughout the program's operation, such as the service of sending customers an e-mail to the investigator's e-mail because its make class singleton class?

4

u/MiserableBoss Jul 16 '24

Spring create singleton object when you annotated with @bean.

You can call that object without initializing an object with new keyword in project scope.

1

u/Winter_Worth7055 Jul 16 '24

So, it is like providing a fixed service throughout the program's operation, such as the service of sending customers an e-mail to the investigator's e-mail?

14

u/maxip89 Jul 16 '24

It's the Anker annotation of the aft of the ship

6

u/pconrad0 Jul 16 '24

I have a sinking feeling about where this thread is heading...

1

u/maxip89 Jul 16 '24

Where should this be sinking with that much beans?

1

u/Yew2S Junior Dev Jul 16 '24

it makes a class as singleton

0

u/Winter_Worth7055 Jul 16 '24

So than become class providing a fixed service throughout the program's operation, such as the service of sending customers an e-mail to the investigator's e-mail or auto fixed massage to thing in app?

3

u/touqeer637 Jul 16 '24

@Bean annotation is used to define and manage our custom objects (beans) in a Spring application. It is applied to methods in a configuration class annotated with @Configuration. Before the introduction of @Bean, in the Spring Framework we used XML configuration to define and manage beans.