Spring Boot Annotations - @SpringBootApplication, @Component, @Bean, etc.

    Question 1CORE SPRING BOOT - @SpringBootApplication Annotation

    The @SpringBootApplication annotation is a convenience annotation that combines which three annotations?

    Question 2CORE SPRING BOOT - @Component Annotation

    What is the main purpose of the @Component annotation in Spring Boot?

    Question 3CORE SPRING BOOT - @Bean Annotation

    What is the role of the @Bean annotation in Spring Boot?

    Question 4CORE SPRING BOOT - Code Snippet (@Autowired)

    What will happen when the following code executes?

    @Component public class ServiceA { } @Component public class ServiceB { @Autowired private ServiceA serviceA; }

    Question 5CORE SPRING BOOT - @Controller vs @RestController

    Which statement correctly distinguishes between @Controller and @RestController?

    Question 6CORE SPRING BOOT - Code Snippet (@ConfigurationProperties)

    What is the purpose of the following code?

    @ConfigurationProperties(prefix = "app") @Component public class AppProperties { private String name; private int version; // getters and setters }

    Question 7CORE SPRING BOOT - @Service and @Repository

    Which of the following is true regarding @Service and @Repository annotations?

    Question 8CORE SPRING BOOT - Code Snippet (@ConditionalOnMissingBean)

    What does the following code do?

    @Bean @ConditionalOnMissingBean public MyService myService() { return new MyService(); }

    Question 9CORE SPRING BOOT - @Primary Annotation

    What is the purpose of the @Primary annotation in Spring Boot?

    Question 10CORE SPRING BOOT - @PostConstruct Annotation

    When is a method annotated with @PostConstruct executed in a Spring Boot bean?