Spring Annotations
Learn about a few interview questions regarding Spring annotations.
We'll cover the following...
- What is the purpose of the @Component annotation?
- What is the difference between @Component, @Service, @Repository, and @Controller?
- Why is @Primary annotation used?
- Why is @Qualifier annotation used?
- Which annotations takes precedence: @Primary or @Qualifier?
- Why is the @Required annotation used?
- What is the purpose of @Autowired annotation?
- Both @Bean and @Component annotations create beans. What is the difference between the two?
- What is the difference between @Inject and @Autowired in Spring? Which one to use under which condition?
What is the purpose of the @Component
annotation?
@Component
annotation is used to define a bean. This annotation is placed on a Java class. The XML file contains the ...
Access this course and 1400+ top-rated courses and projects.