Câu hỏi phỏng vấn Spring
Câu hỏi

What are Spring beans?

Câu trả lời

Spring beans are fundamental elements in the Spring Framework, representing the objects that form the backbone of your application and are managed by the Spring Inversion of Control (IoC) container. These beans are instantiated, assembled, and otherwise managed by the Spring IoC container, not by the application itself[1][4].

A Spring bean is any object that is initialized and managed by the Spring IoC container through configuration metadata supplied by the developer. This metadata can be provided via XML configuration files, annotations, or Java-based configuration[4][6][8][9]. The beans are created with specific configurations that define their lifecycle, dependencies, and other properties necessary for the application's functionality[4][10].

The Spring IoC container handles the lifecycle of beans, including creation, initialization, and destruction, and manages their dependencies through a process called dependency injection. This allows for loose coupling between components and easier management of application logic[2][4][8].

Spring beans can be defined in various scopes such as singleton (one instance per Spring IoC container), prototype (new instance each time bean is requested), request, session, and application scopes, depending on the requirements of the application[2][5]. These scopes help in managing the state and interactions of beans across different parts of an application and in different scenarios[2][5].
...

junior

junior

Gợi ý câu hỏi phỏng vấn

middle

What is Bean Factory?

senior

What’s the difference between @Component, @Controller, @Repository & @Service annotations in
Spring?

expert

I want to know what actually happens when you annotate a method with @Transactional?

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào