Dependency Injection Flashcards
- Where does Spring objects save?
- What is @component
3.What is @Autowired
4.What is @Qualifier , when it will be used?
5.Benefits of using Dependency Injection include: - What is @Autoconfiguration?
- 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.
1.What is Dependency injection?
2. What is @Autoconfiguration?
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.
- What is the use of Thyme leaf?
2.What is JPA?
3.Actuator is used for ?
- Its used for front end
- To connect Spring Data into Database.
3.Actuator is used for debugging.
- Does spring container will take two objects?
2.What is the use of Configurable application context? - What is bean?
4.Wha is singleton scope? - 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?
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 .