Dependency Injection Flashcards

1
Q
  1. Where does Spring objects save?
  2. What is @component
    3.What is @Autowired
    4.What is @Qualifier , when it will be used?
    5.Benefits of using Dependency Injection include:
  3. What is @Autoconfiguration?
A
  1. Spring Objects will be in Spring container in Heap memory.
    Heap memory will have separate , container for that.
    2.@Component will create a Object in Spring container
    3.@Autowired annotation is used for dependency injection. It allows you to automatically wire or inject dependencies into your Spring components, such as controllers, services, or repositories.
    4.@Qualifier annotation is used in Spring Framework to specify which bean should be autowired when there are multiple beans of the same type available. so this is called Dependency injection

we should name all class (‘bbb’)
and we can use that name inside the Qualifier
5. Loose coupling, Testability, Reusability
6. We don’t want to install server and configure all things , by Springboot autoconfiguration we can do this.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

1.What is Dependency injection?
2. What is @Autoconfiguration?

A

1.In DI, the dependencies required by a class are “injected” or provided to it by an external entity, typically a framework or a container. This removes the responsibility of creating and managing dependencies from the class itself, resulting in more modular and reusable code.
2.@AutoConfiguration is an annotation used to enable or disable automatic configuration of beans based on classpath scanning and the presence of certain dependencies.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q
  1. What is the use of Thyme leaf?
    2.What is JPA?
    3.Actuator is used for ?
A
  1. Its used for front end
  2. To connect Spring Data into Database.
    3.Actuator is used for debugging.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q
  1. Does spring container will take two objects?
    2.What is the use of Configurable application context?
  2. What is bean?
    4.Wha is singleton scope?
  3. If we want to create multiple objects and constructor should call all that times mean what you should do?
    6.what is SpringApplicatio.run() do?
    7.What Exception we will get when we give any data without memory?
A

1.No spring container will take only one objects , cause of singleton class, if we have class Home it will take the object as home by using small letter as name.
2. The ConfigurableApplicationContext in Spring Boot is responsible for loading and applying the configuration properties defined in various configuration files. It can load properties from application.properties or application.yml files, as well as from externalized property sources.
3.In Spring Boot, a bean refers to an object that is managed by the Spring IoC (Inversion of Control) container. It is an instance of a class that is created, configured, and assembled by the container based on the configuration metadata provided by the developer. T
4.Even after creating two objects only one time constructor is called .
5. You should use the @Scope Annotations
@Scope = (value =’prototype);
6. Setup default configuration, starts spring application context, starts , stops tomcat server, class path scan
7.We will be Getting Null pointer Exception .

How well did you know this?
1
Not at all
2
3
4
5
Perfectly