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

What do you mean by Bean wiring ?

Câu trả lời

Bean wiring in the context of the Spring Framework refers to the process of configuring how Spring beans—objects managed by the Spring IoC (Inversion of Control) container—are interconnected. This configuration is essential for dependency injection, where the Spring container automatically injects the required dependencies into Spring beans at runtime.

Understanding Bean Wiring

  1. Definition and Purpose:
    Bean wiring is essentially about defining how different components (beans) in a Spring application should interact with each other. It involves setting up the dependencies that beans have on one another, which the Spring container then resolves and injects automatically[1].

  2. How It Works:

    • Explicit Wiring: You explicitly specify bean dependencies in the configuration file (XML-based configuration) or through annotations (annotation-based configuration). For example, in XML configuration, you might use <property> tags to inject dependencies[2].
    • Implicit Wiring (Auto Wiring): Spring can also automatically wire beans by inspecting the beans available in its context and making intelligent decisions about wiring without explicit configuration. This can be done using autowiring modes like byName, byType, and constructor[3][4].
  3. Modes of Auto Wiring:

    • byName: The container looks for a bean with the same name as the property that needs to be wired.
    • byType: The container looks for a bean that matches the property's type.
    • constructor: Similar to byType, but applies to construc...
junior

junior

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

senior

What is reactive programming?

middle

What is Bean Factory?

junior

Do you need spring-mvc.jar in your classpath or is it part of spring-core?

Bình luận

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

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