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

What does a bean definition contain?

Câu trả lời

A bean definition in the Spring Framework contains the configuration metadata that the Spring Inversion of Control (IoC) container needs to know in order to instantiate, configure, and manage the lifecycle of a bean. Specifically, a bean definition includes the following properties:

  1. Class: This mandatory attribute specifies the class of the bean that needs to be created[1][2].
  2. Name/ID: This attribute provides a unique identifier for the bean within the Spring container. In XML-based configuration, this is typically done using the id or name attributes[1][2].
  3. Scope: This attribute defines the scope of the bean, such as singleton, prototype, request, session, and global session. It determines the lifecycle and visibility of the bean[1][2].
  4. Constructor Arguments: These are used to inject dependencies into the bean through its constructor[1][2].
  5. Properties: These are used to inject dependencies via setter methods or directly into fields[1][2].
  6. Autowiring Mode: This specifies how the Spring container should perform dependency injection[1].
  7. Lazy Initialization Mode: If set to true, the bean will be created only when it is first requested, rather than at startup[1][2].
  8. Initialization Method: A callback me...
junior

junior

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

middle

Name some of the Design Patterns used in the Spring Framework?

senior

What is Weaving in Spring?

expert

What are some of the valid return types of a controller method?

Bình luận

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

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