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.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *