Which of the following annotations is used to mark a class as a source of bean definitions?
- @Configuration
- @Entity
- @Repository
- @Service
The @Configuration annotation is used to mark a class as a source of bean definitions. This means that any method annotated with @Bean within a class annotated with @Configuration will define a bean in the Spring context, allowing it to be injected into other components, services, etc. This is fundamental for creating the beans that make up the application context in a Spring application.
Loading...
Related Quiz
- What components are typically scanned and loaded when a test is annotated with @DataJpaTest in Spring Boot?
- Which of the following can be used to enable method security annotations in a Spring Security configuration class?
- Which annotation is used to test only the web layer in a Spring Boot application?
- To inject mock objects into the tested object in a Spring Boot unit test, the _____ annotation is used with Mockito.
- How does Ribbon contribute to the functioning of a microservices-based application?